|
|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
@ -9,16 +11,22 @@ import 'package:hmg_patient_app_new/core/utils/utils.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/features/habib_wallet/habib_wallet_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/insurance/insurance_view_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/presentation/insurance/widgets/insurance_update_details_card.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class FamilyCards extends StatefulWidget {
|
|
|
|
|
final List<FamilyFileResponseModelLists> profiles;
|
|
|
|
|
late List<FamilyFileResponseModelLists>? profileViewList;
|
|
|
|
|
final Function(FamilyFileResponseModelLists) onSelect;
|
|
|
|
|
final Function(FamilyFileResponseModelLists) onRemove;
|
|
|
|
|
final bool isShowDetails;
|
|
|
|
|
@ -28,11 +36,12 @@ class FamilyCards extends StatefulWidget {
|
|
|
|
|
final bool isShowRemoveButton;
|
|
|
|
|
final bool isForWalletRecharge;
|
|
|
|
|
|
|
|
|
|
const FamilyCards(
|
|
|
|
|
FamilyCards(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.profiles,
|
|
|
|
|
required this.onSelect,
|
|
|
|
|
required this.onRemove,
|
|
|
|
|
this.profileViewList,
|
|
|
|
|
this.isShowDetails = false,
|
|
|
|
|
this.isBottomSheet = false,
|
|
|
|
|
this.isRequestDesign = false,
|
|
|
|
|
@ -46,9 +55,22 @@ class FamilyCards extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _FamilyCardsState extends State<FamilyCards> {
|
|
|
|
|
AppState appState = getIt<AppState>();
|
|
|
|
|
late InsuranceViewModel insuranceViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
|
insuranceViewModel.initInsuranceProvider();
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
widget.profileViewList = [];
|
|
|
|
|
widget.profileViewList!.addAll(widget.profiles);
|
|
|
|
|
widget.profileViewList!.removeWhere((element) => element.responseId == appState.getAuthenticatedUser()?.patientId);
|
|
|
|
|
insuranceViewModel = Provider.of<InsuranceViewModel>(context, listen: false);
|
|
|
|
|
DialogService dialogService = getIt.get<DialogService>();
|
|
|
|
|
if (widget.isRequestDesign) {
|
|
|
|
|
return Column(
|
|
|
|
|
@ -71,15 +93,15 @@ class _FamilyCardsState extends State<FamilyCards> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).isEmpty
|
|
|
|
|
widget.profileViewList!.where((profile) => profile.isRequestFromMySide ?? false).isEmpty
|
|
|
|
|
? Utils.getNoDataWidget(context)
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
itemCount: widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).length,
|
|
|
|
|
itemCount: widget.profileViewList!.where((profile) => profile.isRequestFromMySide ?? false).length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
final mySideProfiles = widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).toList();
|
|
|
|
|
final mySideProfiles = widget.profileViewList!.where((profile) => profile.isRequestFromMySide ?? false).toList();
|
|
|
|
|
FamilyFileResponseModelLists profile = mySideProfiles[index];
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 12.h),
|
|
|
|
|
@ -146,113 +168,252 @@ class _FamilyCardsState extends State<FamilyCards> {
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return GridView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: widget.profiles.length,
|
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
crossAxisSpacing: 10.w,
|
|
|
|
|
mainAxisSpacing: 10.h,
|
|
|
|
|
childAspectRatio: widget.isShowDetails ? 0.56.h : 0.74.h,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(bottom: 20.h),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
final profile = widget.profiles[index];
|
|
|
|
|
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId);
|
|
|
|
|
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false;
|
|
|
|
|
final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID);
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r),
|
|
|
|
|
child: Opacity(
|
|
|
|
|
opacity: isActive || profile.status == FamilyFileEnum.pending.toInt || !canSwitch ? 0.4 : 1.0, // Fade all content if active
|
|
|
|
|
child: Stack(
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(16.w),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildImgWithAssets(
|
|
|
|
|
icon: profile.gender == null
|
|
|
|
|
? AppAssets.dummyUser
|
|
|
|
|
: profile.gender == 1
|
|
|
|
|
? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.maleImg)
|
|
|
|
|
: (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg),
|
|
|
|
|
width: 72.h,
|
|
|
|
|
height: 70.h,
|
|
|
|
|
Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 56.w, height: 56.h),
|
|
|
|
|
SizedBox(width: 8.w),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.6,
|
|
|
|
|
child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}"
|
|
|
|
|
.toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 2),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 4.h),
|
|
|
|
|
Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
spacing: 4.w,
|
|
|
|
|
runSpacing: 6.w,
|
|
|
|
|
children: [
|
|
|
|
|
AppCustomChipWidget(
|
|
|
|
|
icon: AppAssets.file_icon,
|
|
|
|
|
richText: "${LocaleKeys.fileno.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}".toText10(isEnglishOnly: true),
|
|
|
|
|
labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w),
|
|
|
|
|
),
|
|
|
|
|
AppCustomChipWidget(
|
|
|
|
|
icon: AppAssets.checkmark_icon,
|
|
|
|
|
labelText: LocaleKeys.verified.tr(context: context),
|
|
|
|
|
iconColor: AppColors.successColor,
|
|
|
|
|
labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Divider(color: AppColors.dividerColor, height: 1.h),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
spacing: 4.h,
|
|
|
|
|
runSpacing: 4.h,
|
|
|
|
|
children: [
|
|
|
|
|
AppCustomChipWidget(
|
|
|
|
|
labelText: LocaleKeys.ageYearsOld.tr(namedArgs: {'age': '${appState.getAuthenticatedUser()!.age}', 'yearsOld': LocaleKeys.yearsOld.tr(context: context)}, context: context),
|
|
|
|
|
labelPadding: EdgeInsetsDirectional.only(start: 8.w, end: 8.w),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
(profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
CustomChipWidget(
|
|
|
|
|
chipType: ChipTypeEnum.alert,
|
|
|
|
|
backgroundColor: AppColors.lightGrayBGColor,
|
|
|
|
|
chipText: "Relation: ${profile.relationship ?? " N/A"}",
|
|
|
|
|
iconAsset: AppAssets.heart,
|
|
|
|
|
isShowBorder: false,
|
|
|
|
|
borderRadius: 8.h,
|
|
|
|
|
textColor: AppColors.textColor),
|
|
|
|
|
widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(),
|
|
|
|
|
widget.isShowDetails
|
|
|
|
|
? CustomChipWidget(
|
|
|
|
|
AppCustomChipWidget(
|
|
|
|
|
icon: AppAssets.blood_icon,
|
|
|
|
|
labelText: appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup,
|
|
|
|
|
iconColor: AppColors.primaryRedColor,
|
|
|
|
|
labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w),
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
),
|
|
|
|
|
Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) {
|
|
|
|
|
return AppCustomChipWidget(
|
|
|
|
|
icon: insuranceVM.isInsuranceExpired
|
|
|
|
|
? AppAssets.cancel_circle_icon
|
|
|
|
|
: insuranceVM.isInsuranceActive
|
|
|
|
|
? AppAssets.insurance_active_icon
|
|
|
|
|
: AppAssets.alertSquare,
|
|
|
|
|
labelText: insuranceVM.isInsuranceExpired
|
|
|
|
|
? LocaleKeys.insuranceExpired.tr(context: context)
|
|
|
|
|
: insuranceVM.isInsuranceActive
|
|
|
|
|
? LocaleKeys.insuranceActive.tr(context: context)
|
|
|
|
|
: LocaleKeys.insuranceInActive.tr(context: context),
|
|
|
|
|
iconColor: insuranceVM.isInsuranceExpired
|
|
|
|
|
? AppColors.primaryRedColor
|
|
|
|
|
: insuranceVM.isInsuranceActive
|
|
|
|
|
? AppColors.successColor
|
|
|
|
|
: AppColors.warningColorYellow,
|
|
|
|
|
textColor: insuranceVM.isInsuranceExpired
|
|
|
|
|
? AppColors.primaryRedColor
|
|
|
|
|
: insuranceVM.isInsuranceActive
|
|
|
|
|
? AppColors.successColor
|
|
|
|
|
: AppColors.warningColorYellow,
|
|
|
|
|
iconSize: 12.w,
|
|
|
|
|
deleteIcon: insuranceVM.isInsuranceActive ? null : AppAssets.forward_chevron_icon,
|
|
|
|
|
deleteIconColor: insuranceVM.isInsuranceExpired
|
|
|
|
|
? AppColors.primaryRedColor
|
|
|
|
|
: insuranceVM.isInsuranceActive
|
|
|
|
|
? AppColors.successColor
|
|
|
|
|
: AppColors.warningColorYellow,
|
|
|
|
|
deleteIconHasColor: true,
|
|
|
|
|
onChipTap: () {
|
|
|
|
|
if (!insuranceVM.isInsuranceActive) {
|
|
|
|
|
insuranceVM.setIsInsuranceUpdateDetailsLoading(true);
|
|
|
|
|
insuranceVM.getPatientInsuranceDetailsForUpdate(
|
|
|
|
|
appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString());
|
|
|
|
|
showCommonBottomSheetWithoutHeight(context, child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false);
|
|
|
|
|
// showCommonBottomSheetWithoutHeight(
|
|
|
|
|
// title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!),
|
|
|
|
|
// navigationService.navigatorKey.currentContext!,
|
|
|
|
|
// child: Utils.getWarningWidget(
|
|
|
|
|
// loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context),
|
|
|
|
|
// confirmText: LocaleKeys.contactUs.tr(context: context),
|
|
|
|
|
// isShowActionButtons: true,
|
|
|
|
|
// onCancelTap: () {
|
|
|
|
|
// navigationService.pop();
|
|
|
|
|
// },
|
|
|
|
|
// onConfirmTap: () async {
|
|
|
|
|
// launchUrl(Uri.parse("tel://" + "+966 92 006 6666"));
|
|
|
|
|
// }),
|
|
|
|
|
// callBackFunc: () {},
|
|
|
|
|
// isFullScreen: false,
|
|
|
|
|
// isCloseButtonVisible: true,
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: insuranceVM.isInsuranceExpired
|
|
|
|
|
? AppColors.primaryRedColor.withOpacity(0.1)
|
|
|
|
|
: insuranceVM.isInsuranceActive
|
|
|
|
|
? AppColors.successColor.withOpacity(0.1)
|
|
|
|
|
: AppColors.warningColorYellow.withOpacity(0.1),
|
|
|
|
|
labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: insuranceVM.isInsuranceActive ? 6.w : 0.w),
|
|
|
|
|
).toShimmer2(isShow: insuranceVM.isInsuranceLoading);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).paddingSymmetrical(0.w, 0.0),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
GridView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: widget.profileViewList!.length,
|
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
crossAxisSpacing: 10.w,
|
|
|
|
|
mainAxisSpacing: 10.h,
|
|
|
|
|
childAspectRatio: widget.isShowDetails ? 0.56.h : 0.74.h,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(bottom: 20.h),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
final profile = widget.profileViewList![index];
|
|
|
|
|
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId);
|
|
|
|
|
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false;
|
|
|
|
|
final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID);
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r),
|
|
|
|
|
child: Opacity(
|
|
|
|
|
opacity: isActive || profile.status == FamilyFileEnum.pending.toInt || !canSwitch ? 0.4 : 1.0, // Fade all content if active
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildImgWithAssets(
|
|
|
|
|
icon: profile.gender == null
|
|
|
|
|
? AppAssets.dummyUser
|
|
|
|
|
: profile.gender == 1
|
|
|
|
|
? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.maleImg)
|
|
|
|
|
: (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg),
|
|
|
|
|
width: 72.h,
|
|
|
|
|
height: 70.h,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
(profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
CustomChipWidget(
|
|
|
|
|
chipType: ChipTypeEnum.alert,
|
|
|
|
|
backgroundColor: AppColors.lightGrayBGColor,
|
|
|
|
|
chipText: "Age:${profile.age ?? "N/A"} Years",
|
|
|
|
|
chipText: "Relation: ${profile.relationship ?? " N/A"}",
|
|
|
|
|
iconAsset: AppAssets.heart,
|
|
|
|
|
isShowBorder: false,
|
|
|
|
|
borderRadius: 8.h,
|
|
|
|
|
textColor: AppColors.textColor,
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
widget.isShowDetails
|
|
|
|
|
? SizedBox(height: 8.h)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
height: 4.h,
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
widget.isForWalletRecharge ? CustomButton(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
widget.onSelect(profile);
|
|
|
|
|
// if (canSwitch) widget.onSelect(profile);
|
|
|
|
|
},
|
|
|
|
|
text: LocaleKeys.select.tr(context: context),
|
|
|
|
|
backgroundColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
borderColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
textColor: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 13.h,
|
|
|
|
|
icon: AppAssets.activeCheck,
|
|
|
|
|
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
|
|
|
|
|
).paddingOnly(top: 0, bottom: 0) : CustomButton(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (canSwitch) widget.onSelect(profile);
|
|
|
|
|
},
|
|
|
|
|
text: isActive ? LocaleKeys.active.tr(context: context) : LocaleKeys.switchLogin.tr(context: context),
|
|
|
|
|
backgroundColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor,
|
|
|
|
|
borderColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor,
|
|
|
|
|
textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 13.h,
|
|
|
|
|
icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user,
|
|
|
|
|
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
|
|
|
|
|
).paddingOnly(top: 0, bottom: 0),
|
|
|
|
|
textColor: AppColors.textColor),
|
|
|
|
|
widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(),
|
|
|
|
|
widget.isShowDetails
|
|
|
|
|
? CustomChipWidget(
|
|
|
|
|
chipType: ChipTypeEnum.alert,
|
|
|
|
|
backgroundColor: AppColors.lightGrayBGColor,
|
|
|
|
|
chipText: "Age: ${profile.age ?? "N/A"} Years",
|
|
|
|
|
isShowBorder: false,
|
|
|
|
|
borderRadius: 8.h,
|
|
|
|
|
textColor: AppColors.textColor,
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
widget.isShowDetails
|
|
|
|
|
? SizedBox(height: 8.h)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
height: 4.h,
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
widget.isForWalletRecharge
|
|
|
|
|
? CustomButton(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
widget.onSelect(profile);
|
|
|
|
|
// if (canSwitch) widget.onSelect(profile);
|
|
|
|
|
},
|
|
|
|
|
text: LocaleKeys.select.tr(context: context),
|
|
|
|
|
backgroundColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
borderColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
textColor: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 13.h,
|
|
|
|
|
icon: AppAssets.activeCheck,
|
|
|
|
|
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
|
|
|
|
|
).paddingOnly(top: 0, bottom: 0)
|
|
|
|
|
: CustomButton(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (canSwitch) widget.onSelect(profile);
|
|
|
|
|
},
|
|
|
|
|
text: isActive ? LocaleKeys.active.tr(context: context) : LocaleKeys.switchLogin.tr(context: context),
|
|
|
|
|
backgroundColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor,
|
|
|
|
|
borderColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor,
|
|
|
|
|
textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 13.h,
|
|
|
|
|
icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user,
|
|
|
|
|
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
|
|
|
|
|
).paddingOnly(top: 0, bottom: 0),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (widget.isShowRemoveButton) ...[
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
child: Utils.buildSvgWithAssets(icon: AppAssets.deleteIcon).onPress(() {
|
|
|
|
|
if (!isActive) widget.onRemove(profile);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (widget.isShowRemoveButton) ...[
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
child: Utils.buildSvgWithAssets(icon: AppAssets.deleteIcon).onPress(() {
|
|
|
|
|
if (!isActive) widget.onRemove(profile);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -260,15 +421,15 @@ class _FamilyCardsState extends State<FamilyCards> {
|
|
|
|
|
Widget manageFamily() {
|
|
|
|
|
NavigationService navigationService = getIt<NavigationService>();
|
|
|
|
|
|
|
|
|
|
return widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).isEmpty
|
|
|
|
|
return widget.profileViewList!.where((profile) => !(profile.isRequestFromMySide ?? false)).isEmpty
|
|
|
|
|
? Utils.getNoDataWidget(context)
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
padding: EdgeInsetsGeometry.zero,
|
|
|
|
|
itemCount: widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).length,
|
|
|
|
|
itemCount: widget.profileViewList!.where((profile) => !(profile.isRequestFromMySide ?? false)).length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
final otherProfiles = widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).toList();
|
|
|
|
|
final otherProfiles = widget.profileViewList!.where((profile) => !(profile.isRequestFromMySide ?? false)).toList();
|
|
|
|
|
FamilyFileResponseModelLists profile = otherProfiles[index];
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 12.h),
|
|
|
|
|
|