diff --git a/covas_mobile/lib/pages/EditProfile.dart b/covas_mobile/lib/pages/EditProfile.dart index e884d75..17dc4df 100644 --- a/covas_mobile/lib/pages/EditProfile.dart +++ b/covas_mobile/lib/pages/EditProfile.dart @@ -42,43 +42,25 @@ class EditProfile extends StatefulWidget { class _EditProfileState extends State with ShowAlertDialog, ShowEventDialog { + TextEditingController inputUserName = TextEditingController(); + TextEditingController inputName = TextEditingController(); - TextEditingController inputDate = TextEditingController(); - TextEditingController inputDesc = TextEditingController(); + TextEditingController inputFirstName = TextEditingController(); + TextEditingController inputEmail = TextEditingController(); + TextEditingController inputBirth = TextEditingController(); + TextEditingController inputPassword = TextEditingController(); - TextEditingController inputGeo = TextEditingController(); + onTapFunctionDatePicker({required BuildContext context}) async { + DateTime initialDate = DateTime.parse(formatDate(inputBirth.text)); - TextEditingController startDatepicker = TextEditingController(); - - List initialTags = []; - - final _stringOrgaController = StringTagController(); - List initialOrga = []; - - onTapFunctionDatePicker( - {required BuildContext context, required String position}) async { - DateTime date; - if ((startDatepicker.text.isEmpty) || (endDatepicker.text.isEmpty)) { - date = DateTime.now(); - } else { - date = DateTime.parse(formatDate(startDatepicker.text)); - if (position == "end") { - date = DateTime.parse(formatDate(endDatepicker.text)); - } - } DateTime? pickedDate = await showDatePicker( context: context, - firstDate: date, - initialDate: date, + firstDate: DateTime(1900), + initialDate: initialDate, lastDate: DateTime(2104)); if (pickedDate == null) return; - if (position == "start") { - startDatepicker.text = DateFormat("dd/MM/yyyy").format(pickedDate); - } - if (position == "end") { - endDatepicker.text = DateFormat("dd/MM/yyyy").format(pickedDate); - } + inputBirth.text = DateFormat("dd/MM/yyyy").format(pickedDate); } convertNulltoEmptyString(var check) { @@ -296,6 +278,18 @@ class _EditProfileState extends State child: SingleChildScrollView( child: Column( children: [ + Padding( + //padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0), + padding: EdgeInsets.symmetric(horizontal: 15), + child: TextFormField( + controller: inputUserName, + validator: (value) => _validateField(value), + decoration: InputDecoration( + border: OutlineInputBorder(), + labelText: 'Pseudo', + hintText: 'Modifier le pseudo'), + ), + ), Padding( //padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0), padding: EdgeInsets.symmetric(horizontal: 15), @@ -305,7 +299,31 @@ class _EditProfileState extends State decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Nom', - hintText: 'Modifier le nom de l\'évènement'), + hintText: 'Modifier le nom'), + ), + ), + Padding( + //padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0), + padding: EdgeInsets.symmetric(horizontal: 15), + child: TextFormField( + controller: inputFirstName, + validator: (value) => _validateField(value), + decoration: InputDecoration( + border: OutlineInputBorder(), + labelText: 'Prénom', + hintText: 'Modifier le prénom'), + ), + ), + Padding( + //padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0), + padding: EdgeInsets.symmetric(horizontal: 15), + child: TextFormField( + controller: inputName, + validator: (value) => _validateField(value), + decoration: InputDecoration( + border: OutlineInputBorder(), + labelText: 'Email', + hintText: 'Modifier l\'adresse mail'), ), ), Padding( @@ -313,29 +331,14 @@ class _EditProfileState extends State left: 15.0, right: 15.0, top: 15, bottom: 0), //padding: EdgeInsets.symmetric(horizontal: 15), child: TextFormField( - controller: startDatepicker, + controller: inputBirth, readOnly: true, validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de debut', + labelText: 'Date de nassance', hintText: 'Cliquez ici pour selectionner une date'), - onTap: () => onTapFunctionDatePicker( - context: context, position: "start")), - ), - Padding( - padding: const EdgeInsets.only( - left: 15.0, right: 15.0, top: 15, bottom: 0), - //padding: EdgeInsets.symmetric(horizontal: 15), - child: TextField( - controller: inputDesc, - keyboardType: TextInputType.multiline, - maxLines: 10, - decoration: InputDecoration( - border: OutlineInputBorder(), - labelText: 'Description', - hintText: 'Décrire l\'evènement'), - ), + onTap: () => onTapFunctionDatePicker(context: context)), ), SizedBox( height: 30,