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(
context: context,
builder: (ctx) => AlertDialog(
builder: (ctx) => StatefulBuilder(
builder: (context, setDialogState) => AlertDialog(
title: const Text('Modifier le compte'),
content: SingleChildScrollView(
child: Column(
@ -97,7 +98,7 @@ class _AccountCard extends ConsumerWidget {
),
const SizedBox(height: 12),
DropdownButtonFormField<String>(
value: type,
initialValue: type,
decoration: const InputDecoration(labelText: 'Type'),
items: const [
DropdownMenuItem(value: 'checking', child: Text('Compte courant')),
@ -106,7 +107,10 @@ class _AccountCard extends ConsumerWidget {
DropdownMenuItem(value: 'cash', child: Text('Espèces')),
],
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),
child: const Text('Supprimer'),
),
const Spacer(),
const SizedBox(width: 8),
TextButton(
onPressed: () => Navigator.pop(ctx),
child: const Text('Annuler'),
@ -143,6 +147,7 @@ class _AccountCard extends ConsumerWidget {
),
],
),
),
);
nameCtrl.dispose();
balanceCtrl.dispose();