bottomsheet fixes

main_production_upgrade
WaseemAbbasi22 1 week ago
parent b94d5d1fbd
commit 765115390f

@ -67,7 +67,7 @@ class _InspectionPersonBottomSheetState extends State<InspectionPersonBottomShee
top: 16,
left: 16,
right: 16,
bottom: MediaQuery.of(context).viewInsets.bottom,
bottom: MediaQuery.of(context).viewInsets.bottom+MediaQuery.of(context).padding.bottom,
),
child: Column(
mainAxisSize: MainAxisSize.min,

@ -46,7 +46,12 @@ class _DemoExtensionBottomSheetState extends State<DemoExtensionBottomSheet> {
topLeft: Radius.circular(30),
),
),
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
padding: EdgeInsets.only(
left: 16.toScreenWidth,
right: 16.toScreenWidth,
top: 8.toScreenHeight,
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
),
child: SafeArea(
child: Form(
key: _formKey,
@ -93,7 +98,7 @@ class _DemoExtensionBottomSheetState extends State<DemoExtensionBottomSheet> {
textColor: AppColor.black10,
loading: false,
onPressed: () async {
Navigator.pop(context,false);
Navigator.pop(context, false);
},
).expanded,
16.width,

@ -423,6 +423,7 @@ class SwipeGeneralUtils {
showModalBottomSheet(
context: context,
useSafeArea: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
@ -430,22 +431,28 @@ class SwipeGeneralUtils {
),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
clipBehavior: Clip.antiAliasWithSaveLayer,
builder: (BuildContext context) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
context.translation.markAttendance.heading4(context).custom(color:context.isDark?AppColor.white50: AppColor.white936),
8.height,
context.translation.selectMethodToMarkAttendance.bodyText2(context).custom(color: AppColor.neutral120),
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: availableAttendanceMethodList(context: context, userProvider: _userProvider, isNfcSupported: isNfcSupported)),
],
).paddingAll(16),
builder: (BuildContext context) =>Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom +
MediaQuery.of(context).padding.bottom,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
context.translation.markAttendance.heading4(context).custom(color:context.isDark?AppColor.white50: AppColor.white936),
8.height,
context.translation.selectMethodToMarkAttendance.bodyText2(context).custom(color: AppColor.neutral120),
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: availableAttendanceMethodList(context: context, userProvider: _userProvider, isNfcSupported: isNfcSupported)),
],
).paddingAll(16),
),
);
}

