@@ -31,7 +31,7 @@ class _MapScreenState extends State<MapScreen> with TickerProviderStateMixin {
31
31
@override
32
32
Widget build (BuildContext context) {
33
33
return ChangeNotifierProvider (
34
- create: (_) => MapViewModel ()..initialize (),
34
+ create: (_) => MapViewModel ()..initialize (context, this ),
35
35
child: Consumer2 <MapProvider , TrackingProvider >(
36
36
builder: (context, mapProvider, trackingProvider, _) {
37
37
return Consumer <MapViewModel >(
@@ -110,7 +110,7 @@ class _MapScreenState extends State<MapScreen> with TickerProviderStateMixin {
110
110
_routeWaySwitcher (context),
111
111
112
112
// Update location button
113
- _updateLocationButton (context),
113
+ _updateLocationButtons (context),
114
114
115
115
if (mapProvider.loadingProgress < 1 )
116
116
_loadingOverlay (context, mapProvider)
@@ -121,7 +121,7 @@ class _MapScreenState extends State<MapScreen> with TickerProviderStateMixin {
121
121
);
122
122
}
123
123
124
- Widget _updateLocationButton (BuildContext context) {
124
+ Widget _updateLocationButtons (BuildContext context) {
125
125
final mapProvider = Provider .of <MapProvider >(context, listen: false );
126
126
final trackingProvider =
127
127
Provider .of <TrackingProvider >(context, listen: false );
@@ -132,16 +132,19 @@ class _MapScreenState extends State<MapScreen> with TickerProviderStateMixin {
132
132
padding: const EdgeInsets .all (16.0 ),
133
133
child: Row (
134
134
mainAxisSize: MainAxisSize .min,
135
+ spacing: 10 ,
135
136
children: [
136
137
if (trackingProvider.currentLocation != null )
138
+ // Move to Bus
137
139
FloatingActionButton (
138
140
mini: true ,
139
141
onPressed: () {
140
142
mapProvider.updateLocation (
141
143
trackingProvider.currentLocation! , 16 );
142
144
},
143
145
child: const Icon (Icons .directions_bus)),
144
- const SizedBox (width: 10 ),
146
+
147
+ // Move to Current Location
145
148
FloatingActionButton (
146
149
onPressed: () async =>
147
150
mapProvider.moveToCurrentLocation (context),
0 commit comments