Scroll to a Specific Widget in Flutter
- Aarthi Krishnan
- Feb 4, 2024
- 1 min read

Hey guys, it's me, Aarthi Krishnan. In today's guide, I will show you how to scroll to specific widgets in the Flutter project.
When you design a long page in your app. scrolling to a specific widget will help your end user to use the app. Keeping a shortcut to scroll top will help your user engage in your app.
To make a scroll to a specific widget we have to give a key to that widget. By declaring the key to the widget we can call the key in onPressed so that we can easily navigate to the widget to another widget.
First, declare a variable in the global key like below:
var widgetone = GlobalKey();
var widgettwo = GlobalKey();
Full Code:
OutPut:
Thank you! for reading this. I hope this will help and save your time that's it guys, This is how we should create scroll to specific widget in flutter. Byee. Happy coding!
- Aarthi Krishnan❤️
コメント