diff --git a/lib/modules/asset_delivery_module/pages/delivery_inspection/inpection_bottomsheet.dart b/lib/modules/asset_delivery_module/pages/delivery_inspection/inpection_bottomsheet.dart index de928263..34aad6d3 100644 --- a/lib/modules/asset_delivery_module/pages/delivery_inspection/inpection_bottomsheet.dart +++ b/lib/modules/asset_delivery_module/pages/delivery_inspection/inpection_bottomsheet.dart @@ -67,7 +67,7 @@ class _InspectionPersonBottomSheetState extends State { 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 { textColor: AppColor.black10, loading: false, onPressed: () async { - Navigator.pop(context,false); + Navigator.pop(context, false); }, ).expanded, 16.width, diff --git a/lib/new_views/swipe_module/utils/swipe_general_utils.dart b/lib/new_views/swipe_module/utils/swipe_general_utils.dart index cadd8ea0..ded2daa6 100644 --- a/lib/new_views/swipe_module/utils/swipe_general_utils.dart +++ b/lib/new_views/swipe_module/utils/swipe_general_utils.dart @@ -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), + ), ); } diff --git a/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart b/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart index fbc606dc..80aa0a6b 100644 --- a/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart +++ b/lib/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart @@ -53,7 +53,12 @@ class _AddSupplierEngineerBottomSheetState extends State 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); + } + }, + ), + ], + ), ); } } diff --git a/lib/views/widgets/bottom_sheets/asset_detail_bottom_sheet.dart b/lib/views/widgets/bottom_sheets/asset_detail_bottom_sheet.dart index 3f7206af..c0192cd1 100644 --- a/lib/views/widgets/bottom_sheets/asset_detail_bottom_sheet.dart +++ b/lib/views/widgets/bottom_sheets/asset_detail_bottom_sheet.dart @@ -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), + ); } } diff --git a/lib/views/widgets/bottom_sheets/pending_request_bottom_sheet.dart b/lib/views/widgets/bottom_sheets/pending_request_bottom_sheet.dart index 84b98782..65dca268 100644 --- a/lib/views/widgets/bottom_sheets/pending_request_bottom_sheet.dart +++ b/lib/views/widgets/bottom_sheets/pending_request_bottom_sheet.dart @@ -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, diff --git a/lib/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart b/lib/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart index 72f57261..2b6db4b3 100644 --- a/lib/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart +++ b/lib/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart @@ -41,60 +41,65 @@ class _RejectionReasonBottomSheetState extends State Widget build(BuildContext context) { return Form( key: _formKey, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - SingleItemDropDownMenu( - 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( + 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, + ], + ), ), ); } diff --git a/lib/views/widgets/bottom_sheets/request_approval_waiting_bottom_sheet.dart b/lib/views/widgets/bottom_sheets/request_approval_waiting_bottom_sheet.dart index 0fe771f7..933bc218 100644 --- a/lib/views/widgets/bottom_sheets/request_approval_waiting_bottom_sheet.dart +++ b/lib/views/widgets/bottom_sheets/request_approval_waiting_bottom_sheet.dart @@ -91,7 +91,7 @@ class _RequestApprovalBottomState extends State { 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,