1
0
mirror of https://github.com/stonega/tsacdop synced 2025-02-18 04:20:37 +01:00

Minor change.

This commit is contained in:
Stonegate 2021-02-05 00:08:16 +08:00
parent 133cbcd65f
commit 7c13058463
4 changed files with 160 additions and 148 deletions

View File

@ -123,127 +123,131 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
Column( Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: NestedScrollView( child: ScrollConfiguration(
innerScrollPositionKeyBuilder: () { behavior: NoGrowBehavior(),
return Key('tab${_controller.index}'); child: NestedScrollView(
}, innerScrollPositionKeyBuilder: () {
pinnedHeaderSliverHeightBuilder: () => 50, return Key('tab${_controller.index}');
headerSliverBuilder: (context, innerBoxScrolled) { },
return <Widget>[ pinnedHeaderSliverHeightBuilder: () => 50,
SliverToBoxAdapter( headerSliverBuilder: (context, innerBoxScrolled) {
child: Column( return <Widget>[
children: <Widget>[ SliverToBoxAdapter(
SizedBox( child: Column(
height: 50.0, children: <Widget>[
child: Row( SizedBox(
mainAxisAlignment: height: 50.0,
MainAxisAlignment.spaceBetween, child: Row(
children: <Widget>[ mainAxisAlignment:
featureDiscoveryOverlay( MainAxisAlignment.spaceBetween,
context, children: <Widget>[
featureId: addFeature, featureDiscoveryOverlay(
tapTarget: context,
Icon(Icons.add_circle_outline), featureId: addFeature,
title: s.featureDiscoverySearch, tapTarget:
backgroundColor: Colors.cyan[600],
buttonColor: Colors.cyan[500],
description:
s.featureDiscoverySearchDes,
child: IconButton(
tooltip: s.add,
splashRadius: 20,
icon:
Icon(Icons.add_circle_outline), Icon(Icons.add_circle_outline),
onPressed: () async { title: s.featureDiscoverySearch,
await showSearch<int>( backgroundColor: Colors.cyan[600],
context: context, buttonColor: Colors.cyan[500],
delegate: MyHomePageDelegate(
searchFieldLabel:
s.searchPodcast),
);
},
),
),
GestureDetector(
onTap: () => {
Theme.of(context).brightness ==
Brightness.light
? settings.setTheme =
ThemeMode.dark
: settings.setTheme =
ThemeMode.light
},
child: Image(
image: Theme.of(context)
.brightness ==
Brightness.light
? AssetImage('assets/text.png')
: AssetImage(
'assets/text_light.png'),
height: 30,
),
),
featureDiscoveryOverlay(context,
featureId: menuFeature,
tapTarget: Icon(Icons.more_vert),
backgroundColor: Colors.cyan[500],
buttonColor: Colors.cyan[600],
title: s.featureDiscoveryOMPL,
description: description:
s.featureDiscoveryOMPLDes, s.featureDiscoverySearchDes,
child: Padding( child: IconButton(
padding: const EdgeInsets.only( tooltip: s.add,
right: 5.0), splashRadius: 20,
child: PopupMenu(), icon: Icon(
)), Icons.add_circle_outline),
], onPressed: () async {
await showSearch<int>(
context: context,
delegate: MyHomePageDelegate(
searchFieldLabel:
s.searchPodcast),
);
},
),
),
GestureDetector(
onTap: () => {
Theme.of(context).brightness ==
Brightness.light
? settings.setTheme =
ThemeMode.dark
: settings.setTheme =
ThemeMode.light
},
child: Image(
image: Theme.of(context)
.brightness ==
Brightness.light
? AssetImage(
'assets/text.png')
: AssetImage(
'assets/text_light.png'),
height: 30,
),
),
featureDiscoveryOverlay(context,
featureId: menuFeature,
tapTarget: Icon(Icons.more_vert),
backgroundColor: Colors.cyan[500],
buttonColor: Colors.cyan[600],
title: s.featureDiscoveryOMPL,
description:
s.featureDiscoveryOMPLDes,
child: Padding(
padding: const EdgeInsets.only(
right: 5.0),
child: PopupMenu(),
)),
],
),
), ),
), Import(),
Import(),
],
),
),
SliverToBoxAdapter(
child: SizedBox(
height: height,
width: width,
child: ScrollPodcasts(),
),
),
SliverPersistentHeader(
delegate: _SliverAppBarDelegate(
TabBar(
indicator: _getIndicator(context),
isScrollable: true,
indicatorSize: TabBarIndicatorSize.tab,
controller: _controller,
tabs: <Widget>[
Tab(
child: Text(s.homeTabMenuRecent),
),
Tab(
child: Text(s.homeTabMenuFavotite),
),
Tab(
child: Text(s.download),
)
], ],
), ),
), ),
pinned: true, SliverToBoxAdapter(
), child: SizedBox(
]; height: height,
}, width: width,
body: TabBarView( child: ScrollPodcasts(),
controller: _controller, ),
children: <Widget>[ ),
NestedScrollViewInnerScrollPositionKeyWidget( SliverPersistentHeader(
Key('tab0'), _RecentUpdate()), delegate: _SliverAppBarDelegate(
NestedScrollViewInnerScrollPositionKeyWidget( TabBar(
Key('tab1'), _MyFavorite()), indicator: _getIndicator(context),
NestedScrollViewInnerScrollPositionKeyWidget( isScrollable: true,
Key('tab2'), _MyDownload()), indicatorSize: TabBarIndicatorSize.tab,
], controller: _controller,
tabs: <Widget>[
Tab(
child: Text(s.homeTabMenuRecent),
),
Tab(
child: Text(s.homeTabMenuFavotite),
),
Tab(
child: Text(s.download),
)
],
),
),
pinned: true,
),
];
},
body: TabBarView(
controller: _controller,
children: <Widget>[
NestedScrollViewInnerScrollPositionKeyWidget(
Key('tab0'), _RecentUpdate()),
NestedScrollViewInnerScrollPositionKeyWidget(
Key('tab1'), _MyFavorite()),
NestedScrollViewInnerScrollPositionKeyWidget(
Key('tab2'), _MyDownload()),
],
),
), ),
), ),
), ),

