feature/internationale #46
@@ -14,6 +14,11 @@ import '../classes/MyDrawer.dart';
|
|||||||
import '../classes/auth_service.dart';
|
import '../classes/auth_service.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.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'; //
|
||||||
|
|
||||||
// app starting point
|
// app starting point
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@@ -76,7 +81,6 @@ class _MyHomePageState extends State<ListItemOrganizers> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _fetchData() async {
|
Future<void> _fetchData() async {
|
||||||
print("Counter : ${_fetchCount}");
|
|
||||||
if (_isLoading) return;
|
if (_isLoading) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
@@ -147,7 +151,8 @@ class _MyHomePageState extends State<ListItemOrganizers> {
|
|||||||
return buildPosts(posts);
|
return buildPosts(posts);
|
||||||
} else {
|
} else {
|
||||||
// if no data, show simple Text
|
// if no data, show simple Text
|
||||||
return const Text("No data available");
|
return Text(
|
||||||
|
AppLocalizations.of(context)?.no_data ?? "No data available");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -157,12 +162,14 @@ class _MyHomePageState extends State<ListItemOrganizers> {
|
|||||||
|
|
||||||
// function to display fetched data on screen
|
// function to display fetched data on screen
|
||||||
Widget buildPosts(List<Events> posts) {
|
Widget buildPosts(List<Events> posts) {
|
||||||
|
String organizer =
|
||||||
|
AppLocalizations.of(context)?.item_organizer ?? "Organizer : ";
|
||||||
// ListView Builder to show data in a list
|
// ListView Builder to show data in a list
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
// Here we take the value from the MyHomePage object that was created by
|
||||||
// the App.build method, and use it to set our appbar title.
|
// the App.build method, and use it to set our appbar title.
|
||||||
title: Text("Organisateur : ${widget.organizer}",
|
title: Text("${organizer}${widget.organizer}",
|
||||||
overflow: TextOverflow.ellipsis),
|
overflow: TextOverflow.ellipsis),
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
|
@@ -15,6 +15,11 @@ import '../classes/MyDrawer.dart';
|
|||||||
import '../classes/auth_service.dart';
|
import '../classes/auth_service.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.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'; //
|
||||||
|
|
||||||
// app starting point
|
// app starting point
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@@ -150,7 +155,8 @@ class _MyHomePageState extends State<ListItemTags> {
|
|||||||
return buildPosts(posts);
|
return buildPosts(posts);
|
||||||
} else {
|
} else {
|
||||||
// if no data, show simple Text
|
// if no data, show simple Text
|
||||||
return const Text("No data available");
|
return Text(
|
||||||
|
AppLocalizations.of(context)?.no_data ?? "No data available");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -161,11 +167,12 @@ class _MyHomePageState extends State<ListItemTags> {
|
|||||||
// function to display fetched data on screen
|
// function to display fetched data on screen
|
||||||
Widget buildPosts(List<Events> posts) {
|
Widget buildPosts(List<Events> posts) {
|
||||||
// ListView Builder to show data in a list
|
// ListView Builder to show data in a list
|
||||||
|
String tag = AppLocalizations.of(context)?.item_tags ?? "Tags : ";
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
// Here we take the value from the MyHomePage object that was created by
|
||||||
// the App.build method, and use it to set our appbar title.
|
// the App.build method, and use it to set our appbar title.
|
||||||
title: Text("Tags : ${widget.tags}", overflow: TextOverflow.ellipsis),
|
title: Text("${tag}${widget.tags}", overflow: TextOverflow.ellipsis),
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
|
@@ -8,6 +8,11 @@ import '../pages/ForgotPassword.dart';
|
|||||||
import '../classes/alert.dart';
|
import '../classes/alert.dart';
|
||||||
import '../classes/ad_helper.dart';
|
import '../classes/ad_helper.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'; //
|
||||||
|
|
||||||
class LoginDemo extends StatefulWidget {
|
class LoginDemo extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
_LoginDemoState createState() => _LoginDemoState();
|
_LoginDemoState createState() => _LoginDemoState();
|
||||||
@@ -25,7 +30,8 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
|
|||||||
final password = inputPassword.text;
|
final password = inputPassword.text;
|
||||||
|
|
||||||
if (pseudo.isEmpty || password.isEmpty) {
|
if (pseudo.isEmpty || password.isEmpty) {
|
||||||
showAlertDialog(context, "Erreur", "Champ vide");
|
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
||||||
|
AppLocalizations.of(context)?.empty_input ?? "Empty input");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +42,8 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context, MaterialPageRoute(builder: (_) => ListItemMenu()));
|
context, MaterialPageRoute(builder: (_) => ListItemMenu()));
|
||||||
} else {
|
} else {
|
||||||
showAlertDialog(context, "Erreur", "Échec de l'authentification");
|
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
||||||
|
"Échec de l'authentification");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user