bottom sheet ui improvements,safe area added.

design_3.0_TM_Module_snagsFix
Sikander Saleem 2 months ago
parent b45035a35f
commit 7efeeed619

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

@ -10,7 +10,6 @@ import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/pages/gas_refill_request_form.dart'; import 'package:test_sa/new_views/pages/gas_refill_request_form.dart';
import 'package:test_sa/views/pages/device_transfer/create__device_transfer_request.dart'; import 'package:test_sa/views/pages/device_transfer/create__device_transfer_request.dart';
class CreateRequestTypeBottomSheet extends StatelessWidget { class CreateRequestTypeBottomSheet extends StatelessWidget {
final bool isEngineer; final bool isEngineer;
@ -20,33 +19,36 @@ class CreateRequestTypeBottomSheet extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<CreateRequestModel> requestList = CreateRequestModel.requestsList(context, isEngineer); List<CreateRequestModel> requestList = CreateRequestModel.requestsList(context, isEngineer);
return Container( return SafeArea(
padding: const EdgeInsets.all(16.0), top: false,
width: double.infinity, child: Container(
color: AppColor.background(context), padding: const EdgeInsets.all(16.0),
child: Column( width: double.infinity,
mainAxisSize: MainAxisSize.min, color: AppColor.background(context),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ mainAxisSize: MainAxisSize.min,
context.translation.selectWorkOrder.heading4(context), crossAxisAlignment: CrossAxisAlignment.start,
GridView( children: [
padding: const EdgeInsets.only(top: 16, bottom: 16), context.translation.selectWorkOrder.heading4(context),
shrinkWrap: true, GridView(
physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 16, bottom: 0),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 16, mainAxisSpacing: 16), shrinkWrap: true,
children: <Widget>[ physics: const NeverScrollableScrollPhysics(),
for (var request in requestList) gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 16, mainAxisSpacing: 16),
listCard( children: <Widget>[
context: context, for (var request in requestList)
icon: request.icon, listCard(
label: request.title, context: context,
onTap: () { icon: request.icon,
Navigator.pushReplacementNamed(context, request.routeName); label: request.title,
}, onTap: () {
), Navigator.pushReplacementNamed(context, request.routeName);
], },
), ),
], ],
),
],
),
), ),
); );
return const Placeholder(); return const Placeholder();
@ -64,13 +66,13 @@ class CreateRequestTypeBottomSheet extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Icon( Icon(
Icons.add_circle, Icons.add_circle,
color: AppColor.iconColor(context), color: AppColor.iconColor(context),
size: 32, size: 32,
), ),
//24.height, //24.height,
label.bodyText2(context).custom(color:context.isDark?Colors.white: AppColor.black20), label.bodyText2(context).custom(color: context.isDark ? Colors.white : AppColor.black20),
], ],
), ),
), ),

