From ac5dcc8859aebfd2f36d4b6ac58f1bd2f82f4666 Mon Sep 17 00:00:00 2001 From: Mica White Date: Wed, 14 Jan 2026 20:36:39 -0500 Subject: Code cleanup --- lib/home.dart | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/home.dart') diff --git a/lib/home.dart b/lib/home.dart index f141d0b..fd2e278 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -30,6 +30,8 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { StreamSubscription? _positionStream; + // I was not able to get StreamBuilder or FutureBuilder to work correctly, + // so these are stored manually. bool _usesMetric = true; double _speed = 0.0; double _speedAccuracy = 0.0; @@ -72,6 +74,7 @@ class _HomePageState extends State { _initPositionStream(locationAccuracy); }); + // It takes time to load this data in, but I've only noticed it in debug mode RegionSettings.getUsesMetricSystem().then( (usesMetricSystem) => setState(() => _usesMetric = usesMetricSystem), ); @@ -88,6 +91,8 @@ class _HomePageState extends State { return Scaffold( appBar: AppBar( actions: [ + // This button is big enough and descriptive enough to be easily + // discoverable, but small enough to not get in the way. TextButton.icon( icon: Icon(Icons.settings), label: Text('Settings'), @@ -106,6 +111,7 @@ class _HomePageState extends State { (_usesMetric ? SpeedUnit.kilometersPerHour : SpeedUnit.milesPerHour); + return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, -- cgit v1.2.3