Skip to content

Instantly share code, notes, and snippets.

@littleironical
Created December 30, 2020 16:48
Show Gist options
  • Save littleironical/5230f7120d0f91c25b3da9f939cf96cd to your computer and use it in GitHub Desktop.
Save littleironical/5230f7120d0f91c25b3da9f939cf96cd to your computer and use it in GitHub Desktop.
// Create "ScrollController"
final ScrollController scrollController = ScrollController();
// Add "scrollController" to "controller" property inside Scroll widget
controller: scrollController,
// Now implement scrolling function
void onTap(){
scrollController.animateTo(0, duration: Duration(seconds: 2), curve: Curves.easeInOut);
// 0 is the offset
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment