Skip to content

Instantly share code, notes, and snippets.

@denniske
Last active May 30, 2021 09:48
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save denniske/d00cd0ffa44b1d7a14fccaece96a1fbc to your computer and use it in GitHub Desktop.
Save denniske/d00cd0ffa44b1d7a14fccaece96a1fbc to your computer and use it in GitHub Desktop.
Flutter Modal bottom sheet will not overlap keyboard (Fixed)
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()));
}
@jerem17
Copy link

jerem17 commented May 4, 2020

Work perfectly for me thx a lot

@KuoPingL-flutter
Copy link

Perfect. Thank you

@dukesteen
Copy link

Works perfectly, thanks :)

@sulfanoaf
Copy link

Works perfectly, thanks :)

@Dillie-O
Copy link

Works! Thank you for this!!!!

@iamprayush
Copy link

Works just as expected, thanks!

@naikdp7
Copy link

naikdp7 commented May 30, 2021

worked thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment