moved loading indicator to gps button
This commit is contained in:
parent
ef8c5e9039
commit
bffc603918
BIN
assets/background/banner.png
Normal file
BIN
assets/background/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
assets/background/tile.png
Normal file
BIN
assets/background/tile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
BIN
assets/splash/splash512.png
Normal file
BIN
assets/splash/splash512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -1,7 +1,6 @@
|
||||
import 'package:app/extensions/obtainProviderExtension.dart';
|
||||
import 'package:app/state/mapState.dart';
|
||||
import 'package:app/state/timeStatusState.dart';
|
||||
import 'package:app/util/loadingContainer.dart';
|
||||
import 'package:app/util/watchState.dart';
|
||||
import 'package:app/view/appInfo.dart';
|
||||
import 'package:app/view/locationSearch.dart';
|
||||
@ -10,7 +9,6 @@ import 'package:app/view/map.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class HomeView extends StatefulWidget {
|
||||
const HomeView({super.key});
|
||||
@ -91,13 +89,17 @@ class _HomePageState extends State<HomeView> {
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: WatchState<MapState>((context, state) => Icon(
|
||||
locationEnabled
|
||||
? state.isCurrentlyLoading
|
||||
? Icons.location_searching
|
||||
: Icons.my_location
|
||||
: Icons.location_disabled
|
||||
)),
|
||||
child: WatchState<MapState>((context, state) {
|
||||
if(locationEnabled) {
|
||||
if(state.isCurrentlyLoading) {
|
||||
return const Padding(padding: EdgeInsets.all(15), child: CircularProgressIndicator(strokeWidth: 3));
|
||||
} else {
|
||||
return const Icon(Icons.my_location);
|
||||
}
|
||||
}
|
||||
|
||||
return const Icon(Icons.location_disabled);
|
||||
}),
|
||||
onPressed: () async {
|
||||
MapState mapState = context.obtainState<MapState>();
|
||||
mapState.setLoading(true);
|
||||
@ -118,17 +120,8 @@ class _HomePageState extends State<HomeView> {
|
||||
child: StatusView(),
|
||||
);
|
||||
}),
|
||||
Expanded(
|
||||
child: Consumer<MapState>(
|
||||
builder: (context, state, child) {
|
||||
return LoadingContainer(
|
||||
loading: child == null,
|
||||
fetching: state.isCurrentlyLoading,
|
||||
child: const MapView(),
|
||||
);
|
||||
},
|
||||
child: const MapView(),
|
||||
),
|
||||
const Expanded(
|
||||
child: MapView(),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user