diff --git a/flutter_hbb/lib/home_page.dart b/flutter_hbb/lib/home_page.dart index 7edb4add1..cef284e8e 100644 --- a/flutter_hbb/lib/home_page.dart +++ b/flutter_hbb/lib/home_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:tuple/tuple.dart'; import 'common.dart'; import 'model.dart'; import 'remote_page.dart'; @@ -24,6 +25,27 @@ class _HomePageState extends State { return Scaffold( backgroundColor: MyTheme.grayBg, appBar: AppBar( + centerTitle: true, + actions: [ + IconButton( + icon: Icon(Icons.more_vert), + onPressed: () { + () async { + var value = await showMenu( + context: context, + position: RelativeRect.fromLTRB(3000, 70, 3000, 70), + items: [ + PopupMenuItem( + child: Text('ID/Relay Server'), value: 'server'), + ], + elevation: 8, + ); + if (value == 'server') { + showServer(context); + } + }(); + }) + ], title: Text(widget.title), ), body: SingleChildScrollView( @@ -186,3 +208,41 @@ class _HomePageState extends State { return Wrap(children: cards); } } + +void showServer(BuildContext context) { + showAlertDialog( + context, + (setState) => Tuple3( + Text('ID/Relay Server'), + Column(mainAxisSize: MainAxisSize.min, children: [ + TextFormField( + decoration: InputDecoration( + labelText: 'ID Server', + ), + ), + TextFormField( + decoration: InputDecoration( + labelText: 'Relay Server', + ), + ), + ]), + [ + FlatButton( + textColor: MyTheme.accent, + onPressed: () { + Navigator.pop(context); + }, + child: Text('Cancel'), + ), + FlatButton( + textColor: MyTheme.accent, + onPressed: () { + Navigator.pop(context); + }, + child: Text('OK'), + ), + ], + ), + () async => true, + true); +}