Last active
February 5, 2020 07:02
-
-
Save kitoko552/415c501939cac452884951a77b6963d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _StickyTabBarDelegate extends SliverPersistentHeaderDelegate { | |
const _StickyTabBarDelegate(this.tabBar); | |
final TabBar tabBar; | |
@override | |
double get minExtent => tabBar.preferredSize.height; | |
@override | |
double get maxExtent => tabBar.preferredSize.height; | |
@override | |
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { | |
return Container(color: Colors.blue, child: tabBar); | |
} | |
@override | |
bool shouldRebuild(_StickyTabBarDelegate oldDelegate) { | |
return tabBar != oldDelegate.tabBar; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment