Compare commits
2 Commits
8d8c30f506
...
eadf07177b
Author | SHA1 | Date | |
---|---|---|---|
eadf07177b | |||
18fdc7d6c4 |
@ -14,6 +14,7 @@ import '../variable/globals.dart' as globals;
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import "Camera.dart";
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:textfield_tags/textfield_tags.dart';
|
||||
|
||||
void main() {
|
||||
initializeDateFormatting("fr_FR", null).then((_) => runApp(const MyApp()));
|
||||
@ -50,6 +51,7 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
TextEditingController startDatepicker = TextEditingController();
|
||||
TextEditingController endDatepicker = TextEditingController();
|
||||
TextEditingController inputItem = TextEditingController();
|
||||
TextEditingController inputTags = TextEditingController();
|
||||
|
||||
bool showDateFields = false; // State to toggle date fields
|
||||
bool showArrow = true;
|
||||
@ -533,6 +535,56 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
);
|
||||
}
|
||||
|
||||
Padding _buildTagsField() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: inputTags,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Search by tags',
|
||||
border: OutlineInputBorder(),
|
||||
suffixIcon: inputItem.text.isEmpty
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
inputItem.clear();
|
||||
itemName = ''; // Reset the geographical zone state
|
||||
suggestionsItem.clear();
|
||||
showDateFields = true;
|
||||
showArrow = true;
|
||||
});
|
||||
fetchPostsByLocation();
|
||||
},
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
if (value.isNotEmpty) {
|
||||
setState(() {
|
||||
itemName = value;
|
||||
searchSuggestionsByItem(value);
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
showDateFields = true;
|
||||
showArrow = true; // Optionally clear suggestions
|
||||
inputItem.clear(); // Clear the text field
|
||||
itemName = ''; // Reset the geographical zone state
|
||||
suggestionsItem.clear();
|
||||
|
||||
/// Clear the filted posts
|
||||
});
|
||||
fetchPostsByLocation();
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding _buildItemZoneSearchField() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@ -567,11 +619,11 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
showDateFields = true;
|
||||
showArrow = true; // Optionally clear suggestions
|
||||
inputItem.clear(); // Clear the text field
|
||||
itemName = ''; // Reset the geographical zone state
|
||||
suggestionsItem.clear();
|
||||
showDateFields = true;
|
||||
showArrow = true; // Optionally clear suggestions
|
||||
|
||||
/// Clear the filted posts
|
||||
});
|
||||
@ -633,6 +685,7 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
Flexible(child: _buildDateField("start")),
|
||||
Flexible(child: _buildDateField("end"))
|
||||
]),
|
||||
if ((showDateFields) && (showArrow)) _buildTagsField(),
|
||||
if (showDateFields) _buildGeographicalZoneSearchField(),
|
||||
if (showArrow)
|
||||
IconButton(
|
||||
|
Loading…
x
Reference in New Issue
Block a user