From c203581c8ba1b7444e03ad42db72531da3522b63 Mon Sep 17 00:00:00 2001 From: Hugo Bayer Date: Wed, 29 Jan 2020 11:07:46 +0100 Subject: [PATCH] Merge branch 'master' of D:\Programmieren\AndroidProjects\server-pinger with conflicts. --- lib/serverlist.dart | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/lib/serverlist.dart b/lib/serverlist.dart index 3a4ec32..035a7d0 100644 --- a/lib/serverlist.dart +++ b/lib/serverlist.dart @@ -199,6 +199,69 @@ class _ServerListState extends State { }); } + void _modifyServerForm(Server server){ + TextEditingController servername = TextEditingController(text: server.displayName); + TextEditingController uri = TextEditingController(text: server.uri); + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Adding a server'), + content: SingleChildScrollView( + child: Form( + key: _formKey, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextFormField( + decoration: InputDecoration( + labelText: 'Custom Name', + ), + controller: servername, + ), + TextFormField( + controller: uri, + decoration: InputDecoration( + labelText: 'URI', + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row(children: [ + Expanded( + child: RaisedButton( + child: Text("Confirm"), + onPressed: () { + if (_formKey.currentState.validate()) { + _formKey.currentState.save(); + Navigator.of(context).pop(); + } + }, + ), + ), + RaisedButton( + child: Text("Confirm"), + onPressed: () { + if (_formKey.currentState.validate()) { + _formKey.currentState.save(); + setState(() { + server.displayName=servername.text; + server.uri = uri.text; + }); + Navigator.of(context).pop(); + } + }, + ) + ]), + ) + ], + ), + ), + ), + ); + }, + ); + } List _createChildren() { List list = new List.generate(servers.length, (int index) { Widget info = Row(children: [ -- 2.47.0