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(
children: <Widget>[
Expanded(
child: NestedScrollView(
innerScrollPositionKeyBuilder: () {
return Key('tab${_controller.index}');
},
pinnedHeaderSliverHeightBuilder: () => 50,
headerSliverBuilder: (context, innerBoxScrolled) {
return <Widget>[
SliverToBoxAdapter(
child: Column(
children: <Widget>[
SizedBox(
height: 50.0,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
featureDiscoveryOverlay(
context,
featureId: addFeature,
tapTarget:
Icon(Icons.add_circle_outline),
title: s.featureDiscoverySearch,
backgroundColor: Colors.cyan[600],
buttonColor: Colors.cyan[500],
description:
s.featureDiscoverySearchDes,
child: IconButton(
tooltip: s.add,
splashRadius: 20,
icon:
child: ScrollConfiguration(
behavior: NoGrowBehavior(),
child: NestedScrollView(
innerScrollPositionKeyBuilder: () {
return Key('tab${_controller.index}');
},
pinnedHeaderSliverHeightBuilder: () => 50,
headerSliverBuilder: (context, innerBoxScrolled) {
return <Widget>[
SliverToBoxAdapter(
child: Column(
children: <Widget>[
SizedBox(
height: 50.0,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
featureDiscoveryOverlay(
context,
featureId: addFeature,
tapTarget:
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,
title: s.featureDiscoverySearch,
backgroundColor: Colors.cyan[600],
buttonColor: Colors.cyan[500],
description:
s.featureDiscoveryOMPLDes,
child: Padding(
padding: const EdgeInsets.only(
right: 5.0),
child: PopupMenu(),
)),
],
s.featureDiscoverySearchDes,
child: IconButton(
tooltip: s.add,
splashRadius: 20,
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(),
],
),
),
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),
)
Import(),
],
),
),
pinned: true,
),
];
},
body: TabBarView(
controller: _controller,
children: <Widget>[
NestedScrollViewInnerScrollPositionKeyWidget(
Key('tab0'), _RecentUpdate()),
NestedScrollViewInnerScrollPositionKeyWidget(
Key('tab1'), _MyFavorite()),
NestedScrollViewInnerScrollPositionKeyWidget(
Key('tab2'), _MyDownload()),
],
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,
),
];
},
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) {
if (snapshot.hasData && snapshot.data.isNotEmpty) {
final history = snapshot.data;
return SizedBox(
child: Wrap(
direction: Axis.horizontal,
children: history
.map<Widget>((e) => Padding(
padding: const EdgeInsets.fromLTRB(8, 2, 0, 0),
child: FlatButton.icon(
color:
Colors.accents[history.indexOf(e)].withAlpha(70),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0),
),
onPressed: () => widget.onTap(e),
label: Text(e),
icon: Icon(
Icons.search,
size: 20,
),
return Wrap(
direction: Axis.horizontal,
children: history
.map<Widget>((e) => Padding(
padding: const EdgeInsets.fromLTRB(8, 2, 0, 0),
child: FlatButton.icon(
color:
Colors.accents[history.indexOf(e)].withAlpha(70),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0),
),
))
.toList(),
),
onPressed: () => widget.onTap(e),
label: Text(e),
icon: Icon(
Icons.search,
size: 20,
),
),
))
.toList(),
);
}
return SizedBox(
@ -289,12 +287,7 @@ class DiscoveryPageState extends State<DiscoveryPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_historyList(),
Padding(
padding: EdgeInsets.fromLTRB(20, 10, 10, 4),
child: Text('Popular',
style: context.textTheme.headline6
.copyWith(color: context.accentColor)),
),
SizedBox(height: 8),
SizedBox(
height: 200,
child: FutureBuilder<List<OnlinePodcast>>(
@ -344,7 +337,7 @@ class DiscoveryPageState extends State<DiscoveryPage> {
widget.onTap('');
searchState.setGenre = e;
},
title: Text(e.name),
title: Text(e.name, style: context.textTheme.headline6),
))
.toList(),
),

View File

@ -85,9 +85,8 @@ class MyHomePageDelegate extends SearchDelegate<int> {
child: IconButton(
tooltip: context.s.back,
splashRadius: 20,
icon: AnimatedIcon(
icon: AnimatedIcons.menu_arrow,
progress: transitionAnimation,
icon: Icon(
_getIconData(Theme.of(context).platform)
),
onPressed: () {
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 {
@ -378,8 +392,8 @@ class __SearchPopupMenuState extends State<_SearchPopupMenu> {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
elevation: 1,
icon: SizedBox(
height: 20,
width: 20,
height: 25,
width: 25,
child: CircleAvatar(
backgroundImage: _searchEngine == SearchEngine.podcastIndex
? AssetImage('assets/podcastindex_logo.png')

View File

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