@ -48,7 +48,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool isEngineer = (Provider.of<UserProvider>(context, listen: false).user?.type) == UsersTypes.engineer; bool isEngineer = (Provider.of<UserProvider>(context, listen: false).user?.type) == UsersTypes.engineer;
bool isUserFMS = Provider.of<SettingProvider>(context, listen: false).isUserFMS; // bool isUserFMS = Provider.of<SettingProvider>(context, listen: false).isUserFMS;
if (search == null) { if (search == null) {
search = SearchAllRequestsModel( search = SearchAllRequestsModel(
requestNumber: SearchByRequestNumberModel(context, controller: TextEditingController()), requestNumber: SearchByRequestNumberModel(context, controller: TextEditingController()),
@ -65,7 +65,6 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
context.translation.gasRefill: 2, context.translation.gasRefill: 2,
context.translation.transferAsset: 3, context.translation.transferAsset: 3,
context.translation.preventiveMaintenance: 4, context.translation.preventiveMaintenance: 4,
//TODO unCommit this to enable task.
context.translation.task: 6, context.translation.task: 6,
}; };
@ -73,8 +72,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
types[context.translation.recurrentWo] = 5; types[context.translation.recurrentWo] = 5;
} }
if (!isUserFMS) { if (context.settingProvider.isUserFlowMedical) {
// replace with translation
types['Recall and Alert'] = 7; types['Recall and Alert'] = 7;
} }
final statuses = { final statuses = {

@ -34,7 +34,6 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_provider == null) { if (_provider == null) {
bool isUserFMS = Provider.of<SettingProvider>(context, listen: false).isUserFMS;
requestsList = [ requestsList = [
Request(null, context.translation.allWorkOrder), Request(null, context.translation.allWorkOrder),
Request(1, context.translation.correctiveMaintenance), Request(1, context.translation.correctiveMaintenance),
@ -48,7 +47,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
//TODO unCommit this to enable task //TODO unCommit this to enable task
requestsList.add(Request(6, context.translation.taskRequest)); requestsList.add(Request(6, context.translation.taskRequest));
//after confirm name add this to translation... //after confirm name add this to translation...
if (!isUserFMS) { if (context.settingProvider.isUserFlowMedical) {
requestsList.add(Request(7, 'Recall and Alert')); requestsList.add(Request(7, 'Recall and Alert'));
} }

@ -392,7 +392,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
); );
if (result != null) { if (result != null) {
for (var path in result.paths) { for (var path in result.paths) {
widget.attachment.add(GenericAttachmentModel(id: 0,name: File(path!).path)); widget.attachment.add(GenericAttachmentModel(id: 0, name: File(path!).path));
} }
if (widget.onChange != null) { if (widget.onChange != null) {
widget.onChange!(widget.attachment); widget.onChange!(widget.attachment);
@ -444,7 +444,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
if (pickedFile != null) { if (pickedFile != null) {
File fileImage = File(pickedFile.path); File fileImage = File(pickedFile.path);
widget.attachment.add(GenericAttachmentModel(id: 0,name: fileImage.path)); widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path));
if (widget.onChange != null) { if (widget.onChange != null) {
widget.onChange!(widget.attachment); widget.onChange!(widget.attachment);
} }
@ -484,54 +484,98 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
Widget listCard({required String icon, required String label, required VoidCallback onTap}) { Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
return GestureDetector( return Container(
onTap: onTap, padding: const EdgeInsets.all(12),
child: Container( decoration: BoxDecoration(
constraints: BoxConstraints(minWidth: 111.toScreenWidth, minHeight: 111.toScreenHeight), color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 12.toScreenHeight), borderRadius: BorderRadius.circular(12),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(width: 1, color: AppColor.white70)), border: Border.all(color: const Color(0xffF1F1F1), width: 1),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
icon.toSvgAsset(),
24.height,
label.bodyText2(context).custom(color: AppColor.black20),
],
),
), ),
); child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
icon.toSvgAsset(color: const Color(0xff7D859A), width: 36, height: 36),
// Icon(iconData, color: const Color(0xff7D859A), size: 36),
Text(
label,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
),
],
),
).onPress(onTap);
} }
return Container( return SafeArea(
padding: const EdgeInsets.all(16.0), top: false,
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min,
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
listCard( children: [
icon: 'camera_icon', "Attach File".heading4(context),
label: '${context.translation.open}\n${context.translation.camera}', 12.height,
onTap: () { GridView(
Navigator.of(context).pop(ImageSource.camera); padding: const EdgeInsets.all(0),
}, shrinkWrap: true,
), physics: const NeverScrollableScrollPhysics(),
listCard( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 12, mainAxisSpacing: 12),
icon: 'gallery_icon', children: <Widget>[
label: '${context.translation.open}\n${context.translation.gallery}', listCard(
onTap: () { icon: 'camera_icon',
Navigator.of(context).pop(ImageSource.gallery); label: '${context.translation.open}\n${context.translation.camera}',
}, onTap: () {
), Navigator.of(context).pop(ImageSource.camera);
listCard( },
icon: 'file_icon', ),
label: '${context.translation.open}\n${context.translation.files}', listCard(
onTap: () async { icon: 'gallery_icon',
await fromFilePicker(); label: '${context.translation.open}\n${context.translation.gallery}',
Navigator.pop(context); onTap: () {
}, Navigator.of(context).pop(ImageSource.gallery);
},
),
listCard(
icon: 'file_icon',
label: '${context.translation.open}\n${context.translation.files}',
onTap: () async {
await fromFilePicker();
Navigator.pop(context);
},
),
],
), ),
// Container(
// padding: const EdgeInsets.all(16.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: <Widget>[
// listCard(
// icon: 'camera_icon',
// label: '${context.translation.open}\n${context.translation.camera}',
// onTap: () {
// Navigator.of(context).pop(ImageSource.camera);
// },
// ),
// listCard(
// icon: 'gallery_icon',
// label: '${context.translation.open}\n${context.translation.gallery}',
// onTap: () {
// Navigator.of(context).pop(ImageSource.gallery);
// },
// ),
// listCard(
// icon: 'file_icon',
// label: '${context.translation.open}\n${context.translation.files}',
// onTap: () async {
// await fromFilePicker();
// Navigator.pop(context);
// },
// ),
// ],
// ),
// ),
], ],
), ).paddingAll(16),
); );
}, },
); );

Loading…
Cancel
Save