fix edit profile wip

This commit is contained in:
Valentin CZERYBA 2025-01-03 17:22:14 +01:00
parent 5419da7a98
commit 3615c1f476

View File

@ -42,43 +42,25 @@ class EditProfile extends StatefulWidget {
class _EditProfileState extends State<EditProfile> class _EditProfileState extends State<EditProfile>
with ShowAlertDialog, ShowEventDialog { with ShowAlertDialog, ShowEventDialog {
TextEditingController inputUserName = TextEditingController();
TextEditingController inputName = TextEditingController(); TextEditingController inputName = TextEditingController();
TextEditingController inputDate = TextEditingController(); TextEditingController inputFirstName = TextEditingController();
TextEditingController inputDesc = 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<String> initialTags = [];
final _stringOrgaController = StringTagController();
List<String> 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( DateTime? pickedDate = await showDatePicker(
context: context, context: context,
firstDate: date, firstDate: DateTime(1900),
initialDate: date, initialDate: initialDate,
lastDate: DateTime(2104)); lastDate: DateTime(2104));
if (pickedDate == null) return; if (pickedDate == null) return;
if (position == "start") { inputBirth.text = DateFormat("dd/MM/yyyy").format(pickedDate);
startDatepicker.text = DateFormat("dd/MM/yyyy").format(pickedDate);
}
if (position == "end") {
endDatepicker.text = DateFormat("dd/MM/yyyy").format(pickedDate);
}
} }
convertNulltoEmptyString(var check) { convertNulltoEmptyString(var check) {
@ -296,6 +278,18 @@ class _EditProfileState extends State<EditProfile>
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
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(
//padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0), //padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0),
padding: EdgeInsets.symmetric(horizontal: 15), padding: EdgeInsets.symmetric(horizontal: 15),
@ -305,7 +299,31 @@ class _EditProfileState extends State<EditProfile>
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder(), border: OutlineInputBorder(),
labelText: 'Nom', 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( Padding(
@ -313,29 +331,14 @@ class _EditProfileState extends State<EditProfile>
left: 15.0, right: 15.0, top: 15, bottom: 0), left: 15.0, right: 15.0, top: 15, bottom: 0),
//padding: EdgeInsets.symmetric(horizontal: 15), //padding: EdgeInsets.symmetric(horizontal: 15),
child: TextFormField( child: TextFormField(
controller: startDatepicker, controller: inputBirth,
readOnly: true, readOnly: true,
validator: (value) => _validateField(value), validator: (value) => _validateField(value),
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder(), border: OutlineInputBorder(),
labelText: 'Date de debut', labelText: 'Date de nassance',
hintText: 'Cliquez ici pour selectionner une date'), hintText: 'Cliquez ici pour selectionner une date'),
onTap: () => onTapFunctionDatePicker( onTap: () => onTapFunctionDatePicker(context: context)),
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'),
),
), ),
SizedBox( SizedBox(
height: 30, height: 30,