Merge branch 'delete_ratings' into 'main'

delete all kinda stuff

See merge request brausjonas/mensaapp!9
This commit is contained in:
Jonas Braus
2024-11-24 12:25:39 +00:00
11 changed files with 559 additions and 313 deletions
+45 -3
View File
@@ -63,6 +63,45 @@ class MyApp extends StatelessWidget {
class MyHome extends StatelessWidget { class MyHome extends StatelessWidget {
const MyHome({super.key}); const MyHome({super.key});
void _showDeleteDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
title: const Text("Bewertungen löschen"),
content: const Text("Möchtest du alle Eingaben entfernen?",
style: TextStyle(fontSize: 18),),
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text("Behalten"),
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.secondary
),
),
ElevatedButton(
onPressed: () {
Provider.of<AnmerkungProvider>(context, listen: false).resetAllFields();
Provider.of<EssenProvider>(context, listen: false).resetAllFields();
Provider.of<AmbienteProvider>(context, listen: false).resetAllFields();
Provider.of<ServiceProvider>(context, listen: false).resetAllFields();
Provider.of<SpezielleErnaehrungProvider>(context, listen: false).resetAllFields();
// Hier Aktion für Löschen ausführen
Navigator.of(context).pop(); // Dialog schließen
},
child: Text("Löschen"),
)
],
);
},
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -146,7 +185,9 @@ class MyHome extends StatelessWidget {
bottom: 10, bottom: 10,
child: IconButton.filled( child: IconButton.filled(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
onPressed: () {}, onPressed: () {
_showDeleteDialog(context); // Dialog anzeigen
},
icon: const Icon( icon: const Icon(
Icons.delete, Icons.delete,
size: 30, size: 30,
@@ -156,7 +197,8 @@ class MyHome extends StatelessWidget {
borderRadius: BorderRadius.circular(17))), borderRadius: BorderRadius.circular(17))),
backgroundColor: WidgetStateProperty.all( backgroundColor: WidgetStateProperty.all(
Theme.of(context).colorScheme.primary, Theme.of(context).colorScheme.primary,
)), ),
),
), ),
) )
], ],
@@ -204,7 +246,7 @@ class MyHome extends StatelessWidget {
text: "Essen", text: "Essen",
), ),
GButton( GButton(
icon: Icons.landscape, icon: Icons.chair, /* prev: landscape*/
text: "Ambiente", text: "Ambiente",
), ),
GButton( GButton(
+19 -2
View File
@@ -9,8 +9,10 @@ class PageAmbiente extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Scaffold(
child: Container( body: Stack(
children: [
Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/backgrounds/Ambiente.jpg"), image: AssetImage("assets/backgrounds/Ambiente.jpg"),
@@ -21,7 +23,19 @@ class PageAmbiente extends StatelessWidget {
), ),
) )
), ),
),
Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
bottomRight: Radius.circular(80)
)
),
width: 600, width: 600,
height: 400,
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -85,6 +99,9 @@ class PageAmbiente extends StatelessWidget {
], ],
), ),
), ),
)
],
),
); );
} }
} }
+20 -2
View File
@@ -9,8 +9,12 @@ class PageAnmerkungen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Scaffold(
child: Container( body: Stack(
children: [
Container(
width: 1600,
height: 800,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/backgrounds/Anmerkungen.jpg"), image: AssetImage("assets/backgrounds/Anmerkungen.jpg"),
@@ -21,6 +25,18 @@ class PageAnmerkungen extends StatelessWidget {
), ),
) )
), ),
),
Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
bottomRight: Radius.circular(80)
)
),
padding: EdgeInsets.symmetric(horizontal: 20),
height: 400,
width: 600, width: 600,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@@ -85,6 +101,8 @@ class PageAnmerkungen extends StatelessWidget {
], ],
), ),
), ),
)],
),
); );
} }
} }
+37 -10
View File
@@ -10,19 +10,37 @@ class PageEssen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Scaffold(
child: Container( body: Stack(
children: [
// Hintergrundbild
Container(
width: 1600,
height: 750,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/backgrounds/Essen.jpg"), image: AssetImage("assets/backgrounds/Essen.jpg"),
fit: BoxFit.cover, fit: BoxFit.cover, // Deckt den gesamten Bildschirm ab
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
Colors.white.withOpacity(0.2), Colors.white.withOpacity(0.2),
BlendMode.dstATop BlendMode.dstATop,
), ),
),
),
),
// Vordergrundinhalte
Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
bottomRight: Radius.circular(80)
) )
), ),
height: 400,
width: 600, width: 600,
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -36,9 +54,12 @@ class PageEssen extends StatelessWidget {
), ),
Consumer<EssenProvider>( Consumer<EssenProvider>(
builder: (context, essenProvider, child) { builder: (context, essenProvider, child) {
return RatingStars(onRate: (value) { return RatingStars(
onRate: (value) {
essenProvider.setRatingGeschmack(value); essenProvider.setRatingGeschmack(value);
}, initRating: essenProvider.ratingGeschmack,); },
initRating: essenProvider.ratingGeschmack,
);
}, },
) )
], ],
@@ -52,9 +73,12 @@ class PageEssen extends StatelessWidget {
), ),
Consumer<EssenProvider>( Consumer<EssenProvider>(
builder: (context, essenProvider, child) { builder: (context, essenProvider, child) {
return RatingStars(onRate: (value) { return RatingStars(
onRate: (value) {
essenProvider.setRatingQuali(value); essenProvider.setRatingQuali(value);
}, initRating: essenProvider.ratingQuali,); },
initRating: essenProvider.ratingQuali,
);
}, },
) )
], ],
@@ -76,16 +100,19 @@ class PageEssen extends StatelessWidget {
labelText: "Dein Feedback (optional)", labelText: "Dein Feedback (optional)",
labelStyle: const TextStyle(fontSize: 20), labelStyle: const TextStyle(fontSize: 20),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15) borderRadius: BorderRadius.circular(15),
), ),
), ),
style: TextStyle(fontSize: 20), style: TextStyle(fontSize: 20),
); );
}, },
) ),
], ],
), ),
), ),
),
],
),
); );
} }
} }
+21 -2
View File
@@ -9,8 +9,12 @@ class PageService extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Scaffold(
child: Container( body: Stack(
children: [
Container(
width: 1600,
height: 750,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/backgrounds/Service.jpg"), image: AssetImage("assets/backgrounds/Service.jpg"),
@@ -21,7 +25,19 @@ class PageService extends StatelessWidget {
), ),
) )
), ),
),
Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
bottomRight: Radius.circular(80)
)
),
width: 600, width: 600,
height: 400,
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -85,6 +101,9 @@ class PageService extends StatelessWidget {
], ],
), ),
), ),
)
],
),
); );
} }
} }
+90 -2
View File
@@ -11,8 +11,12 @@ class PageSpezielleErnaehrung extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Scaffold(
child: Container( body: Stack(
children: [
Container(
width: 1600,
height: 750,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/backgrounds/Speziell.jpg"), image: AssetImage("assets/backgrounds/Speziell.jpg"),
@@ -23,6 +27,90 @@ class PageSpezielleErnaehrung extends StatelessWidget {
), ),
) )
), ),
),
Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
bottomRight: Radius.circular(80)
)
),
width: 650,
height: 450,
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Vegan?*",
style: TextStyle(fontSize: 35),
),
Consumer<SpezielleErnaehrungProvider>(
builder: (context, spezielleErnaehrungProvider, child) {
return RatingStars(onRate: (value) {
spezielleErnaehrungProvider.setRatingSitzmoeglichkeit(value);
}, initRating: spezielleErnaehrungProvider.ratingSitzmoeglichkeit,);
},
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Keine Ahnung*",
style: TextStyle(fontSize: 35),
),
Consumer<SpezielleErnaehrungProvider>(
builder: (context, spezielleErnaehrungProvider, child) {
return RatingStars(onRate: (value) {
spezielleErnaehrungProvider.setRatingKeineAhnung(value);
}, initRating: spezielleErnaehrungProvider.ratingKeineAhnung,);
},
),
],
),
const SizedBox(
height: 50,
),
Consumer<SpezielleErnaehrungProvider>(
builder: (context, spezielleErnaehrungProvider, child) {
return TextFormField(
initialValue: spezielleErnaehrungProvider.freiText,
onChanged: (value) {
spezielleErnaehrungProvider.setFreiText(value);
},
autofocus: false,
maxLength: 500,
maxLines: 5,
decoration: InputDecoration(
labelText: "Dein Feedback (optional)",
labelStyle: const TextStyle(fontSize: 20),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15)
),
),
style: TextStyle(fontSize: 20),
);
},
)
],
),
),
)
],
),
);
Center(
child: Container(
width: 800, width: 800,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
+7
View File
@@ -19,4 +19,11 @@ class AmbienteProvider extends ChangeNotifier {
freiText = text; freiText = text;
notifyListeners(); notifyListeners();
} }
void resetAllFields(){
freiText = "";
ratingFrage1 = 0;
ratingFrage2 = 0;
notifyListeners();
}
} }
+7
View File
@@ -19,4 +19,11 @@ class AnmerkungProvider extends ChangeNotifier {
freiText = text; freiText = text;
notifyListeners(); notifyListeners();
} }
void resetAllFields(){
freiText = "";
ratingFrage1 = 0;
ratingFrage2 = 0;
notifyListeners();
}
} }
+7
View File
@@ -19,4 +19,11 @@ class EssenProvider extends ChangeNotifier {
freiText = text; freiText = text;
notifyListeners(); notifyListeners();
} }
void resetAllFields(){
freiText = "";
ratingGeschmack = 0;
ratingQuali = 0;
notifyListeners();
}
} }
+7
View File
@@ -19,4 +19,11 @@ class ServiceProvider extends ChangeNotifier {
freiText = text; freiText = text;
notifyListeners(); notifyListeners();
} }
void resetAllFields(){
freiText = "";
ratingFrage1 = 0;
ratingFrage2 = 0;
notifyListeners();
}
} }
@@ -20,4 +20,11 @@ class SpezielleErnaehrungProvider extends ChangeNotifier {
freiText = text; freiText = text;
notifyListeners(); notifyListeners();
} }
void resetAllFields(){
freiText = "";
ratingSitzmoeglichkeit = 0;
ratingKeineAhnung = 0;
notifyListeners();
}
} }