@ -53,7 +53,12 @@ class _AddSupplierEngineerBottomSheetState extends State<AddSupplierEngineerBott
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)),
),
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
padding: EdgeInsets.only(
left: 16.toScreenWidth,
right: 16.toScreenHeight,
top: 8.toScreenHeight,
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
),
child: Form(
key: _formKey,
child: SingleChildScrollView(

@ -44,85 +44,90 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
AppTextFormField(
labelText: "Email",
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uEmail,
textAlign: TextAlign.center,
hintText: "email@example.com",
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: AppTextStyles.textFieldLabelStyle,
textInputType: TextInputType.emailAddress,
showShadow: false,
onChange: (value) {
email = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
12.height,
AppTextFormField(
labelText: "Phone Number",
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uPhoneNo,
textAlign: TextAlign.center,
hintText: "05xxxxxxxx",
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: AppTextStyles.textFieldLabelStyle,
textInputType: TextInputType.phone,
showShadow: false,
onChange: (value) {
phoneNo = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
12.height,
AppTextFormField(
labelText: "Extension No",
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uExtensionNo,
textAlign: TextAlign.center,
hintText: "1234",
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: AppTextStyles.textFieldLabelStyle,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
extensionNo = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
12.height,
AppFilledButton(
label: "Update",
buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50,
onPressed: () async {
FocusManager.instance.primaryFocus!.unfocus();
if (email.isEmpty || !Validator.isEmail(email)) {
"Please enter valid email".showToast;
return;
}
if (phoneNo.isEmpty || phoneNo.length != 10) {
"Please enter valid phone number".showToast;
return;
}
if (extensionNo.isEmpty) {
"Please enter extension".showToast;
return;
}
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
bool status = await context.userProvider.updateContactInfo(widget.userID, email, phoneNo, extensionNo);
Navigator.pop(context);
if (status) {
return Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
AppTextFormField(
labelText: "Email",
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uEmail,
textAlign: TextAlign.center,
hintText: "email@example.com",
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: AppTextStyles.textFieldLabelStyle,
textInputType: TextInputType.emailAddress,
showShadow: false,
onChange: (value) {
email = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
12.height,
AppTextFormField(
labelText: "Phone Number",
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uPhoneNo,
textAlign: TextAlign.center,
hintText: "05xxxxxxxx",
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: AppTextStyles.textFieldLabelStyle,
textInputType: TextInputType.phone,
showShadow: false,
onChange: (value) {
phoneNo = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
12.height,
AppTextFormField(
labelText: "Extension No",
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uExtensionNo,
textAlign: TextAlign.center,
hintText: "1234",
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: AppTextStyles.textFieldLabelStyle,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
extensionNo = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
12.height,
AppFilledButton(
label: "Update",
buttonColor: context.isDark ? AppColor.primary10 : AppColor.neutral50,
onPressed: () async {
FocusManager.instance.primaryFocus!.unfocus();
if (email.isEmpty || !Validator.isEmail(email)) {
"Please enter valid email".showToast;
return;
}
if (phoneNo.isEmpty || phoneNo.length != 10) {
"Please enter valid phone number".showToast;
return;
}
if (extensionNo.isEmpty) {
"Please enter extension".showToast;
return;
}
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
bool status = await context.userProvider.updateContactInfo(widget.userID, email, phoneNo, extensionNo);
Navigator.pop(context);
widget.onUpdate(email, phoneNo, extensionNo);
}
},
),
],
if (status) {
Navigator.pop(context);
widget.onUpdate(email, phoneNo, extensionNo);
}
},
),
],
),
);
}
}

@ -14,70 +14,76 @@ class AssetDetailBottomSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
(asset?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-").heading5(context),
16.height,
AspectRatio(
aspectRatio: 358 / 136,
child: Container(
width: 95,
height: 95,
decoration: ShapeDecoration(
color: AppColor.neutral30,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(asset?.assetPhoto != null ? URLs.getFileUrl(asset!.assetPhoto)! : "https://www.lasteelcraft.com/images/no-image-available.png"),
)),
),
),
16.height,
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"${context.translation.assetNo}: ${asset!.assetNumber}".bodyText(context),
"${context.translation.modelName}: ${asset!.modelDefinition?.modelName}".bodyText(context),
"${context.translation.supplier}: ${asset!.supplier?.suppliername?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.manufacture}: ${asset!.modelDefinition?.manufacturerName?.cleanupWhitespace.capitalizeFirstOfEach}".bodyText(context),
//"${context.translation.location}: ${assetModel.site.custName?.cleanupWhitespace?.capitalizeFirstOfEach}".bodyText(context),
],
).expanded,
8.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"${context.translation.snNo}: ${asset!.assetSerialNo}".bodyText(context),
"${context.translation.site}: ${asset?.site?.custName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.building}: ${asset?.building?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.floor}: ${asset?.floor?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.md}: ${asset?.department?.departmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.room}: ${asset?.room?.name ?? "-"}".bodyText(context),
],
).expanded,
],
return Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom +
MediaQuery.of(context).padding.bottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
(asset?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-").heading5(context),
16.height,
AspectRatio(
aspectRatio: 358 / 136,
child: Container(
width: 95,
height: 95,
decoration: ShapeDecoration(
color: AppColor.neutral30,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(asset?.assetPhoto != null ? URLs.getFileUrl(asset!.assetPhoto)! : "https://www.lasteelcraft.com/images/no-image-available.png"),
)),
),
8.height,
if ((asset?.modelDefinition?.assetDescription ?? "").isNotEmpty) ...[
8.height,
const Divider(color: AppColor.neutral30, height: 1, thickness: 1),
),
16.height,
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"${context.translation.assetNo}: ${asset!.assetNumber}".bodyText(context),
"${context.translation.modelName}: ${asset!.modelDefinition?.modelName}".bodyText(context),
"${context.translation.supplier}: ${asset!.supplier?.suppliername?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.manufacture}: ${asset!.modelDefinition?.manufacturerName?.cleanupWhitespace.capitalizeFirstOfEach}".bodyText(context),
//"${context.translation.location}: ${assetModel.site.custName?.cleanupWhitespace?.capitalizeFirstOfEach}".bodyText(context),
],
).expanded,
8.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"${context.translation.snNo}: ${asset!.assetSerialNo}".bodyText(context),
"${context.translation.site}: ${asset?.site?.custName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.building}: ${asset?.building?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.floor}: ${asset?.floor?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.md}: ${asset?.department?.departmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}".bodyText(context),
"${context.translation.room}: ${asset?.room?.name ?? "-"}".bodyText(context),
],
).expanded,
],
),
8.height,
asset!.modelDefinition!.assetDescription!.bodyText(context),
]
],
)
],
).paddingAll(16);
if ((asset?.modelDefinition?.assetDescription ?? "").isNotEmpty) ...[
8.height,
const Divider(color: AppColor.neutral30, height: 1, thickness: 1),
8.height,
asset!.modelDefinition!.assetDescription!.bodyText(context),
]
],
)
],
).paddingAll(16),
);
}
}

