X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=flutterempires%2Flib%2Fmain.dart;h=64d8bf057591cad6e02f85b9c21844bef19e0eb3;hp=c92508bebecda377b6791f2f163cb0fad09d7f57;hb=b9c184f2a7fd491e736c32b02baa38b18f906eb9;hpb=5dc18c0cd3f7852b9185260a2bffa7f23125f0c4 diff --git a/flutterempires/lib/main.dart b/flutterempires/lib/main.dart index c92508b..64d8bf0 100644 --- a/flutterempires/lib/main.dart +++ b/flutterempires/lib/main.dart @@ -85,21 +85,56 @@ class _MyHomePageState extends State { body: new Container( margin: const EdgeInsets.only(left: 20.0, right: 20.0), child: Center( - child: FutureBuilder>( - future: allPlayers, - builder: (context, snapshot) { - if (snapshot.hasData) { - return ListView.builder( - itemCount: snapshot.data.length, - itemBuilder: (context, index) { - return ListTile( - title: Text(snapshot.data[index].name.toString())); - }); - } else if (snapshot.hasError) { - return Text("${snapshot.error}"); - } - return CircularProgressIndicator(); - }), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Spacer(flex: 1), + Text( + 'Name:', + style: Theme.of(context).textTheme.headline4, + ), + TextField( + decoration: InputDecoration( + hintText: 'Enter your (real) name', + ), + ), + Spacer(flex: 1), + Text( + 'Character:', + style: Theme.of(context).textTheme.headline4, + ), + TextField( + decoration: InputDecoration( + hintText: 'Enter your empire character name', + ), + ), + Spacer(flex: 1), + Expanded( + flex: 20, + child: FutureBuilder>( + future: allPlayers, + builder: (context, snapshot) { + if (snapshot.hasData) { + if (snapshot.data.length == 0) { + return Text('No players yet'); + } else { + return ListView.builder( + itemCount: snapshot.data.length, + itemBuilder: (context, index) { + return ListTile( + title: Text( + snapshot.data[index].name.toString())); + }); + } + } else if (snapshot.hasError) { + return Text("${snapshot.error}"); + } + return CircularProgressIndicator(); + }), + ) + ], + ), ), ), floatingActionButton: FloatingActionButton(