From 000f141b5ab70c365b17844654434e9dc3901742 Mon Sep 17 00:00:00 2001 From: esche Date: Sun, 25 Jun 2023 19:10:29 +0200 Subject: [PATCH] prototype for shopping tab --- Frontend-user/lib/basket.dart | 4 ++-- Frontend-user/lib/finance.dart | 3 +-- Frontend-user/lib/main.dart | 20 +++++------------ Frontend-user/lib/shopping.dart | 39 +++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 Frontend-user/lib/shopping.dart diff --git a/Frontend-user/lib/basket.dart b/Frontend-user/lib/basket.dart index 28e3088..1d2dbf2 100644 --- a/Frontend-user/lib/basket.dart +++ b/Frontend-user/lib/basket.dart @@ -4,7 +4,7 @@ import 'sample_data.dart'; /* todo: - individuelle Icons je nach Kategorie - - Gesamtpreis + - editing */ class ShowBasket extends StatelessWidget { @@ -84,7 +84,7 @@ class ShowBasket extends StatelessWidget { Widget getLeading(Category category) { switch (category) { case Category.obstUndGemuese: - return const Text("🍅"); + return const Text("🍒"); case Category.brotCerealienUndAufstriche: return const Text( '🍞', diff --git a/Frontend-user/lib/finance.dart b/Frontend-user/lib/finance.dart index 33d1f41..1dfd93f 100644 --- a/Frontend-user/lib/finance.dart +++ b/Frontend-user/lib/finance.dart @@ -7,11 +7,10 @@ import 'sample_data.dart'; /* todo: - Einkauf und Settings - - Warenkorb - farbliche Hervorhebungen - semanticLabels, Screenreader - monatliche Aufladung: ausstehende Beträge - - Icons: maybe flutter awesome + - Error-Management (throw) */ class Finance extends StatelessWidget { diff --git a/Frontend-user/lib/main.dart b/Frontend-user/lib/main.dart index 5c7fee8..91f94ad 100644 --- a/Frontend-user/lib/main.dart +++ b/Frontend-user/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:mitgliederladen/shopping.dart'; import 'finance.dart'; void main() { @@ -17,17 +18,19 @@ class MyApp extends StatelessWidget { //darkgreen:5f7c61, mediumgreen: 66906a, lightgreen: 9cbe96, yellow: f5de64 useMaterial3: true, brightness: Brightness.light, + textTheme: Typography.englishLike2021, colorScheme: ColorScheme.fromSeed( brightness: Brightness.light, seedColor: const Color(0xff5f7c61))), darkTheme: ThemeData( useMaterial3: true, brightness: Brightness.dark, + textTheme: Typography.englishLike2021, colorScheme: ColorScheme.fromSeed( brightness: Brightness.dark, seedColor: const Color(0xff5f7c61), )), - themeMode: ThemeMode.system, + themeMode: ThemeMode.dark, home: const MyHomePage(), ); } @@ -76,20 +79,7 @@ class _MyHomePageState extends State { ], ), body: [ - Scaffold( - floatingActionButton: FloatingActionButton( - child: const Icon(Icons.shopping_cart), - onPressed: () { - setState(() { - test++; - }); - }, - ), - body: Container( - color: Colors.green, - alignment: Alignment.center, - child: Text('Page $test'), - )), + Shopping(), const Finance(), ListView(children: const [ ListTile( diff --git a/Frontend-user/lib/shopping.dart b/Frontend-user/lib/shopping.dart new file mode 100644 index 0000000..1e0a6fb --- /dev/null +++ b/Frontend-user/lib/shopping.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; + +class Shopping extends StatelessWidget { + Shopping({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton( + child: const Icon(Icons.shopping_cart), + onPressed: () {}, + ), + body: GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2), + itemBuilder: ((context, index) { + return Card( + child: Column(children: [ + const Expanded( + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text( + '🍒', + style: TextStyle(fontSize: 400), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'Obst und Gemüse', + style: Theme.of(context).textTheme.labelLarge, + ), + ), + ]), + ); + }))); + } +}