ItemMenu 100%
This commit is contained in:
@@ -94,5 +94,11 @@
|
||||
"email_sent": "Email has been sent",
|
||||
"forgot_password": "Forgot password",
|
||||
"enter_email": "Enter the email",
|
||||
"send_email": "Send email"
|
||||
"send_email": "Send email",
|
||||
"invalid_cache": "Invalid cache",
|
||||
"item_date": "Date : ",
|
||||
"item_maps": "Maps : ",
|
||||
"item_organizer": "Organizer : ",
|
||||
"item_description": "Description : ",
|
||||
"item_tags": "Tags : "
|
||||
}
|
@@ -94,5 +94,11 @@
|
||||
"email_sent": "Email a été envoyé",
|
||||
"forgot_password": "Mot de passe oublié",
|
||||
"enter_email": "Entrez l'email",
|
||||
"send_email": "Send email"
|
||||
"send_email": "Send email",
|
||||
"invalid_cache": "Cache invalide",
|
||||
"item_date": "Date : ",
|
||||
"item_maps": "Carte : ",
|
||||
"item_organizer": "Organisateurs : ",
|
||||
"item_description": "Description : ",
|
||||
"item_tags": "Tags : "
|
||||
}
|
@@ -25,6 +25,11 @@ import '../classes/ad_helper.dart';
|
||||
import 'package:google_mobile_ads/google_mobile_ads.dart';
|
||||
import '../classes/auth_service.dart';
|
||||
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../locale_provider.dart'; //
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await MobileAds.instance.initialize();
|
||||
@@ -109,7 +114,8 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
final accessToken = prefs.getString("access_token") ?? "";
|
||||
|
||||
if (accessToken.isEmpty) {
|
||||
showAlertDialog(context, "Erreur serveur", "Cache invalide");
|
||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
||||
AppLocalizations.of(context)?.invalid_cache ?? "Invalid cache");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,11 +125,8 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
headers: {HttpHeaders.cookieHeader: 'access_token=$accessToken'},
|
||||
);
|
||||
|
||||
stderr.writeln('Response Get status: ${responseGet.statusCode}');
|
||||
|
||||
if (responseGet.statusCode == 200) {
|
||||
final responseBody = utf8.decode(responseGet.bodyBytes);
|
||||
stderr.writeln('Username : $responseBody');
|
||||
|
||||
final event = Events.fromJson(jsonDecode(responseBody));
|
||||
|
||||
@@ -147,18 +150,23 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
tags = List<String>.from(event.tags ?? []);
|
||||
});
|
||||
} 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 messages = {
|
||||
400: AppLocalizations.of(context)?.request_error ??
|
||||
"Poorly constructed query",
|
||||
406: AppLocalizations.of(context)?.incorrect_password ??
|
||||
"Incorrect password",
|
||||
404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user",
|
||||
403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user",
|
||||
410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token",
|
||||
500: AppLocalizations.of(context)?.internal_error_server ??
|
||||
"Internal error server"
|
||||
};
|
||||
|
||||
final errorMessage = errorMessages[responseGet.statusCode] ??
|
||||
"Problème d'authentification inconnu";
|
||||
showAlertDialog(context, "Erreur serveur", errorMessage);
|
||||
final errorMessage = messages[responseGet.statusCode] ??
|
||||
AppLocalizations.of(context)?.unknown_error_auth ??
|
||||
"Unknown error auth";
|
||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
||||
errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +231,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
Row(children: [
|
||||
Icon(Icons.event),
|
||||
Text(
|
||||
"Date : ",
|
||||
AppLocalizations.of(context)?.item_date ?? "Date : ",
|
||||
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
|
||||
)
|
||||
]),
|
||||
@@ -237,7 +245,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
Row(children: [
|
||||
Icon(Icons.explore),
|
||||
Text(
|
||||
"Carte : ",
|
||||
AppLocalizations.of(context)?.item_maps ?? "Maps : ",
|
||||
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
|
||||
)
|
||||
]),
|
||||
@@ -260,7 +268,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
Row(children: [
|
||||
Icon(Icons.group),
|
||||
Text(
|
||||
"Organisateurs : ",
|
||||
AppLocalizations.of(context)?.item_organizer ?? "Organizers : ",
|
||||
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
|
||||
)
|
||||
]),
|
||||
@@ -313,7 +321,9 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
]),
|
||||
Row(children: [
|
||||
Icon(Icons.description),
|
||||
Text("Description : ",
|
||||
Text(
|
||||
AppLocalizations.of(context)?.item_description ??
|
||||
"Description : ",
|
||||
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold))
|
||||
]),
|
||||
Row(children: [
|
||||
@@ -325,7 +335,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
]),
|
||||
Row(children: [
|
||||
Icon(Icons.category),
|
||||
Text("Tags : ",
|
||||
Text(AppLocalizations.of(context)?.item_tags ?? "Tags : ",
|
||||
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold))
|
||||
]),
|
||||
Row(
|
||||
@@ -394,7 +404,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.blue,
|
||||
tooltip: 'Recherche',
|
||||
tooltip: AppLocalizations.of(context)?.search ?? 'Search',
|
||||
child: const Icon(Icons.edit, color: Colors.white),
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user