edit drawer

main_design2.0
zaid_daoud 2 years ago
parent f64d5a0613
commit ae9ac5e1ff

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
@ -23,6 +22,7 @@ class AppDrawer extends StatelessWidget {
final settingProvider = Provider.of<SettingProvider>(context, listen: false); final settingProvider = Provider.of<SettingProvider>(context, listen: false);
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
return Drawer( return Drawer(
backgroundColor: AppColor.background(context),
width: MediaQuery.of(context).size.width * .8, width: MediaQuery.of(context).size.width * .8,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -35,7 +35,7 @@ class AppDrawer extends StatelessWidget {
Consumer<UserProvider>(builder: (context, snapshot, _) { Consumer<UserProvider>(builder: (context, snapshot, _) {
return CircleAvatar( return CircleAvatar(
radius: 45, radius: 45,
backgroundColor: const Color(0xFFE4E5E6), backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral40,
child: Padding( child: Padding(
padding: const EdgeInsets.all(1), // Border radius padding: const EdgeInsets.all(1), // Border radius
child: ClipOval( child: ClipOval(
@ -52,24 +52,19 @@ class AppDrawer extends StatelessWidget {
), ),
); );
}).onPress(() => Navigator.of(context).pushNamed(ProfilePage.id)), }).onPress(() => Navigator.of(context).pushNamed(ProfilePage.id)),
const Icon(Icons.clear).onPress(() => Navigator.of(context).pop()) Icon(
Icons.clear,
size: 32,
color: context.isDark ? AppColor.primary40 : Colors.white,
).onPress(() => Navigator.of(context).pop())
], ],
), ),
8.height, 8.height,
(userProvider.user?.username ?? "").heading3(context).custom(fontWeight: FontWeight.w600), (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), if ((userProvider.user?.email ?? "").isNotEmpty) (userProvider.user?.email)?.heading6(context)?.custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
18.height, 18.height,
const Divider().defaultStyle(context), const Divider().defaultStyle(context),
ListView( ListView(
// "settings" : " Settings",
// "ReportBug " : "Report a bug",
// "whatsNew" : "What's New",
// "logout" : "Logout"
// "settings" : " الاعدادات",
// "ReportBug " "ابلاغ عن خطا",
// "whatsNew" : "ماهو الجديد",
// "logout" : "خروج"
padding: const EdgeInsets.only(top: 24), padding: const EdgeInsets.only(top: 24),
children: [ children: [
drawerItem("drawer_notification", context.translation.notifications, context).onPress(() => Navigator.of(context).pushNamed(NotificationsPage.id)), drawerItem("drawer_notification", context.translation.notifications, context).onPress(() => Navigator.of(context).pushNamed(NotificationsPage.id)),
@ -85,7 +80,7 @@ class AppDrawer extends StatelessWidget {
// drawerItem("whats_new", context.translation.whatsNew, context), // drawerItem("whats_new", context.translation.whatsNew, context),
], ],
).expanded, ).expanded,
drawerItem("logout", context.translation.logout, context, color: AppColor.red50).onPress(() async { drawerItem("logout", context.translation.logout, context, color: AppColor.redStatus(context)).onPress(() async {
bool result = await showDialog( bool result = await showDialog(
context: context, context: context,
builder: (_) => AAlertDialog(title: context.translation.signOut, content: context.translation.logoutAlert), builder: (_) => AAlertDialog(title: context.translation.signOut, content: context.translation.logoutAlert),
@ -106,7 +101,7 @@ class AppDrawer extends StatelessWidget {
children: [ children: [
Text( Text(
"Powered By Cloud Solutions", "Powered By Cloud Solutions",
style: Theme.of(context).textTheme.headline6.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.neutral10 : AppColor.neutral50, fontSize: 12), style: AppTextStyles.heading3.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontSize: 12),
textScaleFactor: AppStyle.getScaleFactor(context), textScaleFactor: AppStyle.getScaleFactor(context),
), ),
6.width, 6.width,
@ -121,18 +116,11 @@ class AppDrawer extends StatelessWidget {
Widget drawerItem(String icon, String title, BuildContext context, {Color color}) { Widget drawerItem(String icon, String title, BuildContext context, {Color color}) {
return Row( return Row(
children: [ children: [
SvgPicture.asset( (icon ?? "").toSvgAsset(width: 24, height: 24, color: color ?? (context.isDark ? AppColor.neutral10 : AppColor.neutral20)),
"assets/images/$icon.svg",
color: color ?? const Color(0xFF757575),
width: 24,
height: 24,
),
16.width, 16.width,
Text( Text(
title, title,
style: AppTextStyles.heading6.copyWith( style: AppTextStyles.heading6.copyWith(color: color ?? (context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
color: context.isDark ? AppColor.neutral10 : AppColor.neutral50,
),
), ),
], ],
); );

Loading…
Cancel
Save