Skip to content

Commit

Permalink
Fix build, Bump version and rearrange files
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia committed Jun 13, 2022
1 parent 7b781c6 commit 5855f6a
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 170 deletions.
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ android {

signingConfigs {
release {
keyAlias keyProps['keyAlias']
keyPassword keyProps['keyPassword']
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
storePassword keyProps['storePassword']
keyAlias keyProperties['keyAlias']
keyPassword keyProperties['keyPassword']
storeFile keyProperties['storeFile'] ? file(keyProperties['storeFile']) : null
storePassword keyProperties['storePassword']
}
}

Expand Down
204 changes: 39 additions & 165 deletions lib/ui/screens/channel_screen/channel_screen.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:built_collection/built_collection.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:libadwaita/libadwaita.dart';
import 'package:libadwaita_bitsdojo/libadwaita_bitsdojo.dart';
import 'package:lucide_icons/lucide_icons.dart';
import 'package:piped_api/piped_api.dart';
import 'package:pstube/data/extensions/extensions.dart';
import 'package:pstube/ui/screens/channel_screen/tabs/tabs.dart';
import 'package:pstube/ui/widgets/widgets.dart' hide ChannelInfo;
import 'package:youtube_explode_dart/youtube_explode_dart.dart';

Expand Down Expand Up @@ -124,34 +124,22 @@ class ChannelScreen extends HookWidget {
(MapEntry<int, String> entry) => SafeArea(
top: false,
bottom: false,
child: _CustomTab(
currentVidPage: _currentVidPage.value,
channelInfo: channelInfo.value,
getStats: getStats,
channel: channel.value,
videosScreen: ListView.builder(
shrinkWrap: true,
child: _KeepAliveTab(
isHomeVisible: entry.key == 0 && channel.value != null,
isVideosVisible:
entry.key == 1 && _currentVidPage.value != null,
isAboutVisible: entry.key == 2 && channelInfo.value != null,
homeTab: ChannelHomeTab(
channel: channel.value,
),
videosTab: ChannelVideosTab(
controller: controller,
itemCount: _currentVidPage.value != null
? _currentVidPage.value!.length + 1
: 1,
itemBuilder: (ctx, index) {
final loading = index == _currentVidPage.value!.length;

if (loading) return getCircularProgressIndicator();

final streamItem = _currentVidPage.value![index];

return PSVideo(
date: streamItem.uploadedDate,
videoData: streamItem.toVideo,
loadData: true,
showChannel: false,
isRow: true,
);
},
currentVidPage: _currentVidPage,
),
aboutTab: ChannelAboutTab(
channelInfo: channelInfo.value,
getStats: getStats,
),
entry: entry,
),
),
)
Expand All @@ -161,154 +149,40 @@ class ChannelScreen extends HookWidget {
}
}

class _CustomTab extends StatefulWidget {
const _CustomTab({
required BuiltList<StreamItem>? currentVidPage,
required this.channelInfo,
required this.getStats,
required this.channel,
required this.entry,
required this.videosScreen,
}) : _currentVidPage = currentVidPage;

final BuiltList<StreamItem>? _currentVidPage;
final ChannelAbout? channelInfo;
final List<Widget> getStats;
final ChannelInfo? channel;
final MapEntry<int, String> entry;
final Widget videosScreen;
class _KeepAliveTab extends StatefulWidget {
const _KeepAliveTab({
required this.isHomeVisible,
required this.isVideosVisible,
required this.isAboutVisible,
required this.homeTab,
required this.videosTab,
required this.aboutTab,
});

final bool isHomeVisible;
final bool isVideosVisible;
final bool isAboutVisible;
final Widget homeTab;
final Widget videosTab;
final Widget aboutTab;

@override
State<_CustomTab> createState() => _CustomTabState();
State<_KeepAliveTab> createState() => _KeepAliveTabState();
}

class _CustomTabState extends State<_CustomTab>
class _KeepAliveTabState extends State<_KeepAliveTab>
with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
super.build(context);
return AdwClamp.scrollable(
maximumSize: 1200,
child: (widget.entry.key == 0 && widget.channel != null)
? Column(
children: [
if (widget.channel!.bannerUrl != null)
CachedNetworkImage(
imageUrl: widget.channel!.bannerUrl!,
),
Padding(
padding: const EdgeInsets.all(12),
child: Row(
children: [
ClipOval(
child: Container(
decoration: widget.channel!.avatarUrl != null
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(
widget.channel!.avatarUrl!,
),
),
color: Colors.grey,
)
: null,
height: 80,
width: 80,
),
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.channel!.name ?? ''),
Text(
widget.channel!.subscriberCount != null
? '${widget.channel!.subscriberCount!.addCommas} ${context.locals.subscribers}'
: context.locals.hidden,
),
],
),
],
),
),
],
)
: (widget.entry.key == 1 && widget._currentVidPage != null)
? widget.videosScreen
: widget.entry.key == 2 && widget.channelInfo != null
? Flex(
direction: Axis.horizontal,
children: [
Flexible(
flex: 6,
child: ListView(
primary: false,
controller: ScrollController(),
shrinkWrap: true,
padding: const EdgeInsets.symmetric(horizontal: 8),
children: [
if (widget.channelInfo!.description != null) ...[
Padding(
padding:
const EdgeInsets.symmetric(vertical: 8),
child: Text(
context.locals.description,
style: context.textTheme.headline5,
),
),
SelectableText(
widget.channelInfo!.description!,
),
],
if (widget
.channelInfo!.channelLinks.isNotEmpty) ...[
const Divider(),
Padding(
padding:
const EdgeInsets.symmetric(vertical: 8),
child: Text(
context.locals.links,
style: context.textTheme.headline5,
),
),
Wrap(
children: [
for (ChannelLink link
in widget.channelInfo!.channelLinks)
AdwButton.pill(
onPressed: link.url.toString().launchIt,
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 12,
),
margin: const EdgeInsets.symmetric(
horizontal: 3,
vertical: 3,
),
child: Text(link.title),
// labelStyle: context.textTheme.bodyText2,
// ),
)
],
),
],
if (context.isMobile) ...[
const Divider(),
...widget.getStats,
]
],
),
),
if (!context.isMobile)
Flexible(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: widget.getStats,
),
),
],
)
child: widget.isHomeVisible
? widget.homeTab
: widget.isVideosVisible
? widget.videosTab
: widget.isAboutVisible
? widget.aboutTab
: getCircularProgressIndicator(),
);
}
Expand Down
87 changes: 87 additions & 0 deletions lib/ui/screens/channel_screen/tabs/channel_about_tab.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:libadwaita/libadwaita.dart';
import 'package:pstube/data/extensions/extensions.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart';

