flutter_keyboard_aware_dialog 1.0.1 flutter_keyboard_aware_dialog: ^1.0.1 copied to clipboard
Dialog that moves up automaticly when soft keyboard shows. Contains three variants.
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_aware_dialog/flutter_keyboard_aware_dialog.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Demo',
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Keyboard Aware Dialog"),
),
body: Center(
child: RaisedButton(
child: Text("Show Dialog!"),
onPressed: () {
showDialog(
context: context,
builder: (context) => KeyboardAwareDialog(
// This line
child: Padding(
padding: const EdgeInsets.only(top: 16, left: 16, right: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Title",
style: Theme.of(context).textTheme.headline6,
),
TextField(),
ButtonBar(
children: <Widget>[
FlatButton(
child: Text("Nice!"),
onPressed: () => Navigator.pop(context),
),
],
),
],
),
),
),
);
},
),
),
);
}
}