Last active
March 9, 2022 18:29
-
-
Save aykuttasil/e07a5e652deaa360bf7f4bda5421377e to your computer and use it in GitHub Desktop.
Flutter bottom sheet dialog is placed above to keyboard
This file contains 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
To have the AddTaskScreen sit just above the keyboard, you can wrap it inside a SingleChildScrollView, which determines the padding at the bottom using a MediaQuery. |
This file contains 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
onPressed: () { | |
showModalBottomSheet( | |
context: context, | |
isScrollControlled: true, | |
builder: (context) => SingleChildScrollView( | |
child:Container( | |
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), | |
child: AddTaskScreen(), | |
) | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment