From f343214df0b1b93e30a6fcf104014e59dc190e03 Mon Sep 17 00:00:00 2001 From: esche Date: Mon, 19 Jun 2023 16:25:10 +0200 Subject: [PATCH] extremely simplyfied code --- Frontend-user/lib/expand.dart | 2 ++ Frontend-user/lib/finance.dart | 36 ++++++++++++---------------------- Frontend-user/lib/main.dart | 2 +- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Frontend-user/lib/expand.dart b/Frontend-user/lib/expand.dart index b335d75..4a6255d 100644 --- a/Frontend-user/lib/expand.dart +++ b/Frontend-user/lib/expand.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +//this was used in a earlier version of the app and will possibly be removed in future versions. + class Expand extends StatefulWidget { final Widget child; final bool expand; diff --git a/Frontend-user/lib/finance.dart b/Frontend-user/lib/finance.dart index c4fe843..341df79 100644 --- a/Frontend-user/lib/finance.dart +++ b/Frontend-user/lib/finance.dart @@ -24,15 +24,8 @@ class Transaction { Transaction(this.art, this.betrag, this.datum, this.beschreibung); } -class Finance extends StatefulWidget { - const Finance({super.key}); - - @override - State createState() => _Finance(); -} - //sample data -class _Finance extends State { +class Finance extends StatelessWidget { final List transactions = [ Transaction(Art.monatlBeitrag, 0, now, ''), Transaction(Art.aufladung, 2042, now, ''), @@ -61,6 +54,8 @@ class _Finance extends State { 'Korrektur des Warenkorbs') ]; + Finance({super.key}); + @override Widget build(BuildContext context) { initializeDateFormatting('de_DE'); @@ -76,7 +71,6 @@ class _Finance extends State { children: [ Icon( Icons.euro, - //color: Colors.black, //semanticLabel: 'Text for screenreader', ), Column( @@ -106,8 +100,12 @@ class _Finance extends State { onTap: () { transactions[index].elevated = !transactions[index].elevated; - setState(() {}); - debugPrint('Card tapped'); + showBottomSheet( + context: context, + builder: (BuildContext context) { + return SizedBox.expand( + child: Text(transactions[index].beschreibung)); + }); }, child: Padding( padding: const EdgeInsets.all(8.0), @@ -119,19 +117,11 @@ class _Finance extends State { : Icons.money), Column( children: [ - Row( - children: [ - Text(DateFormat( - "EEEE, dd. MMMM yyyy HH:mm", 'de_DE') + Text( + DateFormat("EEEE, dd. MMMM yyyy HH:mm", 'de_DE') .format(now)), - Text( - '${transactions[index].art}: ${transactions[index].betrag / 100}€'), - ], - ), - if (transactions[index].beschreibung != '') - Expand( - expand: transactions[index].elevated, - child: Text(transactions[index].beschreibung)) + Text( + '${transactions[index].art}: ${transactions[index].betrag / 100}€') ], ), ], diff --git a/Frontend-user/lib/main.dart b/Frontend-user/lib/main.dart index cef3fe8..2c4fe0c 100644 --- a/Frontend-user/lib/main.dart +++ b/Frontend-user/lib/main.dart @@ -81,7 +81,7 @@ class _MyHomePageState extends State { alignment: Alignment.center, child: Text('Page $test'), ), - const Finance(), + Finance(), const Text( 'Hier könnten Einstellungen zu Darkmode mit shared_preferences und riverpod sein') ][currentPageIndex],