Last active
May 30, 2021 09:48
-
-
Save denniske/d00cd0ffa44b1d7a14fccaece96a1fbc to your computer and use it in GitHub Desktop.
Flutter Modal bottom sheet will not overlap keyboard (Fixed)
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
import 'package:flutter/material.dart'; | |
class CustomPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container(), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () { | |
showModalBottomSheet( | |
isScrollControlled: true, // Important: Makes content maxHeight = full device height | |
context: context, | |
builder: (context) { | |
// Does not work | |
return AnimatedPadding( | |
padding: MediaQuery.of(context).viewInsets, | |
duration: const Duration(milliseconds: 100), | |
curve: Curves.decelerate, | |
child: Container( | |
child: Wrap( | |
children: [ | |
TextField( | |
decoration: InputDecoration(labelText: "1"), | |
), | |
TextField( | |
decoration: InputDecoration(labelText: "2"), | |
), | |
TextField( | |
decoration: InputDecoration(labelText: "3"), | |
), | |
], | |
))); | |
}, | |
); | |
}, | |
), | |
); | |
} | |
} | |
void main() { | |
runApp(MaterialApp(home: CustomPage())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
worked thanks :-)