Last active
February 16, 2021 19:15
-
-
Save Hesamedin/33a4948675540d0b144a7f19db73da63 to your computer and use it in GitHub Desktop.
Please refer to my article to know what this code does. https://hesam-kamalan.medium.com/how-to-prevent-the-keyboard-pushes-a-widget-up-on-flutter-873569449927
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scaffold( | |
appBar: AppBar(...), | |
body: WillPopScope( | |
onWillPop: onBackClick, | |
child: CustomScrollView( | |
slivers: <Widget>[ | |
SliverToBoxAdapter( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
... | |
], | |
), | |
), | |
SliverFillRemaining( | |
hasScrollBody: false, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Expanded(child: Container()), | |
ElevatedButton( | |
onPressed: () { | |
FocusScope.of(context).unfocus(); // Remove Keyboard | |
// Validate Form | |
// Submit the form | |
}, | |
child: Text("Submit"), | |
), | |
], | |
), | |
), | |
], | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment