From aaf309c2de34f2381a9b48ad404c89bc7d43780d Mon Sep 17 00:00:00 2001 From: Kevin Worth Date: Mon, 11 May 2020 23:16:20 -0400 Subject: [PATCH] Get rid of extra FutureBuilder widgets Now that the ListView is working correctly, we can get rid of these two FutureBuilders which were essentially intermediate steps to get to this point. --- flutterempires/lib/main.dart | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/flutterempires/lib/main.dart b/flutterempires/lib/main.dart index 89867ec..64d8bf0 100644 --- a/flutterempires/lib/main.dart +++ b/flutterempires/lib/main.dart @@ -110,32 +110,8 @@ class _MyHomePageState extends State { ), ), Spacer(flex: 1), - FutureBuilder( - future: futurePlayer, - builder: (context, snapshot) { - if (snapshot.hasData) { - return Text(snapshot.data.name); - } else if (snapshot.hasError) { - return Text("${snapshot.error}"); - } - return CircularProgressIndicator(); - }, - ), - Spacer(flex: 1), - FutureBuilder>( - future: allPlayers, - builder: (context, snapshot) { - if (snapshot.hasData) { - return Text(snapshot.data.length.toString()); - } else if (snapshot.hasError) { - return Text("${snapshot.error}"); - } - // By default, show a loading spinner. - return CircularProgressIndicator(); - }, - ), Expanded( - flex: 10, + flex: 20, child: FutureBuilder>( future: allPlayers, builder: (context, snapshot) { -- 2.43.0