Merge pull request 'hide input date' (#20) from feature/hide-input into main

Reviewed-on: #20
This commit is contained in:
v4l3n71n 2024-11-23 22:32:19 +01:00
commit f85894416c

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,