add datepicker
This commit is contained in:
parent
30d485d0e7
commit
00bc3bb0aa
@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@ -41,6 +43,17 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
TextEditingController inputName = TextEditingController();
|
TextEditingController inputName = TextEditingController();
|
||||||
TextEditingController inputPlace = TextEditingController();
|
TextEditingController inputPlace = TextEditingController();
|
||||||
TextEditingController inputDate = TextEditingController();
|
TextEditingController inputDate = TextEditingController();
|
||||||
|
TextEditingController startDatepicker = TextEditingController();
|
||||||
|
|
||||||
|
onTapFunctionDatePicker({required BuildContext context}) async {
|
||||||
|
DateTime? pickedDate = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
firstDate: DateTime.now(),
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
lastDate: DateTime(2026));
|
||||||
|
if (pickedDate == null) return;
|
||||||
|
startDatepicker.text = DateFormat("dd-MM-yyyy").format(pickedDate);
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
||||||
@ -181,6 +194,19 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
hintText: 'Entrer le lieu'),
|
hintText: 'Entrer le lieu'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
child: TextField(
|
||||||
|
controller: startDatepicker,
|
||||||
|
readOnly: true,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Date de debut de l\'évènement',
|
||||||
|
hintText: 'Cliquez ici pour selectionner une date'),
|
||||||
|
onTap: () => onTapFunctionDatePicker(context: context)),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user