hide input date

This commit is contained in:
Valentin CZERYBA 2024-11-23 22:20:27 +01:00
parent 6b3bf5004c
commit dbba3304c2

View File

@ -49,6 +49,8 @@ class _MyHomePageState extends State<ListItemMenu> {
TextEditingController startDatepicker = TextEditingController(); TextEditingController startDatepicker = TextEditingController();
TextEditingController endDatepicker = TextEditingController(); TextEditingController endDatepicker = TextEditingController();
bool showDateFields = false; // State to toggle date fields
// Fetching events from API // Fetching events from API
static Future<List<Events>> getPosts() async { static Future<List<Events>> getPosts() async {
PermissionStatus status = await Permission.location.status; PermissionStatus status = await Permission.location.status;
@ -562,8 +564,22 @@ class _MyHomePageState extends State<ListItemMenu> {
body: Column( body: Column(
children: [ children: [
_buildGeographicalZoneSearchField(), _buildGeographicalZoneSearchField(),
_buildDateField("start"), if (showDateFields) _buildDateField("start"),
_buildDateField("end"), if (showDateFields) _buildDateField("end"),
IconButton(
onPressed: () {
setState(() {
showDateFields = !showDateFields; // Toggle visibility
});
},
icon: Icon(
showDateFields
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
color: Colors.blue,
),
tooltip: showDateFields ? 'Show Date Fields' : 'Hide Date Fields',
),
Expanded( Expanded(
child: FutureBuilder<List<Events>>( child: FutureBuilder<List<Events>>(
future: postsFuture, future: postsFuture,