added legal state bar content

This commit is contained in:
2024-03-26 20:50:57 +01:00
parent a718e02827
commit 10b0c59c3f
7 changed files with 155 additions and 34 deletions

15
lib/view/appInfo.dart Normal file
View File

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class AppInfoView extends StatelessWidget {
const AppInfoView({super.key});
@override
Widget build(BuildContext context) {
return const AlertDialog(
title: Text("Achtung"),
content: Flexible(
child: Text("bla"),
),
);
}
}

View File

@ -1,9 +1,10 @@
import 'package:app/extensions/obtainProviderExtension.dart';
import 'package:app/state/mapState.dart';
import 'package:app/view/legalStatus.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});
@ -19,17 +20,33 @@ class _HomePageState extends State<HomeView> {
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text("Bubatzkarte"),
actions: [],
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: Consumer<MapState>(builder: (context, value, child) => Icon(value.followLocation ? Icons.my_location : Icons.location_disabled)),
child: WatchState<MapState>((context, state) => Icon(state.followLocation ? Icons.my_location : Icons.location_disabled)),
onPressed: () => context.obtainState<MapState>().toggleLocationLock(),
),
body: const Column(
children: [
SizedBox(
height: 100,
child: LegalStatusView(),
child: StatusView(),
),
Expanded(
child: MapView(),

View File

@ -1,21 +0,0 @@
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();
},
);
}
}

View File

@ -1,15 +1,59 @@
import 'package:app/util/watchState.dart';
import 'package:flutter/material.dart';
class StatusView extends StatefulWidget {
import '../state/legalStatusState.dart';
class StatusView extends StatelessWidget {
const StatusView({super.key});
@override
State<StatusView> createState() => _StatusViewState();
}
class _StatusViewState extends State<StatusView> {
@override
Widget build(BuildContext context) {
return const Placeholder();
return WatchState<LegalStatusState>((context, state) {
return Container(
decoration: BoxDecoration(
color: state.info.color
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: Icon(
state.info.icon,
size: 40,
),
),
const VerticalDivider(
endIndent: 20,
indent: 20,
color: Colors.white,
thickness: 3,
width: 30,
),
Center(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
state.info.title,
style: const TextStyle(fontSize: 20),
),
Text(state.info.subtitle),
],
),
),
const SizedBox(width: 20),
IconButton(
icon: const Icon(Icons.info_outline),
onPressed: () {
},
)
],
)
);
});
}
}