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(
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),
),
);
}

@ -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/views/pages/device_transfer/create__device_transfer_request.dart';
class CreateRequestTypeBottomSheet extends StatelessWidget {
final bool isEngineer;
@ -20,33 +19,36 @@ class CreateRequestTypeBottomSheet extends StatelessWidget {
Widget build(BuildContext context) {
List<CreateRequestModel> requestList = CreateRequestModel.requestsList(context, isEngineer);
return Container(
padding: const EdgeInsets.all(16.0),
width: double.infinity,
color: AppColor.background(context),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
context.translation.selectWorkOrder.heading4(context),
GridView(
padding: const EdgeInsets.only(top: 16, bottom: 16),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 16, mainAxisSpacing: 16),
children: <Widget>[
for (var request in requestList)
listCard(
context: context,
icon: request.icon,
label: request.title,
onTap: () {
Navigator.pushReplacementNamed(context, request.routeName);
},
),
],
),
],
return SafeArea(
top: false,
child: Container(
padding: const EdgeInsets.all(16.0),
width: double.infinity,
color: AppColor.background(context),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
context.translation.selectWorkOrder.heading4(context),
GridView(
padding: const EdgeInsets.only(top: 16, bottom: 0),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 16, mainAxisSpacing: 16),
children: <Widget>[
for (var request in requestList)
listCard(
context: context,
icon: request.icon,
label: request.title,
onTap: () {
Navigator.pushReplacementNamed(context, request.routeName);
},
),
],
),
],
),
),
);
return const Placeholder();
@ -64,13 +66,13 @@ class CreateRequestTypeBottomSheet extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
Icon(
Icons.add_circle,
color: AppColor.iconColor(context),
size: 32,
),
//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
Widget build(BuildContext context) {
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) {
search = SearchAllRequestsModel(
requestNumber: SearchByRequestNumberModel(context, controller: TextEditingController()),
@ -65,7 +65,6 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
context.translation.gasRefill: 2,
context.translation.transferAsset: 3,
context.translation.preventiveMaintenance: 4,
//TODO unCommit this to enable task.
context.translation.task: 6,
};
@ -73,8 +72,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
types[context.translation.recurrentWo] = 5;
}
if (!isUserFMS) {
// replace with translation
if (context.settingProvider.isUserFlowMedical) {
types['Recall and Alert'] = 7;
}
final statuses = {

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

@ -392,7 +392,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
);
if (result != null) {
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) {
widget.onChange!(widget.attachment);
@ -444,7 +444,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
if (pickedFile != null) {
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) {
widget.onChange!(widget.attachment);
}
@ -484,54 +484,98 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
context: context,
builder: (BuildContext context) {
Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
return GestureDetector(
onTap: onTap,
child: Container(
constraints: BoxConstraints(minWidth: 111.toScreenWidth, minHeight: 111.toScreenHeight),
padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 12.toScreenHeight),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(width: 1, color: AppColor.white70)),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
icon.toSvgAsset(),
24.height,
label.bodyText2(context).custom(color: AppColor.black20),
],
),
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: const Color(0xffF1F1F1), width: 1),
),
);
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(
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);
},
return SafeArea(
top: false,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Attach File".heading4(context),
12.height,
GridView(
padding: const EdgeInsets.all(0),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 12, mainAxisSpacing: 12),
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);
},
),
],
),
// 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