mirror of
https://github.com/go-vikunja/app
synced 2025-03-27 22:18:59 +00:00
Add namespace
This commit is contained in:
parent
d40fdab947
commit
9acc0ff750
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user