From 44e32ec13b5ff36b1d54d2135d400c107e460950 Mon Sep 17 00:00:00 2001 From: stonegate Date: Thu, 30 Jul 2020 00:37:51 +0800 Subject: [PATCH] Remove scroll grow. --- lib/home/home.dart | 137 ++++++++++++++++++++------------------ lib/home/home_groups.dart | 37 +++++----- 2 files changed, 91 insertions(+), 83 deletions(-) diff --git a/lib/home/home.dart b/lib/home/home.dart index d20afa0..8faaa24 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -374,71 +374,76 @@ class _HomeState extends State with SingleTickerProviderStateMixin { ), ]; }, - body: TabBarView( - controller: _controller, - children: [ - NestedScrollViewInnerScrollPositionKeyWidget( - Key('tab0'), - DescribedFeatureOverlay( - featureId: podcastFeature, - tapTarget: Text(s.featureDiscoveryEpisode, - textAlign: TextAlign.center), - backgroundColor: Colors.cyan[500], - enablePulsingAnimation: false, - onDismiss: () => Future.value(true), - title: - Text(s.featureDiscoveryEpisodeTitle), - description: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text(s.featureDiscoveryEpisodeDes), - Row( - children: [ - FlatButton( - color: Colors.cyan[600], - padding: - const EdgeInsets.all(0), - child: Text(s.understood, - style: Theme.of(context) - .textTheme - .button - .copyWith( - color: - Colors.white)), - onPressed: () async => - FeatureDiscovery - .completeCurrentStep( - context), - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 5)), - FlatButton( - color: Colors.cyan[600], - padding: - const EdgeInsets.all(0), - child: Text(s.dismiss, - style: Theme.of(context) - .textTheme - .button - .copyWith( - color: - Colors.white)), - onPressed: () => - FeatureDiscovery.dismissAll( - context), - ), - ], - ), - ], - ), - child: _RecentUpdate())), - NestedScrollViewInnerScrollPositionKeyWidget( - Key('tab1'), _MyFavorite()), - NestedScrollViewInnerScrollPositionKeyWidget( - Key('tab2'), _MyDownload()), - ], + body: ScrollConfiguration( + behavior: NoGrowBehavior(), + child: TabBarView( + controller: _controller, + children: [ + NestedScrollViewInnerScrollPositionKeyWidget( + Key('tab0'), + DescribedFeatureOverlay( + featureId: podcastFeature, + tapTarget: Text( + s.featureDiscoveryEpisode, + textAlign: TextAlign.center), + backgroundColor: Colors.cyan[500], + enablePulsingAnimation: false, + onDismiss: () => Future.value(true), + title: Text( + s.featureDiscoveryEpisodeTitle), + description: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text(s.featureDiscoveryEpisodeDes), + Row( + children: [ + FlatButton( + color: Colors.cyan[600], + padding: + const EdgeInsets.all(0), + child: Text(s.understood, + style: Theme.of(context) + .textTheme + .button + .copyWith( + color: Colors + .white)), + onPressed: () async => + FeatureDiscovery + .completeCurrentStep( + context), + ), + Padding( + padding: + EdgeInsets.symmetric( + horizontal: 5)), + FlatButton( + color: Colors.cyan[600], + padding: + const EdgeInsets.all(0), + child: Text(s.dismiss, + style: Theme.of(context) + .textTheme + .button + .copyWith( + color: Colors + .white)), + onPressed: () => + FeatureDiscovery + .dismissAll(context), + ), + ], + ), + ], + ), + child: _RecentUpdate())), + NestedScrollViewInnerScrollPositionKeyWidget( + Key('tab1'), _MyFavorite()), + NestedScrollViewInnerScrollPositionKeyWidget( + Key('tab2'), _MyDownload()), + ], + ), ), ), ), @@ -474,7 +479,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { BuildContext context, double shrinkOffset, bool overlapsContent) { final s = context.s; return Container( - color: Theme.of(context).scaffoldBackgroundColor, + color: context.scaffoldBackgroundColor, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/home/home_groups.dart b/lib/home/home_groups.dart index 283767f..a707e5c 100644 --- a/lib/home/home_groups.dart +++ b/lib/home/home_groups.dart @@ -378,23 +378,26 @@ class _ScrollPodcastsState extends State { decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, ), - child: TabBarView( - children: groups[_groupIndex] - .podcasts - .map((podcastLocal) { - return Container( - decoration: BoxDecoration( - color: Theme.of(context).brightness == - Brightness.light - ? Theme.of(context).primaryColor - : Colors.black12), - margin: EdgeInsets.symmetric(horizontal: 5.0), - key: ObjectKey(podcastLocal.title), - child: PodcastPreview( - podcastLocal: podcastLocal, - ), - ); - }).toList(), + child: ScrollConfiguration( + behavior: NoGrowBehavior(), + child: TabBarView( + children: groups[_groupIndex] + .podcasts + .map((podcastLocal) { + return Container( + decoration: BoxDecoration( + color: Theme.of(context).brightness == + Brightness.light + ? Theme.of(context).primaryColor + : Colors.black12), + margin: EdgeInsets.symmetric(horizontal: 5.0), + key: ObjectKey(podcastLocal.title), + child: PodcastPreview( + podcastLocal: podcastLocal, + ), + ); + }).toList(), + ), ), ), ],