extremely simplyfied code

This commit is contained in:
esche 2023-06-19 16:25:10 +02:00
parent 99282eb9da
commit f343214df0
3 changed files with 16 additions and 24 deletions

View file

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; 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 { class Expand extends StatefulWidget {
final Widget child; final Widget child;
final bool expand; final bool expand;

View file

@ -24,15 +24,8 @@ class Transaction {
Transaction(this.art, this.betrag, this.datum, this.beschreibung); Transaction(this.art, this.betrag, this.datum, this.beschreibung);
} }
class Finance extends StatefulWidget {
const Finance({super.key});
@override
State<Finance> createState() => _Finance();
}
//sample data //sample data
class _Finance extends State<Finance> { class Finance extends StatelessWidget {
final List<Transaction> transactions = [ final List<Transaction> transactions = [
Transaction(Art.monatlBeitrag, 0, now, ''), Transaction(Art.monatlBeitrag, 0, now, ''),
Transaction(Art.aufladung, 2042, now, ''), Transaction(Art.aufladung, 2042, now, ''),
@ -61,6 +54,8 @@ class _Finance extends State<Finance> {
'Korrektur des Warenkorbs') 'Korrektur des Warenkorbs')
]; ];
Finance({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
initializeDateFormatting('de_DE'); initializeDateFormatting('de_DE');
@ -76,7 +71,6 @@ class _Finance extends State<Finance> {
children: [ children: [
Icon( Icon(
Icons.euro, Icons.euro,
//color: Colors.black,
//semanticLabel: 'Text for screenreader', //semanticLabel: 'Text for screenreader',
), ),
Column( Column(
@ -106,8 +100,12 @@ class _Finance extends State<Finance> {
onTap: () { onTap: () {
transactions[index].elevated = transactions[index].elevated =
!transactions[index].elevated; !transactions[index].elevated;
setState(() {}); showBottomSheet(
debugPrint('Card tapped'); context: context,
builder: (BuildContext context) {
return SizedBox.expand(
child: Text(transactions[index].beschreibung));
});
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@ -119,19 +117,11 @@ class _Finance extends State<Finance> {
: Icons.money), : Icons.money),
Column( Column(
children: [ children: [
Row( Text(
children: [ DateFormat("EEEE, dd. MMMM yyyy HH:mm", 'de_DE')
Text(DateFormat(
"EEEE, dd. MMMM yyyy HH:mm", 'de_DE')
.format(now)), .format(now)),
Text( Text(
'${transactions[index].art}: ${transactions[index].betrag / 100}'), '${transactions[index].art}: ${transactions[index].betrag / 100}')
],
),
if (transactions[index].beschreibung != '')
Expand(
expand: transactions[index].elevated,
child: Text(transactions[index].beschreibung))
], ],
), ),
], ],

View file

@ -81,7 +81,7 @@ class _MyHomePageState extends State<MyHomePage> {
alignment: Alignment.center, alignment: Alignment.center,
child: Text('Page $test'), child: Text('Page $test'),
), ),
const Finance(), Finance(),
const Text( const Text(
'Hier könnten Einstellungen zu Darkmode mit shared_preferences und riverpod sein') 'Hier könnten Einstellungen zu Darkmode mit shared_preferences und riverpod sein')
][currentPageIndex], ][currentPageIndex],