setup language on logout

merge-requests/139/head
hussam al-habibeh 6 years ago
parent 3ef9ca1a04
commit 5172703a32

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart';
import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
@ -9,6 +10,7 @@ import '../config/size_config.dart';
import '../util/dr_app_toast_msg.dart'; import '../util/dr_app_toast_msg.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'dr_app_shared_pref.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
@ -22,6 +24,8 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class Helpers { class Helpers {
int cupertinoPickerIndex = 0; int cupertinoPickerIndex = 0;
get currentLanguage => null;
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:12/4/2020 *@Date:12/4/2020
@ -336,11 +340,15 @@ class Helpers {
} }
static clearSharedPref() async { static clearSharedPref() async {
String lang = await sharedPref.getString(APP_Language);
await sharedPref.clear(); await sharedPref.clear();
sharedPref.setString(APP_Language, lang);
} }
logout() async { logout() async {
await clearSharedPref(); await clearSharedPref();
Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN);
} }
} }

@ -29,6 +29,7 @@ class AppDrawer extends StatefulWidget {
class _AppDrawerState extends State<AppDrawer> { class _AppDrawerState extends State<AppDrawer> {
bool _isInit = true; bool _isInit = true;
DoctorProfileModel doctorProfile; DoctorProfileModel doctorProfile;
Helpers helpers = new Helpers();
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
@ -105,9 +106,11 @@ class _AppDrawerState extends State<AppDrawer> {
color: Colors.white, color: Colors.white,
), ),
onPressed: () async { onPressed: () async {
await Helpers.clearSharedPref(); // await Helpers.clearSharedPref();
Navigator.pop(context); Navigator.pop(context);
Navigator.of(context).pushNamed(LOGIN); await helpers.logout();
// Navigator.of(context).pushNamed(LOGIN);
}, },
), ),
], ],

Loading…
Cancel
Save