You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.2 KiB
Dart
68 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
import '../../controllers/providers/api/user_provider.dart';
|
|
import '../../controllers/providers/settings/setting_provider.dart';
|
|
import '../../models/enums/translation_keys.dart';
|
|
import 'app_filled_button.dart';
|
|
|
|
class AppDrawer extends StatelessWidget {
|
|
const AppDrawer({Key key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final settingProvider = Provider.of<SettingProvider>(context, listen: false);
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
return Drawer(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppFilledButton(
|
|
label: context.translation.login,
|
|
onPressed: () async {
|
|
/// TODO [zaid] : show dialog before logout
|
|
// bool result = await showDialog(
|
|
// context: context,
|
|
// builder: (_) => const AAlertDialog(
|
|
// title: "_subtitle.signOut",
|
|
// content: "_subtitle.signOutAlert",
|
|
// ),
|
|
// );
|
|
if (true) {
|
|
settingProvider.resetSettings();
|
|
userProvider.reset();
|
|
Navigator.of(context).pop();
|
|
Navigator.of(context).pop();
|
|
}
|
|
}),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Text("Dark"),
|
|
Switch.adaptive(
|
|
value: context.isDark,
|
|
onChanged: (value) {
|
|
settingProvider.setDarkTheme(value);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Text("Arabic"),
|
|
Switch.adaptive(
|
|
value: settingProvider.language == "ar",
|
|
onChanged: (value) {
|
|
settingProvider.setLanguage(value ? "ar" : "en");
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|