|
|
|
|
@ -18,6 +18,10 @@ import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class AppDrawer extends StatefulWidget {
|
|
|
|
|
final Function onLanguageChange;
|
|
|
|
|
|
|
|
|
|
AppDrawer({required this.onLanguageChange});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_AppDrawerState createState() => _AppDrawerState();
|
|
|
|
|
}
|
|
|
|
|
@ -65,6 +69,28 @@ class _AppDrawerState extends State<AppDrawer> {
|
|
|
|
|
).expanded
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 14, right: 14, top: 21, bottom: 21),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
|
|
|
|
|
context.setLocale(const Locale("en", "US"));
|
|
|
|
|
postLanguageChange(context);
|
|
|
|
|
}),
|
|
|
|
|
Container(
|
|
|
|
|
width: 1,
|
|
|
|
|
color: MyColors.darkWhiteColor,
|
|
|
|
|
height: 16,
|
|
|
|
|
margin: const EdgeInsets.only(left: 10, right: 10),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
|
|
|
|
|
context.setLocale(const Locale("ar", "SA"));
|
|
|
|
|
postLanguageChange(context);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 14, right: 14, bottom: 14),
|
|
|
|
|
const Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
@ -132,6 +158,14 @@ class _AppDrawerState extends State<AppDrawer> {
|
|
|
|
|
: onPress!);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void postLanguageChange(BuildContext context) {
|
|
|
|
|
var obj = AppState().postParamsObject;
|
|
|
|
|
obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
|
|
|
|
|
AppState().setPostParamsModel(obj!);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
widget.onLanguageChange();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void performLogout() async {
|
|
|
|
|
AppState().isAuthenticated = false;
|
|
|
|
|
AppState().isLogged = false;
|
|
|
|
|
|