Feat: Zeigt Knöpfe zum Transaktion erstellen nur an, wenn ein Konto ausgewählt ist
This commit is contained in:
@@ -24,33 +24,57 @@ class _FloatingCreationButtonState extends State<FloatingCreationButton> {
|
||||
final _key = GlobalKey<ExpandableFabState>();
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => ExpandableFab(
|
||||
key: _key,
|
||||
openButtonBuilder: RotateFloatingActionButtonBuilder(
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
type: ExpandableFabType.up,
|
||||
childrenAnimation: ExpandableFabAnimation.none,
|
||||
distance: 70,
|
||||
children: <Widget>[
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_accountController.selected.addListener(() {
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) {
|
||||
final List<Widget> fabs = [];
|
||||
if (_accountController.selected.value != null) {
|
||||
fabs
|
||||
..add(
|
||||
_expandableButton(
|
||||
label: 'Neue Transaktion',
|
||||
icon: Icons.swap_horiz,
|
||||
onPressed: _transactionController.newTransactionHandler,
|
||||
),
|
||||
)
|
||||
..add(
|
||||
_expandableButton(
|
||||
label: 'Neue wiederkehrende Transaktion',
|
||||
icon: Icons.repeat,
|
||||
onPressed:
|
||||
_recurringTransactionController.newRecurringTransactionHandler,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
fabs.add(
|
||||
_expandableButton(
|
||||
label: 'Neues Konto',
|
||||
icon: Icons.account_balance_wallet,
|
||||
onPressed: _accountController.newAccountHandler,
|
||||
),
|
||||
_expandableButton(
|
||||
label: 'Neue Transaktion',
|
||||
icon: Icons.swap_horiz,
|
||||
onPressed: _transactionController.newTransactionHandler,
|
||||
);
|
||||
|
||||
return ExpandableFab(
|
||||
key: _key,
|
||||
openButtonBuilder: RotateFloatingActionButtonBuilder(
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
_expandableButton(
|
||||
label: 'Neue wiederkehrende Transaktion',
|
||||
icon: Icons.repeat,
|
||||
onPressed:
|
||||
_recurringTransactionController.newRecurringTransactionHandler,
|
||||
),
|
||||
],
|
||||
);
|
||||
type: ExpandableFabType.up,
|
||||
childrenAnimation: ExpandableFabAnimation.none,
|
||||
distance: 70,
|
||||
children: fabs,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _expandableButton({
|
||||
required final String label,
|
||||
|
||||
Reference in New Issue
Block a user