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.
86 lines
2.2 KiB
Dart
86 lines
2.2 KiB
Dart
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import '../../routes.dart';
|
|
import 'package:flutter/material.dart';
|
|
import '../../i18n/ar.i18n.dart' as ar;
|
|
import '../../i18n/en.i18n.dart' as en;
|
|
|
|
class AppDrawer extends StatelessWidget {
|
|
ar.Ar arLang = ar.Ar();
|
|
en.En enLang = en.En();
|
|
|
|
Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
|
|
// final SharedPreferences prefs = await _prefs;
|
|
|
|
Future<void> getCounter() async {
|
|
final SharedPreferences prefs = await _prefs;
|
|
final int counter = (prefs.getInt('counter') ?? 0);
|
|
print("dddddd" + prefs.getInt('counter').toString());
|
|
// setState(() {
|
|
// prefs.setInt("counter", counter).then((bool success) {
|
|
// print(counter);
|
|
// return counter;
|
|
// // });
|
|
// });
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
print(arLang.button.save);
|
|
print(enLang.button.save);
|
|
getCounter();
|
|
return Drawer(
|
|
child: Column(
|
|
children: <Widget>[
|
|
AppBar(
|
|
title: Text('Hi form Elham!!'),
|
|
),
|
|
ListTile(
|
|
title: Text('Home'),
|
|
leading: Icon(Icons.tab),
|
|
onTap: () {
|
|
drawerNavigator(context, HOME);
|
|
},
|
|
),
|
|
Divider(),
|
|
ListTile(
|
|
title: Text('My Schedule'),
|
|
leading: Icon(Icons.tab),
|
|
onTap: () {
|
|
drawerNavigator(context, MY_SCHEDULE);
|
|
},
|
|
),
|
|
Divider(),
|
|
ListTile(
|
|
title: Text('Settings'),
|
|
leading: Icon(Icons.settings),
|
|
onTap: () {
|
|
drawerNavigator(context, SETTINGS);
|
|
},
|
|
),
|
|
Divider(),
|
|
ListTile(
|
|
title: Text('QR Reader'),
|
|
leading: Icon(Icons.photo),
|
|
onTap: () {
|
|
drawerNavigator(context, QR_READER);
|
|
},
|
|
),
|
|
Divider(),
|
|
ListTile(
|
|
title: Text('Log Out'),
|
|
leading: Icon(Icons.exit_to_app),
|
|
onTap: () {
|
|
drawerNavigator(context, LOGIN);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
drawerNavigator(context, routeName) {
|
|
Navigator.of(context).pushNamed(routeName);
|
|
}
|
|
}
|