View File

@ -120,28 +120,26 @@ class DiscoveryPageState extends State<DiscoveryPage> {
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data.isNotEmpty) { if (snapshot.hasData && snapshot.data.isNotEmpty) {
final history = snapshot.data; final history = snapshot.data;
return SizedBox( return Wrap(
child: Wrap( direction: Axis.horizontal,
direction: Axis.horizontal, children: history
children: history .map<Widget>((e) => Padding(
.map<Widget>((e) => Padding( padding: const EdgeInsets.fromLTRB(8, 2, 0, 0),
padding: const EdgeInsets.fromLTRB(8, 2, 0, 0), child: FlatButton.icon(
child: FlatButton.icon( color:
color: Colors.accents[history.indexOf(e)].withAlpha(70),
Colors.accents[history.indexOf(e)].withAlpha(70), shape: RoundedRectangleBorder(
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(100.0),
borderRadius: BorderRadius.circular(100.0),
),
onPressed: () => widget.onTap(e),
label: Text(e),
icon: Icon(
Icons.search,
size: 20,
),
), ),
)) onPressed: () => widget.onTap(e),
.toList(), label: Text(e),
), icon: Icon(
Icons.search,
size: 20,
),
),
))
.toList(),
); );
} }
return SizedBox( return SizedBox(
@ -289,12 +287,7 @@ class DiscoveryPageState extends State<DiscoveryPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_historyList(), _historyList(),
Padding( SizedBox(height: 8),
padding: EdgeInsets.fromLTRB(20, 10, 10, 4),
child: Text('Popular',
style: context.textTheme.headline6
.copyWith(color: context.accentColor)),
),
SizedBox( SizedBox(
height: 200, height: 200,
child: FutureBuilder<List<OnlinePodcast>>( child: FutureBuilder<List<OnlinePodcast>>(
@ -344,7 +337,7 @@ class DiscoveryPageState extends State<DiscoveryPage> {
widget.onTap(''); widget.onTap('');
searchState.setGenre = e; searchState.setGenre = e;
}, },
title: Text(e.name), title: Text(e.name, style: context.textTheme.headline6),
)) ))
.toList(), .toList(),
), ),

View File

@ -85,9 +85,8 @@ class MyHomePageDelegate extends SearchDelegate<int> {
child: IconButton( child: IconButton(
tooltip: context.s.back, tooltip: context.s.back,
splashRadius: 20, splashRadius: 20,
icon: AnimatedIcon( icon: Icon(
icon: AnimatedIcons.menu_arrow, _getIconData(Theme.of(context).platform)
progress: transitionAnimation,
), ),
onPressed: () { onPressed: () {
close(context, 1); close(context, 1);
@ -173,6 +172,21 @@ class MyHomePageDelegate extends SearchDelegate<int> {
} }
} }
} }
static IconData _getIconData(TargetPlatform platform) {
switch (platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return Icons.arrow_back;
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return Icons.arrow_back_ios;
}
assert(false);
return null;
}
} }
class RssResult extends StatefulWidget { class RssResult extends StatefulWidget {
@ -378,8 +392,8 @@ class __SearchPopupMenuState extends State<_SearchPopupMenu> {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
elevation: 1, elevation: 1,
icon: SizedBox( icon: SizedBox(
height: 20, height: 25,
width: 20, width: 25,
child: CircleAvatar( child: CircleAvatar(
backgroundImage: _searchEngine == SearchEngine.podcastIndex backgroundImage: _searchEngine == SearchEngine.podcastIndex
? AssetImage('assets/podcastindex_logo.png') ? AssetImage('assets/podcastindex_logo.png')

View File

@ -511,6 +511,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
textTheme: theme.primaryTextTheme, textTheme: theme.primaryTextTheme,
brightness: theme.primaryColorBrightness, brightness: theme.primaryColorBrightness,
leading: widget.delegate.buildLeading(context), leading: widget.delegate.buildLeading(context),
elevation: 1,
title: TextField( title: TextField(
controller: widget.delegate._queryTextController, controller: widget.delegate._queryTextController,
focusNode: focusNode, focusNode: focusNode,