Thursday, August 11, 2022
HomeiOS Developmentandroid - Implementing snapConfiguration to SliverPersistentHeader

android – Implementing snapConfiguration to SliverPersistentHeader


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();
      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),
      double get maxExtent => kToolbarHeight;
      double get minExtent => 0;
      bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
        return true;
      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.



Most Popular

Recent Comments