Start Filter
First step of filters for the dashboard
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:mensaappbackend/modules/ratingCard.dart';
|
||||
import 'package:mensaappbackend/providers/pageProvider.dart';
|
||||
import 'package:mensaappbackend/providers/viewProvider.dart';
|
||||
import 'package:mensaappbackend/providers/timeProvider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
|
||||
@@ -32,18 +33,74 @@ class PageDashboard extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
title: Text(
|
||||
"Dashboard",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),
|
||||
title: Consumer<TimeProvider>(
|
||||
builder: (context, timeProvider, child) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
"Dashboard",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),
|
||||
),
|
||||
SizedBox(width: 32),
|
||||
Icon(Icons.watch_later, ),
|
||||
SizedBox(width: 8),
|
||||
SizedBox(
|
||||
width: 125,
|
||||
child: Center( // Add Center widget here
|
||||
child: DropdownButton(
|
||||
value: Provider.of<TimeProvider>(context, listen: false).selectedTime,
|
||||
dropdownColor: Theme.of(context).colorScheme.secondary,
|
||||
//style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),
|
||||
iconEnabledColor: Theme.of(context).colorScheme.onPrimary,
|
||||
focusColor: Colors.transparent,
|
||||
isDense: true,
|
||||
isExpanded: true,
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Center(
|
||||
child: Text("Heute", style: TextStyle(color: Theme.of(context).colorScheme.onSecondary)),
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Center(
|
||||
child: Text("Letzte 7 Tage"),
|
||||
),
|
||||
),
|
||||
],
|
||||
selectedItemBuilder: (BuildContext context) {
|
||||
return [
|
||||
Center(
|
||||
child: Text(
|
||||
"Heute",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary), // Benutzerdefinierte Farbe für angezeigten Text
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
"Letzte 7 Tage",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary), // Benutzerdefinierte Farbe für angezeigten Text
|
||||
)
|
||||
),
|
||||
];
|
||||
},
|
||||
onChanged: (value) {
|
||||
Provider.of<TimeProvider>(context, listen: false).setSelectedTime(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
var supabase = Supabase.instance.client;
|
||||
supabase.auth.signOut();
|
||||
Provider.of<PageProvider>(context, listen: false)
|
||||
.setSelectedPage(0);
|
||||
Provider.of<PageProvider>(context, listen: false).setSelectedPage(0);
|
||||
},
|
||||
label: Text(
|
||||
"Logout",
|
||||
@@ -53,9 +110,10 @@ class PageDashboard extends StatelessWidget {
|
||||
Icons.logout,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
body: FutureBuilder(
|
||||
future: viewDatabaseFunctions[Provider.of<ViewProvider>(context, listen: false).selectedView]!(),
|
||||
builder: (context, snapshot) {
|
||||
@@ -77,7 +135,7 @@ class PageDashboard extends StatelessWidget {
|
||||
FilledButton.icon(
|
||||
style: const ButtonStyle(padding: WidgetStatePropertyAll(EdgeInsets.symmetric(vertical: 20))),
|
||||
icon: const Icon(Icons.today),
|
||||
label: const Text("Alle - Heute"),
|
||||
label: const Text("Alle"),
|
||||
onPressed: () {
|
||||
Provider.of<ViewProvider>(context, listen: false).setSelectedView(0);
|
||||
Navigator.pop(context);
|
||||
@@ -87,7 +145,7 @@ class PageDashboard extends StatelessWidget {
|
||||
FilledButton.icon(
|
||||
style: const ButtonStyle(padding: WidgetStatePropertyAll(EdgeInsets.symmetric(vertical: 20))),
|
||||
icon: const Icon(Icons.today),
|
||||
label: const Text("Durchschnitt - Heute"),
|
||||
label: const Text("Durchschnitt"),
|
||||
onPressed: () {
|
||||
Provider.of<ViewProvider>(context, listen: false).setSelectedView(1);
|
||||
Navigator.pop(context);
|
||||
|
||||
Reference in New Issue
Block a user