]> git.cworth.org Git - lmno.games/commitdiff
Clean up some leftover hello flutter code
authorKevin Worth <kworth082@gmail.com>
Fri, 8 May 2020 13:07:17 +0000 (09:07 -0400)
committerCarl Worth <cworth@cworth.org>
Sat, 23 May 2020 13:49:00 +0000 (06:49 -0700)
The hello flutter code has button which increments a number on the
screen and this has just been cluttering things up. This will likely be
a good place to put the logic we'll need for submitting the user's
name and character, so we won't get rid of it completely.

flutterempires/lib/main.dart

index 7d972a3a44b1655b0fa9f88aa02337da3cec226f..5a7981b19a1c0a76d6ea823c610ef894222658ef 100644 (file)
@@ -51,8 +51,6 @@ class MyHomePage extends StatefulWidget {
 }
 
 class _MyHomePageState extends State<MyHomePage> {
-  int _counter = 0;
-
   Future<Player> futurePlayer;
   Future<List<Player>> allPlayers;
 
@@ -63,14 +61,9 @@ class _MyHomePageState extends State<MyHomePage> {
     allPlayers = Player.fetchAllPlayers();
   }
 
-  void _incrementCounter() {
+  void onPressPlusButton() {
     setState(() {
-      // This call to setState tells the Flutter framework that something has
-      // changed in this State, which causes it to rerun the build method below
-      // so that the display can reflect the updated values. If we changed
-      // _counter without calling setState(), then the build method would not be
-      // called again, and so nothing would appear to happen.
-      _counter++;
+      // Probably use this to POST player name and character
     });
   }
 
@@ -90,7 +83,7 @@ class _MyHomePageState extends State<MyHomePage> {
       ),
       body: new Container(
         margin: const EdgeInsets.only(left: 20.0, right: 20.0),
-        child : Center(
+        child: Center(
           child: Column(
             mainAxisAlignment: MainAxisAlignment.center,
             crossAxisAlignment: CrossAxisAlignment.start,
@@ -146,7 +139,7 @@ class _MyHomePageState extends State<MyHomePage> {
         ),
       ),
       floatingActionButton: FloatingActionButton(
-        onPressed: _incrementCounter,
+        onPressed: onPressPlusButton,
         tooltip: 'Increment',
         child: Icon(Icons.add),
       ), // This trailing comma makes auto-formatting nicer for build methods.