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.
49 lines
1.7 KiB
Dart
49 lines
1.7 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_style/app_themes.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: TranslationKeys.login,
|
|
onPressed: () async {
|
|
// 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();
|
|
}
|
|
}),
|
|
Switch.adaptive(
|
|
value: context.isDark,
|
|
onChanged: (dark) {
|
|
Provider.of<SettingProvider>(context, listen: false).setTheme(dark ? AppThemes.darkTheme : AppThemes.lightTheme);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|