diff --git a/lib/ui/add_page/widgets/form_popup.dart b/lib/ui/add_page/widgets/form_popup.dart index 519ea0d..101fa0b 100644 --- a/lib/ui/add_page/widgets/form_popup.dart +++ b/lib/ui/add_page/widgets/form_popup.dart @@ -166,6 +166,7 @@ class _FullyManualState extends State<_FullyManual> { String? ean = ""; String? title; String? author; + num? price; @override Widget build(BuildContext context) { @@ -227,6 +228,26 @@ class _FullyManualState extends State<_FullyManual> { author = newValue; }, ), + SizedBox(height: 10), + TextFormField( + decoration: InputDecoration( + labelText: "Prix", + border: OutlineInputBorder(), + suffixText: "€", + ), + keyboardType: TextInputType.number, + validator: (value) { + if (value == null || value.isEmpty) { + return "Indiquez un prix"; + } else if (num.tryParse(value) == null) { + return "Le prix doit être un nombre"; + } + return null; + }, + onSaved: (newValue) { + price = num.parse(newValue!); + }, + ), ], ), ),