extremely simplyfied code
This commit is contained in:
parent
99282eb9da
commit
f343214df0
3 changed files with 16 additions and 24 deletions
|
@ -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;
|
||||||
|
|
|
@ -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))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -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],
|
||||||
|
|
Loading…
Reference in a new issue