class ChannelAboutTab extends StatelessWidget {
const ChannelAboutTab({
super.key,
required this.channelInfo,
required this.getStats,
});

final ChannelAbout? channelInfo;
final List<Widget> getStats;

@override
Widget build(BuildContext context) {
return Flex(
direction: Axis.horizontal,
children: [
Flexible(
flex: 6,
child: ListView(
primary: false,
controller: ScrollController(),
shrinkWrap: true,
children: [
if (channelInfo!.description != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(
context.locals.description,
style: context.textTheme.headline5,
),
),
SelectableText(
channelInfo!.description!,
),
],
if (channelInfo!.channelLinks.isNotEmpty) ...[
const Divider(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(
context.locals.links,
style: context.textTheme.headline5,
),
),
Wrap(
children: [
for (ChannelLink link in channelInfo!.channelLinks)
AdwButton.pill(
onPressed: link.url.toString().launchIt,
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 12,
),
margin: const EdgeInsets.symmetric(
horizontal: 3,
vertical: 3,
),
child: Text(link.title),
// labelStyle: context.textTheme.bodyText2,
// ),
)
],
),
],
if (context.isMobile) ...[
const Divider(),
...getStats,
]
],
),
),
if (!context.isMobile)
Flexible(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: getStats,
),
),
],
);
}
}
Loading

0 comments on commit 5855f6a

Please sign in to comment.