From dbba3304c2dcf901f1f97d9e84989bdec3321b9b Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 23 Nov 2024 22:20:27 +0100 Subject: [PATCH] hide input date --- covas_mobile/lib/pages/ListItemMenu.dart | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index e9fee28..7bad5e0 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -49,6 +49,8 @@ class _MyHomePageState extends State { TextEditingController startDatepicker = TextEditingController(); TextEditingController endDatepicker = TextEditingController(); + bool showDateFields = false; // State to toggle date fields + // Fetching events from API static Future> getPosts() async { PermissionStatus status = await Permission.location.status; @@ -562,8 +564,22 @@ class _MyHomePageState extends State { body: Column( children: [ _buildGeographicalZoneSearchField(), - _buildDateField("start"), - _buildDateField("end"), + if (showDateFields) _buildDateField("start"), + 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( child: FutureBuilder>( future: postsFuture,