fix: changed owner managment

This commit is contained in:
Alzalia 2025-08-08 16:12:47 +02:00
parent f89efc3c52
commit d2cbb43bcb

View file

@ -22,6 +22,7 @@ class _OwnerPopupState extends State<OwnerPopup> {
String? firstName;
String? lastName;
String? contact;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
@ -68,17 +69,7 @@ class _OwnerPopupState extends State<OwnerPopup> {
onSelected: (Owner? owner) {
widget.viewModel.currentOwner = owner;
},
),
SizedBox(height: 20),
TextButton(
onPressed: () {
setState(() {
showNewOwner = !showNewOwner;
});
},
child: Text(
(showNewOwner) ? "Annuler" : "Ajouter un propriétaire",
),
enableSearch: true,
),
(!showNewOwner)
? SizedBox()
@ -139,9 +130,25 @@ class _OwnerPopupState extends State<OwnerPopup> {
return null;
},
),
SizedBox(height: 10),
ElevatedButton(
],
),
),
],
),
),
actions: [
TextButton(
onPressed: () {
setState(() {
showNewOwner = !showNewOwner;
});
},
child: Text((showNewOwner) ? "Annuler" : "Ajouter un propriétaire"),
),
TextButton(
onPressed: () async {
if (showNewOwner) {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
await widget.viewModel.addOwner(
@ -153,20 +160,9 @@ class _OwnerPopupState extends State<OwnerPopup> {
showNewOwner = false;
});
}
},
child: Text("Créer"),
),
],
),
),
],
),
),
actions: [
TextButton(
onPressed: () {
} else {
widget.onPressAccept(context);
}
},
child: Text("Valider"),
),