import 'package:app/extensions/obtainProviderExtension.dart'; import 'package:app/state/mapState.dart'; import 'package:app/util/loadingContainer.dart'; import 'package:app/util/watchState.dart'; import 'package:app/view/appInfo.dart'; import 'package:app/view/status.dart'; import 'package:app/view/map.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class HomeView extends StatefulWidget { const HomeView({super.key}); @override State createState() => _HomePageState(); } class _HomePageState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: const Text("Bubatzkarte"), actions: [ IconButton( icon: const Icon(Icons.search), onPressed: () { }, ), IconButton( icon: const Icon(Icons.info_outline), onPressed: () { showDialog( context: context, builder: (context) => const AppInfoView(), ); }, ), ], ), floatingActionButton: FloatingActionButton( child: WatchState((context, state) => Icon(state.followLocation ? Icons.my_location : Icons.location_disabled)), onPressed: () => context.obtainState().toggleLocationLock(), ), body: Column( children: [ const SizedBox( height: 100, child: StatusView(), ), Expanded( child: Consumer( builder: (context, state, child) { return LoadingContainer( loading: child == null, fetching: state.isCurrentlyFetching, child: const MapView(), ); }, child: const MapView(), ), ) ], ), ); } }