Add namespace

This commit is contained in:
Jonas Franz 2018-09-15 17:10:34 +02:00
parent d40fdab947
commit 9acc0ff750
No known key found for this signature in database
GPG Key ID: C8287A01D593AC1D
1 changed files with 47 additions and 1 deletions

View File

@ -28,7 +28,38 @@ class HomePageState extends State<HomePage> {
}
_addNamespace() {
var textController = new TextEditingController();
showDialog(context: context, child: new _SystemPadding(
child: new AlertDialog(
contentPadding: const EdgeInsets.all(4.0),
content: new Row(
children: <Widget>[
Expanded(
child: new TextField(
autofocus: true,
decoration: new InputDecoration(
labelText: 'Namespace', hintText: 'eg. Family Namespace'
),
controller: textController,
),
)
]
),
actions: <Widget>[
new FlatButton(
child: const Text('CANCEL'),
onPressed: () => Navigator.pop(context),
),
new FlatButton(
child: const Text('ADD'),
onPressed: () {
namespaces.add(textController.text);
Navigator.pop(context);
},
)
],
),
));
}
@override
@ -74,4 +105,19 @@ class HomePageState extends State<HomePage> {
body: _getDrawerItemWidget(_selectedDrawerIndex),
);
}
}
class _SystemPadding extends StatelessWidget {
final Widget child;
_SystemPadding({Key key, this.child}) : super(key: key);
@override
Widget build(BuildContext context) {
var mediaQuery = MediaQuery.of(context);
return new AnimatedContainer(
padding: mediaQuery.viewInsets,
duration: const Duration(milliseconds: 300),
child: child);
}
}