Skip to content

Instantly share code, notes, and snippets.

@kitoko552
Last active February 5, 2020 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitoko552/415c501939cac452884951a77b6963d9 to your computer and use it in GitHub Desktop.
Save kitoko552/415c501939cac452884951a77b6963d9 to your computer and use it in GitHub Desktop.
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