Implemented Send and Delete

Floating Action Button + Semi floating action button
This commit is contained in:
Jonas Braus
2024-11-21 16:07:16 +01:00
parent 5dd69624b2
commit 488abbbb53
+84 -33
View File
@@ -51,7 +51,6 @@ class MyHome extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(
@@ -63,7 +62,8 @@ class MyHome extends StatelessWidget {
// Aktion für diesen Button
},
),
title: Consumer<PageProvider>( // Consumer verwenden, um den dynamischen Titel anzuzeigen
title: Consumer<PageProvider>(
// Consumer verwenden, um den dynamischen Titel anzuzeigen
builder: (context, pageProvider, child) {
return Container(
height: 40,
@@ -73,7 +73,8 @@ class MyHome extends StatelessWidget {
),
alignment: Alignment.centerLeft,
child: Text(
pageProvider.titleString[pageProvider.selectedPage], // Hier wird der dynamische Titel angezeigt
pageProvider.titleString[pageProvider.selectedPage],
// Hier wird der dynamische Titel angezeigt
style: TextStyle(
color: Theme.of(context).colorScheme.onPrimary,
fontWeight: FontWeight.bold,
@@ -121,39 +122,89 @@ class MyHome extends StatelessWidget {
),
body: Consumer<PageProvider>(
builder: (context, pageProvider, child) {
return pageProvider.pages[pageProvider.selectedPage];
return Stack(
children: [
pageProvider.pages[pageProvider.selectedPage],
Positioned(
left: 10,
bottom: 10,
child: IconButton.filled(
padding: const EdgeInsets.all(15),
onPressed: () {},
icon: const Icon(
Icons.delete,
size: 30,
),
style: ButtonStyle(
shape: WidgetStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(17))),
backgroundColor: WidgetStateProperty.all(
Theme.of(context).colorScheme.primary,
)),
),
)
],
);
},
),
bottomNavigationBar: Padding(
padding: EdgeInsets.all(5),
child: GNav(
onTabChange: (index) {
Provider.of<PageProvider>(context, listen: false).changePage(index);
},
gap: 8,
style: GnavStyle.google,
backgroundColor: Theme.of(context).colorScheme.surface,
color: Theme.of(context).colorScheme.onSurface,
activeColor: Theme.of(context).colorScheme.onPrimary,
tabBackgroundColor: Theme.of(context).colorScheme.primary,
tabs: const [
GButton(
icon: Icons.fastfood_outlined,
text: "Essen",
),GButton(
icon: Icons.landscape,
text: "Ambiente",
),GButton(
icon: Icons.mood,
text: "Service",
),GButton(
icon: Icons.feedback,
text: "Anmerkungen",
), GButton(
icon: Icons.grass,
text: "Spezielle Ernährung",
floatingActionButton: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"* Pflichtfeld",
style: TextStyle(fontSize: 15),
),
const SizedBox(
height: 10,
),
FloatingActionButton.extended(
onPressed: () {},
label: const Text(
"Absenden",
style: TextStyle(fontSize: 20),
),
],
icon: const Icon(Icons.send),
)
],
),
bottomNavigationBar: Container(
color: Theme.of(context).colorScheme.secondary,
child: Padding(
padding: const EdgeInsets.all(5),
child: GNav(
onTabChange: (index) {
Provider.of<PageProvider>(context, listen: false)
.changePage(index);
},
gap: 8,
style: GnavStyle.google,
backgroundColor: Colors.transparent,
color: Theme.of(context).colorScheme.onSurface,
activeColor: Theme.of(context).colorScheme.onPrimary,
tabBackgroundColor: Theme.of(context).colorScheme.primary,
tabs: const [
GButton(
icon: Icons.fastfood_outlined,
text: "Essen",
),
GButton(
icon: Icons.landscape,
text: "Ambiente",
),
GButton(
icon: Icons.mood,
text: "Service",
),
GButton(
icon: Icons.feedback,
text: "Anmerkungen",
),
GButton(
icon: Icons.grass,
text: "Spezielle Ernährung",
),
],
),
),
),
);