basic state management
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
import 'package:app/extensions/obtainProviderExtension.dart';
|
||||
import 'package:app/state/mapState.dart';
|
||||
import 'package:app/view/legalStatus.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});
|
||||
@ -18,12 +22,20 @@ class _HomePageState extends State<HomeView> {
|
||||
actions: [],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.my_location),
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
child: Consumer<MapState>(builder: (context, value, child) => Icon(value.followLocation ? Icons.my_location : Icons.location_disabled)),
|
||||
onPressed: () => context.obtainState<MapState>().toggleLocationLock(),
|
||||
),
|
||||
body: const Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100,
|
||||
child: LegalStatusView(),
|
||||
),
|
||||
Expanded(
|
||||
child: MapView(),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: MapView(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
21
lib/view/legalStatus.dart
Normal file
21
lib/view/legalStatus.dart
Normal file
@ -0,0 +1,21 @@
|
||||
import 'package:app/state/legalStatusState.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LegalStatusView extends StatefulWidget {
|
||||
const LegalStatusView({super.key});
|
||||
|
||||
@override
|
||||
State<LegalStatusView> createState() => _LegalStatusViewState();
|
||||
}
|
||||
|
||||
class _LegalStatusViewState extends State<LegalStatusView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<LegalStatusState>(
|
||||
builder: (context, value, child) {
|
||||
return Placeholder();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
15
lib/view/status.dart
Normal file
15
lib/view/status.dart
Normal file
@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StatusView extends StatefulWidget {
|
||||
const StatusView({super.key});
|
||||
|
||||
@override
|
||||
State<StatusView> createState() => _StatusViewState();
|
||||
}
|
||||
|
||||
class _StatusViewState extends State<StatusView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user