add position parameter
This commit is contained in:
parent
b2b142ae71
commit
27cdc85b5d
@ -48,22 +48,34 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
TextEditingController endDatepicker = TextEditingController();
|
||||
TextEditingController endTimepicker = TextEditingController();
|
||||
|
||||
onTapFunctionDatePicker({required BuildContext context}) async {
|
||||
onTapFunctionDatePicker(
|
||||
{required BuildContext context, required String position}) async {
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
firstDate: DateTime.now(),
|
||||
initialDate: DateTime.now(),
|
||||
lastDate: DateTime(2026));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
onTapFunctionTimePicker({required BuildContext context}) async {
|
||||
onTapFunctionTimePicker(
|
||||
{required BuildContext context, required String position}) async {
|
||||
TimeOfDay? pickedDate =
|
||||
await showTimePicker(context: context, initialTime: TimeOfDay.now());
|
||||
if (pickedDate == null) return;
|
||||
if (position == "start") {
|
||||
startTimepicker.text = pickedDate.format(context);
|
||||
}
|
||||
if (position == "end") {
|
||||
endTimepicker.text = pickedDate.format(context);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _updateEvent(BuildContext context) async {
|
||||
var url = Uri.parse("${globals.api}/token");
|
||||
@ -215,7 +227,8 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Date de debut de l\'évènement',
|
||||
hintText: 'Cliquez ici pour selectionner une date'),
|
||||
onTap: () => onTapFunctionDatePicker(context: context)),
|
||||
onTap: () => onTapFunctionDatePicker(
|
||||
context: context, position: "start")),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
@ -228,7 +241,8 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Heure de debut de l\'évènement',
|
||||
hintText: 'Cliquez ici pour selectionner une heure'),
|
||||
onTap: () => onTapFunctionTimePicker(context: context)),
|
||||
onTap: () => onTapFunctionTimePicker(
|
||||
context: context, position: "start")),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
@ -241,7 +255,8 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Date de fin de l\'évènement',
|
||||
hintText: 'Cliquez ici pour selectionner une date'),
|
||||
onTap: () => onTapFunctionDatePicker(context: context)),
|
||||
onTap: () => onTapFunctionDatePicker(
|
||||
context: context, position: "end")),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
@ -254,7 +269,8 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Heure de fin de l\'évènement',
|
||||
hintText: 'Cliquez ici pour selectionner une heure'),
|
||||
onTap: () => onTapFunctionTimePicker(context: context)),
|
||||
onTap: () => onTapFunctionTimePicker(
|
||||
context: context, position: "end")),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
|
Loading…
x
Reference in New Issue
Block a user