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