X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=flutterempires%2Flib%2Fmain.dart;h=89867ec99bb629883d56040ca5defdd9d28a1d33;hp=a252d45ad6b209e8776a23eb7df1fba938bffe90;hb=8052a68188149faed5405180b20245d8b686b07a;hpb=bc56f91be6a4916db56d4562da84a39075871a22 diff --git a/flutterempires/lib/main.dart b/flutterempires/lib/main.dart index a252d45..89867ec 100644 --- a/flutterempires/lib/main.dart +++ b/flutterempires/lib/main.dart @@ -134,24 +134,31 @@ class _MyHomePageState extends State { return CircularProgressIndicator(); }, ), - Spacer(flex: 10), + Expanded( + flex: 10, + 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(); + }), + ) ], ), - 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(); - }), ), ), floatingActionButton: FloatingActionButton(