diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 416c723e..caf81827 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -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/routes.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 'package:connectivity/connectivity.dart'; +import 'dr_app_shared_pref.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -22,6 +24,8 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class Helpers { int cupertinoPickerIndex = 0; + get currentLanguage => null; + /* *@author: Elham Rababah *@Date:12/4/2020 @@ -336,11 +340,15 @@ class Helpers { } static clearSharedPref() async { + String lang = await sharedPref.getString(APP_Language); + await sharedPref.clear(); + sharedPref.setString(APP_Language, lang); } logout() async { await clearSharedPref(); + Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); } } diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index eb1a2085..3470e8ed 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -29,6 +29,7 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { bool _isInit = true; DoctorProfileModel doctorProfile; + Helpers helpers = new Helpers(); @override void didChangeDependencies() { super.didChangeDependencies(); @@ -105,9 +106,11 @@ class _AppDrawerState extends State { color: Colors.white, ), onPressed: () async { - await Helpers.clearSharedPref(); + // await Helpers.clearSharedPref(); Navigator.pop(context); - Navigator.of(context).pushNamed(LOGIN); + await helpers.logout(); + +// Navigator.of(context).pushNamed(LOGIN); }, ), ],