|
|
|
|
@ -26,94 +26,97 @@ class AppDrawer extends StatelessWidget {
|
|
|
|
|
return Drawer(
|
|
|
|
|
backgroundColor: AppColor.background(context),
|
|
|
|
|
width: MediaQuery.of(context).size.width * .8,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Consumer<UserProvider>(builder: (context, snapshot, _) {
|
|
|
|
|
return CircleAvatar(
|
|
|
|
|
radius: 45,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral40,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(1), // Border radius
|
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: snapshot.profileImage != null
|
|
|
|
|
? Image.file(snapshot.profileImage!)
|
|
|
|
|
: (snapshot.user?.profilePhotoName?.isNotEmpty ?? false)
|
|
|
|
|
? Image.network(snapshot.user!.profilePhotoName!)
|
|
|
|
|
: const Icon(Icons.person, size: 50, color: Colors.white),
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
top: false,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Consumer<UserProvider>(builder: (context, snapshot, _) {
|
|
|
|
|
return CircleAvatar(
|
|
|
|
|
radius: 45,
|
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral40,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(1), // Border radius
|
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: snapshot.profileImage != null
|
|
|
|
|
? Image.file(snapshot.profileImage!)
|
|
|
|
|
: (snapshot.user?.profilePhotoName?.isNotEmpty ?? false)
|
|
|
|
|
? Image.network(snapshot.user!.profilePhotoName!)
|
|
|
|
|
: const Icon(Icons.person, size: 50, color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).onPress(() => Navigator.of(context).pushNamed(ProfilePage.id)),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.clear,
|
|
|
|
|
size: 32,
|
|
|
|
|
color: context.isDark ? AppColor.primary40 : Colors.white,
|
|
|
|
|
).onPress(() => Navigator.of(context).pop())
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
(userProvider.user?.username ?? "").heading3(context).custom(fontWeight: FontWeight.w600),
|
|
|
|
|
if ((userProvider.user?.email ?? "").isNotEmpty) (userProvider.user!.email!).heading6(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
|
|
|
|
|
18.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
ListView(
|
|
|
|
|
padding: const EdgeInsets.only(top: 24),
|
|
|
|
|
children: [
|
|
|
|
|
drawerItem("drawer_notification", context.translation.notifications, context).onPress(() => Navigator.of(context).pushNamed(NotificationsPage.id)),
|
|
|
|
|
18.height,
|
|
|
|
|
// drawerItem("help_center", context.translation.helpCenter, context) /*.onPress(() => Navigator.of(context).pushNamed(HelpCenterPage.id))*/,
|
|
|
|
|
// 18.height,
|
|
|
|
|
// drawerItem("rate_us", context.translation.rateUs, context),
|
|
|
|
|
// 18.height,
|
|
|
|
|
drawerItem("setting", context.translation.settings, context).onPress(() => Navigator.of(context).pushNamed(SettingsPage.id)),
|
|
|
|
|
18.height,
|
|
|
|
|
if (userProvider.user != null && userProvider.user?.employeeIsHMG == false)
|
|
|
|
|
drawerItem("swipe", "Swipe History", context).onPress(() => Navigator.of(context).pushNamed(SwipeHistoryView.routeName)),
|
|
|
|
|
// 18.height,
|
|
|
|
|
// drawerItem("report", context.translation.reportBg, context) /*.onPress(() => Navigator.of(context).pushNamed(ReportBugPage.id))*/,
|
|
|
|
|
// 18.height,
|
|
|
|
|
// drawerItem("whats_new", context.translation.whatsNew, context),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
drawerItem("logout", context.translation.logout, context, color: context.isDark ? AppColor.redStatus(context) : AppColor.red50).onPress(() async {
|
|
|
|
|
bool result = await showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (_) => AAlertDialog(title: context.translation.signOut, content: context.translation.logoutAlert),
|
|
|
|
|
);
|
|
|
|
|
if (result) {
|
|
|
|
|
bool isSuccess = await userProvider.logout(context);
|
|
|
|
|
if (isSuccess) {
|
|
|
|
|
settingProvider.resetSettings();
|
|
|
|
|
userProvider.reset();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true);
|
|
|
|
|
);
|
|
|
|
|
}).onPress(() => Navigator.of(context).pushNamed(ProfilePage.id)),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.clear,
|
|
|
|
|
size: 32,
|
|
|
|
|
color: context.isDark ? AppColor.primary40 : Colors.white,
|
|
|
|
|
).onPress(() => Navigator.of(context).pop())
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
(userProvider.user?.username ?? "").heading3(context).custom(fontWeight: FontWeight.w600),
|
|
|
|
|
if ((userProvider.user?.email ?? "").isNotEmpty) (userProvider.user!.email!).heading6(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
|
|
|
|
|
18.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
ListView(
|
|
|
|
|
padding: const EdgeInsets.only(top: 24),
|
|
|
|
|
children: [
|
|
|
|
|
drawerItem("drawer_notification", context.translation.notifications, context).onPress(() => Navigator.of(context).pushNamed(NotificationsPage.id)),
|
|
|
|
|
18.height,
|
|
|
|
|
// drawerItem("help_center", context.translation.helpCenter, context) /*.onPress(() => Navigator.of(context).pushNamed(HelpCenterPage.id))*/,
|
|
|
|
|
// 18.height,
|
|
|
|
|
// drawerItem("rate_us", context.translation.rateUs, context),
|
|
|
|
|
// 18.height,
|
|
|
|
|
drawerItem("setting", context.translation.settings, context).onPress(() => Navigator.of(context).pushNamed(SettingsPage.id)),
|
|
|
|
|
18.height,
|
|
|
|
|
if (userProvider.user != null && userProvider.user?.employeeIsHMG == false)
|
|
|
|
|
drawerItem("swipe", "Swipe History", context).onPress(() => Navigator.of(context).pushNamed(SwipeHistoryView.routeName)),
|
|
|
|
|
// 18.height,
|
|
|
|
|
// drawerItem("report", context.translation.reportBg, context) /*.onPress(() => Navigator.of(context).pushNamed(ReportBugPage.id))*/,
|
|
|
|
|
// 18.height,
|
|
|
|
|
// drawerItem("whats_new", context.translation.whatsNew, context),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
drawerItem("logout", context.translation.logout, context, color: context.isDark ? AppColor.redStatus(context) : AppColor.red50).onPress(() async {
|
|
|
|
|
bool result = await showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (_) => AAlertDialog(title: context.translation.signOut, content: context.translation.logoutAlert),
|
|
|
|
|
);
|
|
|
|
|
if (result) {
|
|
|
|
|
bool isSuccess = await userProvider.logout(context);
|
|
|
|
|
if (isSuccess) {
|
|
|
|
|
settingProvider.resetSettings();
|
|
|
|
|
userProvider.reset();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
18.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
18.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Powered By Cloud Solutions",
|
|
|
|
|
style: AppTextStyles.heading3.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontSize: 12),
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
6.width,
|
|
|
|
|
Image.asset("assets/images/cloud_logo.png", width: 32, height: 32)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 66, start: 16, end: 24, bottom: 18),
|
|
|
|
|
}),
|
|
|
|
|
16.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
16.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Powered By Cloud Solutions",
|
|
|
|
|
style: AppTextStyles.heading3.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontSize: 12),
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
6.width,
|
|
|
|
|
Image.asset("assets/images/cloud_logo.png", width: 32, height: 32)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 66, start: 16, end: 24, bottom: 18),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|