Support open podcasts page insteam of group page.

This commit is contained in:
Stonegate 2021-01-07 00:29:24 +08:00
parent 4fe335ff69
commit bcaab84b8f
3 changed files with 46 additions and 21 deletions

View File

@ -10,6 +10,7 @@ import 'package:focused_menu/modals.dart';
import 'package:line_icons/line_icons.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:tsacdop/state/setting_state.dart';
import 'package:tuple/tuple.dart' as tuple;
import '../episodes/episode_detail.dart';
@ -30,7 +31,6 @@ import '../util/hide_player_route.dart';
import '../util/pageroute.dart';
import '../widgets/custom_widget.dart';
import '../widgets/general_dialog.dart';
import 'home.dart';
class ScrollPodcasts extends StatefulWidget {
@override
@ -115,11 +115,11 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
var groups = data.item1;
var import = data.item2;
return groups.isEmpty
? Container(
? SizedBox(
height: (width - 20) / 3 + 140,
)
: groups[_groupIndex].podcastList.length == 0
? Container(
? SizedBox(
height: (width - 20) / 3 + 140,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -184,7 +184,12 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
Navigator.push(
context,
SlideLeftRoute(
page: PodcastManage()),
page: context
.read<
SettingState>()
.openAllPodcastDefalt
? PodcastList()
: PodcastManage()),
);
}
},
@ -344,7 +349,12 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
Navigator.push(
context,
SlideLeftRoute(
page: PodcastManage()),
page: context
.read<
SettingState>()
.openAllPodcastDefalt
? PodcastList()
: PodcastManage()),
);
}
},
@ -455,12 +465,7 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
hide: true),
duration: Duration(
milliseconds: 300),
)
// SlideLeftRoute(
// page: PodcastDetail(
// podcastLocal: podcastLocal,
// )),
);
));
},
child: PodcastPreview(
podcastLocal: podcastLocal,

View File

@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:line_icons/line_icons.dart';
import 'package:provider/provider.dart';
import 'package:tsacdop/state/setting_state.dart';
import '../state/podcast_group.dart';
import '../util/extension_helper.dart';
@ -189,12 +190,18 @@ class _PodcastManageState extends State<PodcastManage>
AddGroup()),
icon: Icon(Icons.add_circle_outline)),
),
IconButton(
splashRadius: 20,
onPressed: () =>
Navigator.push(context, ScaleRoute(page: PodcastList())),
icon: Icon(Icons.all_out)),
// _OrderMenu(),
Selector<SettingState, bool>(
selector: (_, setting) => setting.openAllPodcastDefalt,
builder: (_, data, __) {
return !data
? IconButton(
splashRadius: 20,
onPressed: () => Navigator.push(
context, ScaleRoute(page: PodcastList())),
icon: Icon(Icons.all_out))
: Center();
})
// _OrderMenu(),
],
),
body: WillPopScope(

View File

@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:provider/provider.dart';
import 'package:tsacdop/class/settingstate.dart';
import '../local_storage/sqflite_localpodcast.dart';
import '../state/podcast_group.dart';
@ -16,6 +17,7 @@ import '../util/pageroute.dart';
import '../widgets/custom_widget.dart';
import '../widgets/general_dialog.dart';
import 'podcast_detail.dart';
import 'podcast_manage.dart';
import 'podcast_settings.dart';
class AboutPodcast extends StatefulWidget {
@ -51,8 +53,7 @@ class _AboutPodcastState extends State<AboutPodcast> {
var _groupList = Provider.of<GroupList>(context, listen: false);
final s = context.s;
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0))),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
titlePadding: EdgeInsets.only(
top: 20, left: 20, right: context.width / 3, bottom: 20),
actions: <Widget>[
@ -117,7 +118,19 @@ class _PodcastListState extends State<PodcastList> {
appBar: AppBar(
title: Text(context.s.podcast(2)),
leading: CustomBackButton(),
centerTitle: true,
actions: [
Selector<SettingState, bool>(
selector: (_, setting) => setting.openAllPodcastDefalt,
builder: (_, data, __) {
return data
? IconButton(
splashRadius: 20,
icon: Icon(Icons.all_out),
onPressed: () => Navigator.push(
context, ScaleRoute(page: PodcastManage())))
: Center();
})
],
),
body: SafeArea(
child: Container(
@ -142,7 +155,7 @@ class _PodcastListState extends State<PodcastList> {
onTap: () {
Navigator.push(
context,
ScaleRoute(
SlideLeftRoute(
page: PodcastDetail(
podcastLocal: snapshot.data[index],
)),