[ad_1]
I’m making an attempt to implement snap function to SliverPersistentHeader however could not determine it out and could not discover a good documentation on this.
My code:
class MyDelegate extends SliverPersistentHeaderDelegate {
double he;
MyDelegate ({required this.he}) : tremendous();
@override
Widget construct(BuildContext context, double shrinkOffset, bool overlapsContent) {
return AnimatedContainer(
little one: const Textual content('Title', textAlign: TextAlign.middle, type: TextStyle(fontSize: 24),),
coloration: Colours.inexperienced,
peak: he,
length: const Period(milliseconds: 100),
);
}
@override
double get maxExtent => kToolbarHeight;
@override
double get minExtent => 0;
@override
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
@override
FloatingHeaderSnapConfiguration get snapConfiguration => FloatingHeaderSnapConfiguration();
}
Floating is about to true.
I get error message for vsync being null.
I could not make it work. I need assistance on implementing snap function for SliverPersistenHeader.
[ad_2]