Compare commits
No commits in common. "56ae77137cc1f72d0afa60542345e0372ff4784f" and "908d94c269a2eb604cde3ebd8c3a1a08937596b2" have entirely different histories.
56ae77137c
...
908d94c269
@ -89,61 +89,107 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getEventInfos() async {
|
Future<void> _getEventInfos() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
final accessToken = prefs.getString("access_token") ?? "";
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
|
String formerName = "";
|
||||||
|
String formerDate = "";
|
||||||
|
String formerMap = "";
|
||||||
|
String formerImage = "";
|
||||||
|
String formerDesc = "";
|
||||||
|
List<String> formerTags = [];
|
||||||
|
List<String> formerOrga = [];
|
||||||
|
|
||||||
if (accessToken.isEmpty) {
|
if (accessToken.isNotEmpty) {
|
||||||
showAlertDialog(context, "Erreur serveur", "Cache invalide");
|
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
|
||||||
return;
|
|
||||||
|
var responseGet = await http.get(urlGet,
|
||||||
|
headers: {HttpHeaders.cookieHeader: 'access_token=${accessToken}'});
|
||||||
|
stderr.writeln('Response Get status: ${responseGet.statusCode}');
|
||||||
|
if (responseGet.statusCode == 200) {
|
||||||
|
stderr.writeln('Username : ${responseGet.body}');
|
||||||
|
events =
|
||||||
|
Events.fromJson(jsonDecode(utf8.decode(responseGet.bodyBytes)));
|
||||||
|
id = events!.id ?? "";
|
||||||
|
formerName = events!.name ?? "";
|
||||||
|
formerMap = "${events!.place}" ?? "";
|
||||||
|
formerDesc = events!.description ?? "";
|
||||||
|
|
||||||
|
formerTags = List<String>.from(events!.tags as List);
|
||||||
|
formerOrga = List<String>.from(events!.organizers as List);
|
||||||
|
final startDate =
|
||||||
|
DateTime.parse(events!.startDate ?? DateTime.now().toString());
|
||||||
|
final date = DateFormat.yMd().format(startDate);
|
||||||
|
final time = DateFormat.Hm().format(startDate);
|
||||||
|
|
||||||
|
final endDate =
|
||||||
|
DateTime.parse(events!.endDate ?? DateTime.now().toString());
|
||||||
|
|
||||||
|
final dateE = DateFormat.yMd().format(endDate);
|
||||||
|
final timeE = DateFormat.Hm().format(endDate);
|
||||||
|
if (events!.imgUrl != null) {
|
||||||
|
formerImage = events!.imgUrl ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
final urlGet = Uri.parse("${globals.api}/events/${widget.title}");
|
formerDate = "${date} ${time} à ${dateE} ${timeE}";
|
||||||
final responseGet = await http.get(
|
} else {
|
||||||
urlGet,
|
var text = "";
|
||||||
headers: {HttpHeaders.cookieHeader: 'access_token=$accessToken'},
|
switch (responseGet.statusCode) {
|
||||||
);
|
case 400:
|
||||||
|
{
|
||||||
stderr.writeln('Response Get status: ${responseGet.statusCode}');
|
text = "Requête mal construite";
|
||||||
|
}
|
||||||
if (responseGet.statusCode == 200) {
|
break;
|
||||||
final responseBody = utf8.decode(responseGet.bodyBytes);
|
case 406:
|
||||||
stderr.writeln('Username : $responseBody');
|
{
|
||||||
|
text = "Mot de passe incorrect";
|
||||||
final event = Events.fromJson(jsonDecode(responseBody));
|
}
|
||||||
|
break;
|
||||||
final startDate =
|
case 404:
|
||||||
DateTime.parse(event.startDate ?? DateTime.now().toString());
|
{
|
||||||
final endDate =
|
text = "Utilisateur inconnu";
|
||||||
DateTime.parse(event.endDate ?? DateTime.now().toString());
|
}
|
||||||
|
break;
|
||||||
final formattedStartDate =
|
case 403:
|
||||||
"${DateFormat.yMd().format(startDate)} ${DateFormat.Hm().format(startDate)}";
|
{
|
||||||
final formattedEndDate =
|
text = "Vous n'avez pas l'autorisation de faire cette action";
|
||||||
"${DateFormat.yMd().format(endDate)} ${DateFormat.Hm().format(endDate)}";
|
}
|
||||||
|
break;
|
||||||
|
case 410:
|
||||||
|
{
|
||||||
|
text = "Token invalide";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
{
|
||||||
|
text = "Probleme interne du serveur";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
text = "Probleme d'authentification inconnu";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
showAlertDialog(context, "Erreur serveur", text);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showAlertDialog(context, "Erreur serveur", "Cache invalide");
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
eventName = event.name ?? "";
|
// This call to setState tells the Flutter framework that something has
|
||||||
eventStartDate = "$formattedStartDate à $formattedEndDate";
|
// changed in this State, which causes it to rerun the build method below
|
||||||
organizers = List<String>.from(event.organizers ?? []);
|
// so that the display can reflect the updated values. If we changed
|
||||||
place = event.place ?? "";
|
// _counter without calling setState(), then the build method would not be
|
||||||
imgUrl = event.imgUrl ?? "";
|
// called again, and so nothing would appear to happen.
|
||||||
eventDescription = event.description ?? "";
|
eventName = formerName;
|
||||||
tags = List<String>.from(event.tags ?? []);
|
eventStartDate = formerDate;
|
||||||
|
organizers = formerOrga;
|
||||||
|
place = formerMap;
|
||||||
|
imgUrl = formerImage;
|
||||||
|
eventDescription = formerDesc;
|
||||||
|
tags = formerTags;
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
final errorMessages = {
|
|
||||||
400: "Requête mal construite",
|
|
||||||
406: "Mot de passe incorrect",
|
|
||||||
404: "Utilisateur inconnu",
|
|
||||||
403: "Vous n'avez pas l'autorisation de faire cette action",
|
|
||||||
410: "Token invalide",
|
|
||||||
500: "Problème interne du serveur",
|
|
||||||
};
|
|
||||||
|
|
||||||
final errorMessage = errorMessages[responseGet.statusCode] ??
|
|
||||||
"Problème d'authentification inconnu";
|
|
||||||
showAlertDialog(context, "Erreur serveur", errorMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
@ -480,33 +480,65 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSearchField({
|
Padding _buildGeographicalZoneSearchField() {
|
||||||
required TextEditingController controller,
|
|
||||||
required String labelText,
|
|
||||||
required Function(String) onChanged,
|
|
||||||
required Function() onClear,
|
|
||||||
required List<Map<String, dynamic>> suggestions,
|
|
||||||
required Function(Map<String, dynamic>) onSuggestionTap,
|
|
||||||
}) {
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
TextField(
|
TextField(
|
||||||
controller: controller,
|
controller: inputGeo,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: labelText,
|
labelText: 'Search by geographical zone',
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
suffixIcon: controller.text.isEmpty
|
suffixIcon: inputGeo.text.isEmpty
|
||||||
? null
|
? null
|
||||||
: IconButton(
|
: IconButton(
|
||||||
icon: const Icon(Icons.clear),
|
icon: const Icon(Icons.clear),
|
||||||
onPressed: () => onClear(),
|
onPressed: () async {
|
||||||
|
SharedPreferences prefs =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
prefs.remove("city_lat");
|
||||||
|
prefs.remove("city_long");
|
||||||
|
setState(() {
|
||||||
|
inputGeo.clear(); // Clear the text field
|
||||||
|
geographicalZone =
|
||||||
|
''; // Reset the geographical zone state
|
||||||
|
suggestionsGeo.clear();
|
||||||
|
showArrow = true;
|
||||||
|
showInputSearch =
|
||||||
|
true; // Optionally clear suggestions
|
||||||
|
/// Clear the filtered posts
|
||||||
|
showInputTag = true;
|
||||||
|
});
|
||||||
|
fetchPostsByLocation();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: onChanged,
|
onChanged: (value) async {
|
||||||
|
if (value.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
geographicalZone = value;
|
||||||
|
searchSuggestionsGeo(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.remove("city_lat");
|
||||||
|
prefs.remove("city_long");
|
||||||
|
setState(() {
|
||||||
|
inputGeo.clear(); // Clear the text field
|
||||||
|
geographicalZone = ''; // Reset the geographical zone state
|
||||||
|
suggestionsGeo.clear(); // Optionally clear suggestions
|
||||||
|
showArrow = true;
|
||||||
|
showInputSearch = true;
|
||||||
|
showInputTag = true;
|
||||||
|
|
||||||
|
/// Clear the filted posts
|
||||||
|
});
|
||||||
|
fetchPostsByLocation();
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
if (suggestions.isNotEmpty)
|
if (suggestionsGeo.isNotEmpty)
|
||||||
Container(
|
Container(
|
||||||
height: 200,
|
height: 200,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -515,13 +547,181 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
),
|
),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: suggestions.length,
|
itemCount: suggestionsGeo.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final suggestion = suggestions[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(suggestionsGeo[index]['place_name']),
|
||||||
suggestion['name'] ?? suggestion['place_name'] ?? ''),
|
onTap: () async {
|
||||||
onTap: () => onSuggestionTap(suggestion),
|
final latitude =
|
||||||
|
suggestionsGeo[index]['geometry']['coordinates'][1];
|
||||||
|
final longitude =
|
||||||
|
suggestionsGeo[index]['geometry']['coordinates'][0];
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
geographicalZone = suggestionsGeo[index]['place_name'];
|
||||||
|
inputGeo.text = geographicalZone;
|
||||||
|
suggestionsGeo.clear();
|
||||||
|
showArrow = true;
|
||||||
|
showInputSearch = true;
|
||||||
|
showInputTag = true;
|
||||||
|
});
|
||||||
|
SharedPreferences prefs =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
prefs.setDouble("city_lat", latitude);
|
||||||
|
prefs.setDouble("city_long", longitude);
|
||||||
|
await fetchPostsByLocation();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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: inputTags.text.isEmpty
|
||||||
|
? null
|
||||||
|
: IconButton(
|
||||||
|
icon: const Icon(Icons.clear),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
inputTags.clear();
|
||||||
|
});
|
||||||
|
fetchPostsByLocation();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
itemTags = value;
|
||||||
|
searchSuggestionsByTag(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
inputTags.clear();
|
||||||
|
showArrow = true;
|
||||||
|
showInputSearch = true;
|
||||||
|
showInputGeo = true; // Optionally clear suggestions
|
||||||
|
itemTags = ''; // Clear the text field
|
||||||
|
|
||||||
|
/// Clear the filted posts
|
||||||
|
});
|
||||||
|
fetchPostsByLocation();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
if (suggestionsTags.isNotEmpty)
|
||||||
|
Container(
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.blue),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: suggestionsTags.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(suggestionsTags[index]['name']),
|
||||||
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
itemTags = suggestionsTags[index]['name'];
|
||||||
|
inputTags.text = itemTags;
|
||||||
|
suggestionsTags.clear();
|
||||||
|
showArrow = true;
|
||||||
|
showInputSearch = true;
|
||||||
|
showInputGeo = true;
|
||||||
|
});
|
||||||
|
await fetchPostsByLocation();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Padding _buildItemZoneSearchField() {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: inputItem,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Search by item',
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
if (suggestionsItem.isNotEmpty)
|
||||||
|
Container(
|
||||||
|
height: 200,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.blue),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: suggestionsItem.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(suggestionsItem[index]['name']),
|
||||||
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
itemName = suggestionsItem[index]['name'];
|
||||||
|
inputItem.text = itemName;
|
||||||
|
suggestionsItem.clear();
|
||||||
|
showDateFields = true;
|
||||||
|
showArrow = true;
|
||||||
|
});
|
||||||
|
await fetchPostsByLocation();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -547,89 +747,8 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
drawer: MyDrawer(),
|
drawer: MyDrawer(),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
if (showInputSearch)
|
if (showInputSearch) _buildItemZoneSearchField(),
|
||||||
_buildSearchField(
|
if ((showDateFields) && (showInputTag)) _buildTagsField(),
|
||||||
controller: inputItem,
|
|
||||||
labelText: 'Search by item',
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
itemName = value;
|
|
||||||
searchSuggestionsByItem(value);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
inputItem.clear();
|
|
||||||
itemName = '';
|
|
||||||
suggestionsItem.clear();
|
|
||||||
showDateFields = true;
|
|
||||||
showArrow = true;
|
|
||||||
});
|
|
||||||
fetchPostsByLocation();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onClear: () {
|
|
||||||
setState(() {
|
|
||||||
inputItem.clear();
|
|
||||||
itemName = '';
|
|
||||||
suggestionsItem.clear();
|
|
||||||
showDateFields = true;
|
|
||||||
showArrow = true;
|
|
||||||
});
|
|
||||||
fetchPostsByLocation();
|
|
||||||
},
|
|
||||||
suggestions: suggestionsItem,
|
|
||||||
onSuggestionTap: (suggestion) async {
|
|
||||||
setState(() {
|
|
||||||
itemName = suggestion['name'];
|
|
||||||
inputItem.text = itemName;
|
|
||||||
suggestionsItem.clear();
|
|
||||||
showDateFields = true;
|
|
||||||
showArrow = true;
|
|
||||||
});
|
|
||||||
await fetchPostsByLocation();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if ((showDateFields) && (showInputTag))
|
|
||||||
_buildSearchField(
|
|
||||||
controller: inputTags,
|
|
||||||
labelText: 'Search by tags',
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
itemTags = value;
|
|
||||||
searchSuggestionsByTag(value);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
inputTags.clear();
|
|
||||||
showArrow = true;
|
|
||||||
showInputSearch = true;
|
|
||||||
showInputGeo = true;
|
|
||||||
itemTags = '';
|
|
||||||
});
|
|
||||||
fetchPostsByLocation();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onClear: () {
|
|
||||||
setState(() {
|
|
||||||
inputTags.clear();
|
|
||||||
});
|
|
||||||
fetchPostsByLocation();
|
|
||||||
},
|
|
||||||
suggestions: suggestionsTags,
|
|
||||||
onSuggestionTap: (suggestion) async {
|
|
||||||
setState(() {
|
|
||||||
itemTags = suggestion['name'];
|
|
||||||
inputTags.text = itemTags;
|
|
||||||
suggestionsTags.clear();
|
|
||||||
showArrow = true;
|
|
||||||
showInputSearch = true;
|
|
||||||
showInputGeo = true;
|
|
||||||
});
|
|
||||||
await fetchPostsByLocation();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if ((showDateFields) && (showArrow))
|
if ((showDateFields) && (showArrow))
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@ -638,62 +757,7 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
Flexible(child: _buildDateField("end"))
|
Flexible(child: _buildDateField("end"))
|
||||||
]),
|
]),
|
||||||
if ((showDateFields) && (showInputGeo))
|
if ((showDateFields) && (showInputGeo))
|
||||||
_buildSearchField(
|
_buildGeographicalZoneSearchField(),
|
||||||
controller: inputGeo,
|
|
||||||
labelText: 'Search by geographical zone',
|
|
||||||
onChanged: (value) async {
|
|
||||||
if (value.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
geographicalZone = value;
|
|
||||||
searchSuggestionsGeo(value);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.remove("city_lat");
|
|
||||||
prefs.remove("city_long");
|
|
||||||
setState(() {
|
|
||||||
inputGeo.clear();
|
|
||||||
geographicalZone = '';
|
|
||||||
suggestionsGeo.clear();
|
|
||||||
showArrow = true;
|
|
||||||
showInputSearch = true;
|
|
||||||
showInputTag = true;
|
|
||||||
});
|
|
||||||
fetchPostsByLocation();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onClear: () async {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.remove("city_lat");
|
|
||||||
prefs.remove("city_long");
|
|
||||||
setState(() {
|
|
||||||
inputGeo.clear();
|
|
||||||
geographicalZone = '';
|
|
||||||
suggestionsGeo.clear();
|
|
||||||
showArrow = true;
|
|
||||||
showInputSearch = true;
|
|
||||||
showInputTag = true;
|
|
||||||
});
|
|
||||||
fetchPostsByLocation();
|
|
||||||
},
|
|
||||||
suggestions: suggestionsGeo,
|
|
||||||
onSuggestionTap: (suggestion) async {
|
|
||||||
final latitude = suggestion['geometry']['coordinates'][1];
|
|
||||||
final longitude = suggestion['geometry']['coordinates'][0];
|
|
||||||
setState(() {
|
|
||||||
geographicalZone = suggestion['place_name'];
|
|
||||||
inputGeo.text = geographicalZone;
|
|
||||||
suggestionsGeo.clear();
|
|
||||||
showArrow = true;
|
|
||||||
showInputSearch = true;
|
|
||||||
showInputTag = true;
|
|
||||||
});
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.setDouble("city_lat", latitude);
|
|
||||||
prefs.setDouble("city_long", longitude);
|
|
||||||
await fetchPostsByLocation();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (showArrow)
|
if (showArrow)
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user