bottomsheet fixes

main_production_upgrade
WaseemAbbasi22 1 week ago
parent b94d5d1fbd
commit 765115390f

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

@ -46,7 +46,12 @@ class _DemoExtensionBottomSheetState extends State<DemoExtensionBottomSheet> {
topLeft: Radius.circular(30), 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: SafeArea(
child: Form( child: Form(
key: _formKey, key: _formKey,
@ -93,7 +98,7 @@ class _DemoExtensionBottomSheetState extends State<DemoExtensionBottomSheet> {
textColor: AppColor.black10, textColor: AppColor.black10,
loading: false, loading: false,
onPressed: () async { onPressed: () async {
Navigator.pop(context,false); Navigator.pop(context, false);
}, },
).expanded, ).expanded,
16.width, 16.width,

@ -423,6 +423,7 @@ class SwipeGeneralUtils {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
useSafeArea: true,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
top: Radius.circular(20), top: Radius.circular(20),
@ -430,22 +431,28 @@ class SwipeGeneralUtils {
), ),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
clipBehavior: Clip.antiAliasWithSaveLayer, clipBehavior: Clip.antiAliasWithSaveLayer,
builder: (BuildContext context) => Column( builder: (BuildContext context) =>Padding(
mainAxisSize: MainAxisSize.min, padding: EdgeInsets.only(
crossAxisAlignment: CrossAxisAlignment.start, bottom: MediaQuery.of(context).viewInsets.bottom +
children: [ MediaQuery.of(context).padding.bottom,
context.translation.markAttendance.heading4(context).custom(color:context.isDark?AppColor.white50: AppColor.white936), ),
8.height, child: Column(
context.translation.selectMethodToMarkAttendance.bodyText2(context).custom(color: AppColor.neutral120), mainAxisSize: MainAxisSize.min,
12.height, crossAxisAlignment: CrossAxisAlignment.start,
GridView( children: [
padding: const EdgeInsets.all(0), context.translation.markAttendance.heading4(context).custom(color:context.isDark?AppColor.white50: AppColor.white936),
shrinkWrap: true, 8.height,
physics: const NeverScrollableScrollPhysics(), context.translation.selectMethodToMarkAttendance.bodyText2(context).custom(color: AppColor.neutral120),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 12, mainAxisSpacing: 12), 12.height,
children: availableAttendanceMethodList(context: context, userProvider: _userProvider, isNfcSupported: isNfcSupported)), GridView(
], padding: const EdgeInsets.all(0),
).paddingAll(16), 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, color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)), 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( child: Form(
key: _formKey, key: _formKey,
child: SingleChildScrollView( child: SingleChildScrollView(

@ -44,85 +44,90 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.only(
mainAxisSize: MainAxisSize.min, bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
children: [ ),
AppTextFormField( child: Column(
labelText: "Email", crossAxisAlignment: CrossAxisAlignment.start,
backgroundColor: AppColor.fieldBgColor(context), mainAxisSize: MainAxisSize.min,
initialValue: widget.uEmail, children: [
textAlign: TextAlign.center, AppTextFormField(
hintText: "email@example.com", labelText: "Email",
labelStyle: AppTextStyles.textFieldLabelStyle, backgroundColor: AppColor.fieldBgColor(context),
hintStyle: AppTextStyles.textFieldLabelStyle, initialValue: widget.uEmail,
textInputType: TextInputType.emailAddress, textAlign: TextAlign.center,
showShadow: false, hintText: "email@example.com",
onChange: (value) { labelStyle: AppTextStyles.textFieldLabelStyle,
email = value; hintStyle: AppTextStyles.textFieldLabelStyle,
}, textInputType: TextInputType.emailAddress,
style: Theme.of(context).textTheme.titleMedium, showShadow: false,
), onChange: (value) {
12.height, email = value;
AppTextFormField( },
labelText: "Phone Number", style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context), ),
initialValue: widget.uPhoneNo, 12.height,
textAlign: TextAlign.center, AppTextFormField(
hintText: "05xxxxxxxx", labelText: "Phone Number",
labelStyle: AppTextStyles.textFieldLabelStyle, backgroundColor: AppColor.fieldBgColor(context),
hintStyle: AppTextStyles.textFieldLabelStyle, initialValue: widget.uPhoneNo,
textInputType: TextInputType.phone, textAlign: TextAlign.center,
showShadow: false, hintText: "05xxxxxxxx",
onChange: (value) { labelStyle: AppTextStyles.textFieldLabelStyle,
phoneNo = value; hintStyle: AppTextStyles.textFieldLabelStyle,
}, textInputType: TextInputType.phone,
style: Theme.of(context).textTheme.titleMedium, showShadow: false,
), onChange: (value) {
12.height, phoneNo = value;
AppTextFormField( },
labelText: "Extension No", style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context), ),
initialValue: widget.uExtensionNo, 12.height,
textAlign: TextAlign.center, AppTextFormField(
hintText: "1234", labelText: "Extension No",
labelStyle: AppTextStyles.textFieldLabelStyle, backgroundColor: AppColor.fieldBgColor(context),
hintStyle: AppTextStyles.textFieldLabelStyle, initialValue: widget.uExtensionNo,
textInputType: const TextInputType.numberWithOptions(decimal: true), textAlign: TextAlign.center,
showShadow: false, hintText: "1234",
onChange: (value) { labelStyle: AppTextStyles.textFieldLabelStyle,
extensionNo = value; hintStyle: AppTextStyles.textFieldLabelStyle,
}, textInputType: const TextInputType.numberWithOptions(decimal: true),
style: Theme.of(context).textTheme.titleMedium, showShadow: false,
), onChange: (value) {
12.height, extensionNo = value;
AppFilledButton( },
label: "Update", style: Theme.of(context).textTheme.titleMedium,
buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50, ),
onPressed: () async { 12.height,
FocusManager.instance.primaryFocus!.unfocus(); AppFilledButton(
if (email.isEmpty || !Validator.isEmail(email)) { label: "Update",
"Please enter valid email".showToast; buttonColor: context.isDark ? AppColor.primary10 : AppColor.neutral50,
return; onPressed: () async {
} FocusManager.instance.primaryFocus!.unfocus();
if (phoneNo.isEmpty || phoneNo.length != 10) { if (email.isEmpty || !Validator.isEmail(email)) {
"Please enter valid phone number".showToast; "Please enter valid email".showToast;
return; return;
} }
if (extensionNo.isEmpty) { if (phoneNo.isEmpty || phoneNo.length != 10) {
"Please enter extension".showToast; "Please enter valid phone number".showToast;
return; return;
} }
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); if (extensionNo.isEmpty) {
bool status = await context.userProvider.updateContactInfo(widget.userID, email, phoneNo, extensionNo); "Please enter extension".showToast;
Navigator.pop(context); return;
if (status) { }
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
bool status = await context.userProvider.updateContactInfo(widget.userID, email, phoneNo, extensionNo);
Navigator.pop(context); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.only(
mainAxisSize: MainAxisSize.min, bottom: MediaQuery.of(context).viewInsets.bottom +
children: [ MediaQuery.of(context).padding.bottom,
(asset?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-").heading5(context), ),
16.height, child: Column(
AspectRatio( crossAxisAlignment: CrossAxisAlignment.start,
aspectRatio: 358 / 136, mainAxisSize: MainAxisSize.min,
child: Container( children: [
width: 95, (asset?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-").heading5(context),
height: 95, 16.height,
decoration: ShapeDecoration( AspectRatio(
color: AppColor.neutral30, aspectRatio: 358 / 136,
shape: RoundedRectangleBorder( child: Container(
borderRadius: BorderRadius.circular(10), width: 95,
), height: 95,
image: DecorationImage( decoration: ShapeDecoration(
fit: BoxFit.cover, color: AppColor.neutral30,
image: NetworkImage(asset?.assetPhoto != null ? URLs.getFileUrl(asset!.assetPhoto)! : "https://www.lasteelcraft.com/images/no-image-available.png"), shape: RoundedRectangleBorder(
)), borderRadius: BorderRadius.circular(10),
), ),
), image: DecorationImage(
16.height, fit: BoxFit.cover,
Column( image: NetworkImage(asset?.assetPhoto != null ? URLs.getFileUrl(asset!.assetPhoto)! : "https://www.lasteelcraft.com/images/no-image-available.png"),
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, ),
if ((asset?.modelDefinition?.assetDescription ?? "").isNotEmpty) ...[ 16.height,
8.height, Column(
const Divider(color: AppColor.neutral30, height: 1, thickness: 1), 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, 8.height,
asset!.modelDefinition!.assetDescription!.bodyText(context), 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); ]
],
)
],
).paddingAll(16),
);
} }
} }

@ -17,7 +17,12 @@ class PendingRequestBottomSheet extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( 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( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

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

Loading…
Cancel
Save