From 9561b29822b73fc82821cab1f063bc15b471a6f9 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Sun, 22 Jun 2025 15:48:23 +0300 Subject: [PATCH] update user info bottomsheet design and service request external date check added --- .../components/external_request.dart | 1 + lib/views/pages/user/profile_page.dart | 88 +++++++++++++++++- .../user/update_profile_info_bottmsheet.dart | 93 +++++++++++++++++++ 3 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 lib/views/pages/user/update_profile_info_bottmsheet.dart diff --git a/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart b/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart index 6733c8dc..d958cf2e 100644 --- a/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart +++ b/lib/modules/cm_module/views/forms/maintenance_request/components/external_request.dart @@ -138,6 +138,7 @@ class _ExternalMaintenanceRequestState extends State hideShadow: true, backgroundColor: AppColor.neutral100, date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime, + from:requestDetailProvider.currentWorkOrder?.data?.requestedDate, formatDateWithTime: true, onDatePicker: (selectedDate) { showTimePicker( diff --git a/lib/views/pages/user/profile_page.dart b/lib/views/pages/user/profile_page.dart index af9ab3fc..6d705337 100644 --- a/lib/views/pages/user/profile_page.dart +++ b/lib/views/pages/user/profile_page.dart @@ -13,6 +13,7 @@ import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/user.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; +import 'package:test_sa/views/pages/user/update_profile_info_bottmsheet.dart'; import '../../../new_views/app_style/app_color.dart'; @@ -175,7 +176,73 @@ class _ProfilePageState extends State { AppFilledButton( label: "Update Information", buttonColor: AppColor.neutral50, - onPressed: () {}, + onPressed: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + clipBehavior: Clip.antiAliasWithSaveLayer, + builder: (BuildContext context) { + return Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height * 0.9, + ), + child: SingleChildScrollView( + child: UpdateProfileInfoBottmsheet( + userInfoModel: UpdateUserInfoModel( + email: _user.email, + phoneNo: _user.phoneNumber, + extensionNo: _user.extensionNo, + ), + ), + ), + ), + ); + }, + ); + + // showModalBottomSheet( + // context: context, + // isScrollControlled: true, + // shape: const RoundedRectangleBorder( + // borderRadius: BorderRadius.vertical( + // top: Radius.circular(20), + // ), + // ), + // clipBehavior: Clip.antiAliasWithSaveLayer, + // builder: (BuildContext context) { + // return Padding( + // padding: EdgeInsets.only( + // bottom: MediaQuery.of(context).viewInsets.bottom, + // ), + // child: DraggableScrollableSheet( + // // initialChildSize: 0.6, // You can adjust this as needed + // minChildSize: 0.3, + // maxChildSize: 0.9, + // expand: false, + // builder: (context, scrollController) { + // return SingleChildScrollView( + // controller: scrollController, + // child: UpdateProfileInfoBottmsheet( + // userInfoModel: UpdateUserInfoModel( + // email: _user.email, + // phoneNo: _user.phoneNumber, + // extensionNo: _user.extensionNo, + // ), + // ), + // ); + // }, + // ), + // ); + // }, + // ); + }, ) ], ), @@ -337,3 +404,22 @@ class _ProfilePageState extends State { ); } } + +class UpdateUserInfoModel { + dynamic userId; + String? email; + String? phoneNo; + String? extensionNo; + + UpdateUserInfoModel({this.email, this.phoneNo, this.extensionNo, this.userId}); + + Map toJson() { + return { + //need this to update user info.. + 'userId': userId, + 'email': email, + 'phoneNo': phoneNo, + 'extensionNo': extensionNo, + }; + } +} diff --git a/lib/views/pages/user/update_profile_info_bottmsheet.dart b/lib/views/pages/user/update_profile_info_bottmsheet.dart new file mode 100644 index 00000000..75edfd9f --- /dev/null +++ b/lib/views/pages/user/update_profile_info_bottmsheet.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; +import 'package:test_sa/extensions/int_extensions.dart'; +import 'package:test_sa/extensions/text_extensions.dart'; +import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/new_views/app_style/app_color.dart'; +import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; +import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; +import 'package:test_sa/views/pages/user/profile_page.dart'; + +class UpdateProfileInfoBottmsheet extends StatelessWidget { + UpdateUserInfoModel userInfoModel; + + UpdateProfileInfoBottmsheet({super.key, required this.userInfoModel}); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + "Email".bodyText(context).custom(color: AppColor.black20), + 8.height, + AppTextFormField( + labelText: "Email", + backgroundColor: AppColor.neutral100, + initialValue: userInfoModel.email, + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: TextInputType.number, + showShadow: false, + onChange: (value) { + userInfoModel.email = value; + }, + style: Theme.of(context).textTheme.titleMedium, + ), + 8.height, + "Phone Number".bodyText(context).custom(color: AppColor.black20), + 8.height, + AppTextFormField( + labelText: "Phone Number", + backgroundColor: AppColor.neutral100, + initialValue: userInfoModel.phoneNo, + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: TextInputType.number, + showShadow: false, + onChange: (value) { + userInfoModel.phoneNo = value; + }, + style: Theme.of(context).textTheme.titleMedium, + ), + 8.height, + "Extension No".bodyText(context).custom(color: AppColor.black20), + 8.height, + AppTextFormField( + labelText: "Extension No", + backgroundColor: AppColor.neutral100, + initialValue: userInfoModel.extensionNo, + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: TextInputType.number, + showShadow: false, + onChange: (value) { + userInfoModel.extensionNo = value; + }, + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ).toShadowContainer(context).paddingAll(16), + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), + color: AppColor.white10, + child: AppFilledButton( + label: "Update", + buttonColor: AppColor.neutral50, + onPressed: () async { + //TODO call update api here... + // showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); + + Navigator.pop(context); + }, + ), + ), + ], + ); + } +}