family screen & widgets

pull/76/head
aamir-csol 1 month ago
parent f9bfc131a8
commit 1125437a56

@ -727,7 +727,7 @@ const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatu
class ApiConsts { class ApiConsts {
static const maxSmallScreen = 660; static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -258,8 +258,16 @@ class RequestUtils {
}; };
} }
static dynamic getAddFamilyRequest({required String nationalIDorFile, required String mobileNo, required String countryCode, required int loginType}) { static dynamic getAddFamilyRequest({required String nationalIDorFile, required String mobileNo, required String countryCode}) {
var request = <String, dynamic>{}; var request = <String, dynamic>{};
int? loginType = 0; // Default to National ID
if (countryCode == CountryEnum.saudiArabia.countryCode || countryCode == '+966') {
loginType = (nationalIDorFile.length == 10) ? 1 : 2;
} else if (countryCode == CountryEnum.unitedArabEmirates.countryCode || countryCode == '+971') {
loginType = (nationalIDorFile.length == 15) ? 1 : 2;
}
if (loginType == 1) { if (loginType == 1) {
request["sharedPatientID"] = 0; request["sharedPatientID"] = 0;
request["sharedPatientIdentificationID"] = nationalIDorFile; request["sharedPatientIdentificationID"] = nationalIDorFile;
@ -272,5 +280,7 @@ class RequestUtils {
request["zipCode"] = countryCode; request["zipCode"] = countryCode;
request["isRegister"] = false; request["isRegister"] = false;
request["patientStatus"] = 2; request["patientStatus"] = 2;
request["isDentalAllowedBackend"] = false;
return request;
} }
} }

@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/core/common_models/privilege/HMCProjectListM
import 'package:hmg_patient_app_new/core/common_models/privilege/PrivilegeModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/PrivilegeModel.dart';
import 'package:hmg_patient_app_new/core/common_models/privilege/ProjectDetailListModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/ProjectDetailListModel.dart';
import 'package:hmg_patient_app_new/core/common_models/privilege/VidaPlusProjectListModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/VidaPlusProjectListModel.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/loading_utils.dart'; import 'package:hmg_patient_app_new/core/utils/loading_utils.dart';
import 'package:hmg_patient_app_new/core/utils/request_utils.dart'; import 'package:hmg_patient_app_new/core/utils/request_utils.dart';
@ -26,6 +27,7 @@ import 'package:hmg_patient_app_new/features/authentication/models/request_model
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/authentication/saved_login_screen.dart'; import 'package:hmg_patient_app_new/presentation/authentication/saved_login_screen.dart';

@ -1,7 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/request_utils.dart'; import 'package:hmg_patient_app_new/core/utils/request_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart';
@ -293,9 +296,14 @@ class MedicalFileViewModel extends ChangeNotifier {
); );
} }
Future<void> addFamilyFile() async { Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum, required bool isExcludedUser}) async {
final resultEither = await medicalFileRepo.addFamilyFile(request: {}); AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>();
resultEither.fold((failure) async => await errorHandlerService.handleError(failure: failure), (apiResponse) async {}); final request =
} await RequestUtils.getAddFamilyRequest(nationalIDorFile: authVM.nationalIdController.text, mobileNo: authVM.phoneNumberController.text, countryCode: authVM.selectedCountrySignup.countryCode);
final resultEither = await medicalFileRepo.addFamilyFile(request: request);
resultEither.fold((failure) async => await errorHandlerService.handleError(failure: failure), (apiResponse) async {
print(apiResponse);
});
}
} }

@ -10,6 +10,7 @@ import 'package:hmg_patient_app_new/core/utils/validation_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.dart'; import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.dart';
@ -38,6 +39,13 @@ class FamilyMedicalScreen extends StatefulWidget {
class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> { class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
List<CustomTabBarModel> tabs = [CustomTabBarModel("", LocaleKeys.medicalFile.tr()), CustomTabBarModel("", LocaleKeys.request.tr())]; List<CustomTabBarModel> tabs = [CustomTabBarModel("", LocaleKeys.medicalFile.tr()), CustomTabBarModel("", LocaleKeys.request.tr())];
MedicalFileViewModel? medicalVM;
@override
void initState() {
super.initState();
medicalVM = getIt.get<MedicalFileViewModel>();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -153,13 +161,8 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
)) { )) {
authVm.sendActivationCode( // authVm.addFamilyMember(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
otpTypeEnum: OTPTypeEnum.sms, medicalVM?.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
nationalIdOrFileNumber: authVm.nationalIdController.text,
phoneNumber: authVm.phoneNumberController.text,
isForRegister: false,
isExcludedUser: true,
responseID: 123);
} }
}, },
icon: AppAssets.add_icon, icon: AppAssets.add_icon,

