From 9acc0ff750059099c5f793af424b78e5bd14228c Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Sat, 15 Sep 2018 17:10:34 +0200 Subject: [PATCH] Add namespace --- lib/pages/home_page.dart | 48 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 064c837..f6e3409 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -28,7 +28,38 @@ class HomePageState extends State { } _addNamespace() { - + var textController = new TextEditingController(); + showDialog(context: context, child: new _SystemPadding( + child: new AlertDialog( + contentPadding: const EdgeInsets.all(4.0), + content: new Row( + children: [ + Expanded( + child: new TextField( + autofocus: true, + decoration: new InputDecoration( + labelText: 'Namespace', hintText: 'eg. Family Namespace' + ), + controller: textController, + ), + ) + ] + ), + actions: [ + 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 { 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); + } } \ No newline at end of file