Feat: Zeigt Knöpfe zum Transaktion erstellen nur an, wenn ein Konto ausgewählt ist
This commit is contained in:
@@ -51,7 +51,7 @@ class _RecentTransactionsListState extends State<RecentTransactionsList> {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
|
||||
if (snapshot.hasData) {
|
||||
final List<Padding>? recentTransactionsWidgetList = snapshot.data
|
||||
final List<Widget>? recentTransactionsWidgetList = snapshot.data
|
||||
?.map(
|
||||
(final Transaction transaction) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
@@ -74,7 +74,42 @@ class _RecentTransactionsListState extends State<RecentTransactionsList> {
|
||||
)
|
||||
.toList();
|
||||
|
||||
return Column(children: [...?recentTransactionsWidgetList]);
|
||||
if (recentTransactionsWidgetList != null &&
|
||||
recentTransactionsWidgetList.isNotEmpty) {
|
||||
recentTransactionsWidgetList.add(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: TextButton(
|
||||
onPressed: _transactionController.newTransactionHandler,
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.swap_horiz),
|
||||
SizedBox(width: 10),
|
||||
Text('Transaktion hinzufügen'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return Column(children: [...recentTransactionsWidgetList]);
|
||||
} else {
|
||||
if (_accountController.selected.value != null) {
|
||||
return TextButton(
|
||||
onPressed: _transactionController.newTransactionHandler,
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.swap_horiz),
|
||||
SizedBox(width: 10),
|
||||
Text('Transaktion hinzufügen'),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
}
|
||||
} else if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user