@ -17,7 +17,12 @@ class PendingRequestBottomSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(21),
padding: EdgeInsets.only(
left: 21,
right: 21,
top: 12,
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,

@ -41,60 +41,65 @@ class _RejectionReasonBottomSheetState extends State<RejectionReasonBottomSheet>
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SingleItemDropDownMenu<Lookup, RejectReasonProvider>(
context: context,
title: context.translation.reason,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
onSelect: (value) {
selectedReason = value;
},
),
12.height,
AppTextFormField(
backgroundColor: AppColor.fieldBgColor(context),
labelText: context.translation.comments,
controller: _commentController,
textInputType: TextInputType.multiline,
alignLabelWithHint: true,
showSpeechToText: true,
showShadow: false,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)),
labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)),
floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)),
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
),
16.height,
AppFilledButton(
label: context.translation.reject,
buttonColor: AppColor.red30,
onPressed: () async {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
Utils.showLoading(context);
bool isSuccess = await widget.onRejectPressed(selectedReason!.id!, _commentController.text);
Utils.hideLoading(context);
if (isSuccess) {
Navigator.of(context).pop();
widget.onRefreshed?.call();
child: Padding(
padding: EdgeInsetsGeometry.only(
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SingleItemDropDownMenu<Lookup, RejectReasonProvider>(
context: context,
title: context.translation.reason,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
onSelect: (value) {
selectedReason = value;
},
),
12.height,
AppTextFormField(
backgroundColor: AppColor.fieldBgColor(context),
labelText: context.translation.comments,
controller: _commentController,
textInputType: TextInputType.multiline,
alignLabelWithHint: true,
showSpeechToText: true,
showShadow: false,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)),
labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)),
floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)),
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
),
16.height,
AppFilledButton(
label: context.translation.reject,
buttonColor: AppColor.red30,
onPressed: () async {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
Utils.showLoading(context);
bool isSuccess = await widget.onRejectPressed(selectedReason!.id!, _commentController.text);
Utils.hideLoading(context);
if (isSuccess) {
Navigator.of(context).pop();
widget.onRefreshed?.call();
}
}
}
},
),
16.height,
],
},
),
16.height,
],
),
),
);
}

@ -91,7 +91,7 @@ class _RequestApprovalBottomState extends State<RequestApprovalBottomSheet> {
color: AppColor.background(context),
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)),
),
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 24.toScreenHeight),
padding: EdgeInsets.only(right: 16.toScreenWidth, left: 16.toScreenWidth, top: 24.toScreenHeight, bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,

Loading…
Cancel
Save