Search
 
SCRIPT & CODE EXAMPLE
 

DART

scrolling to top sliverlist flutter with back button

// first add a scroll controller var
  final ScrollController _scrollController = ScrollController(
    initialScrollOffset: 0.0,
  );
  
// after add the code to set offset of controller at WillPopScope
return WillPopScope( onWillPop: () async {
      if (_scrollController.offset != 0.0) {
        _scrollController.animateTo(0.0,
            duration: const Duration(milliseconds: 250), curve: Curves.easeIn);
        return false;
      }else {
        return true;
      }
    },
   child: Scaffold( //...
   
// and finally set var controller to controller of your scroller like this:
CustomScrollView( controller: _scrollController, //...
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter sizedbo 
Dart :: dart set union 
Dart :: flutter sidebox 
Dart :: flutter longpress vibration 
Dart :: flutter check variable has object 
Dart :: Get Prime Number in dart 
Dart :: flutter compare two list 
Dart :: return type of a function 
Dart :: automatic keepalive flutter tabs 
Dart :: how to remove listtile long pressflutter 
Dart :: string to int in flutter 
Dart :: factory in dart 
Swift :: firebase crashlytics dsym missing 
Swift :: navigationview hide header swiftui 
Swift :: swift convert dictionary to json 
Swift :: add buton border swift 
Swift :: remove back button from navigation bar swift 
Swift :: textfield style swiftui own 
Swift :: swiftui button transparent background 
Swift :: save codable in userdefaults ios swift 
Swift :: how to get current shown collectionview cell index in swift 
Swift :: pop last element array swift 
Swift :: and in swift1 
Swift :: get day difference between two dates swift 
Swift :: string value of enum swift 
Swift :: change placeholder color swift 
Swift :: swift pretty print json 
Swift :: convert uiimage to swiftui image 
Swift :: swift string 
Swift :: swift guard statement 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =