fix dialog white screen: StatefulBuilder + remove Spacer from actions

This commit is contained in:
alexis 2026-07-12 00:08:46 +02:00
parent 5b4f3f7ec2
commit 993e4f62a1

View file

@ -79,7 +79,8 @@ class _AccountCard extends ConsumerWidget {
await showDialog( await showDialog(
context: context, context: context,
builder: (ctx) => AlertDialog( builder: (ctx) => StatefulBuilder(
builder: (context, setDialogState) => AlertDialog(
title: const Text('Modifier le compte'), title: const Text('Modifier le compte'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: Column( child: Column(
@ -97,7 +98,7 @@ class _AccountCard extends ConsumerWidget {
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
DropdownButtonFormField<String>( DropdownButtonFormField<String>(
value: type, initialValue: type,
decoration: const InputDecoration(labelText: 'Type'), decoration: const InputDecoration(labelText: 'Type'),
items: const [ items: const [
DropdownMenuItem(value: 'checking', child: Text('Compte courant')), DropdownMenuItem(value: 'checking', child: Text('Compte courant')),
@ -106,7 +107,10 @@ class _AccountCard extends ConsumerWidget {
DropdownMenuItem(value: 'cash', child: Text('Espèces')), DropdownMenuItem(value: 'cash', child: Text('Espèces')),
], ],
onChanged: (v) { onChanged: (v) {
if (v != null) type = v; if (v != null) {
type = v;
setDialogState(() {});
}
}, },
), ),
], ],
@ -121,7 +125,7 @@ class _AccountCard extends ConsumerWidget {
style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.error), style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.error),
child: const Text('Supprimer'), child: const Text('Supprimer'),
), ),
const Spacer(), const SizedBox(width: 8),
TextButton( TextButton(
onPressed: () => Navigator.pop(ctx), onPressed: () => Navigator.pop(ctx),
child: const Text('Annuler'), child: const Text('Annuler'),
@ -143,6 +147,7 @@ class _AccountCard extends ConsumerWidget {
), ),
], ],
), ),
),
); );
nameCtrl.dispose(); nameCtrl.dispose();
balanceCtrl.dispose(); balanceCtrl.dispose();