@ -114,12 +114,11 @@ void showCommonBottomSheetWithoutHeight(
bool isDismissible = true, bool isDismissible = true,
Widget? titleWidget, Widget? titleWidget,
bool useSafeArea = false, bool useSafeArea = false,
}) { }) {
showModalBottomSheet<String>( showModalBottomSheet<String>(
sheetAnimationStyle: AnimationStyle( sheetAnimationStyle: AnimationStyle(
duration: Duration(milliseconds: 500), // Custom animation duration duration: Duration(milliseconds: 500),
reverseDuration: Duration(milliseconds: 300), // Custom reverse animation duration reverseDuration: Duration(milliseconds: 300),
), ),
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
@ -132,30 +131,110 @@ void showCommonBottomSheetWithoutHeight(
top: false, top: false,
left: false, left: false,
right: false, right: false,
child: Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
physics: ClampingScrollPhysics(),
child: isCloseButtonVisible child: isCloseButtonVisible
? Container( ? Container(
padding: EdgeInsets.only(left: 24, top: 24, right: 24, bottom: 12), padding: EdgeInsets.only(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.bottomSheetBgColor, borderRadius: 24.h), left: 24,
top: 24,
right: 24,
bottom: 12,
),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.bottomSheetBgColor,
borderRadius: 24.h,
),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 16.h,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
titleWidget ?? Expanded(child: title.toText20(weight: FontWeight.w600)), titleWidget ??
Utils.buildSvgWithAssets(icon: AppAssets.close_bottom_sheet_icon, iconColor: Color(0xff2B353E)).onPress(() { Expanded(
child: title.toText20(weight: FontWeight.w600),
),
Utils.buildSvgWithAssets(
icon: AppAssets.close_bottom_sheet_icon,
iconColor: Color(0xff2B353E),
).onPress(() {
Navigator.of(context).pop(); Navigator.of(context).pop();
}), }),
], ],
), ),
SizedBox(height: 16.h),
child, child,
], ],
)) ),
)
: child, : child,
),
),
); );
}).then((value) { },
).then((value) {
callBackFunc(); callBackFunc();
}); });
} }
// void showCommonBottomSheetWithoutHeight(
// BuildContext context, {
// required Widget child,
// required VoidCallback callBackFunc,
// String title = "",
// bool isCloseButtonVisible = true,
// bool isFullScreen = true,
// bool isDismissible = true,
// Widget? titleWidget,
// bool useSafeArea = false,
//
// }) {
// showModalBottomSheet<String>(
// sheetAnimationStyle: AnimationStyle(
// duration: Duration(milliseconds: 500), // Custom animation duration
// reverseDuration: Duration(milliseconds: 300), // Custom reverse animation duration
// ),
// context: context,
// isScrollControlled: true,
// showDragHandle: false,
// isDismissible: isDismissible,
// backgroundColor: AppColors.bottomSheetBgColor,
// useSafeArea: useSafeArea,
// builder: (BuildContext context) {
// return SafeArea(
// top: false,
// left: false,
// right: false,
// child: isCloseButtonVisible
// ? Container(
// padding: EdgeInsets.only(left: 24, top: 24, right: 24, bottom: 12),
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.bottomSheetBgColor, borderRadius: 24.h),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// spacing: 16.h,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// titleWidget ?? Expanded(child: title.toText20(weight: FontWeight.w600)),
// Utils.buildSvgWithAssets(icon: AppAssets.close_bottom_sheet_icon, iconColor: Color(0xff2B353E)).onPress(() {
// Navigator.of(context).pop();
// }),
// ],
// ),
// child,
// ],
// ))
// : child,
// );
// }).then((value) {
// callBackFunc();
// });
// }

Loading…
Cancel
Save