Clarity implementation updates

pull/336/head
haroon amjad 4 days ago
parent 1438daa1d3
commit 64eb04011e

@ -210,8 +210,8 @@ class ApiClientImp implements ApiClient {
body['TokenID'] = "@dm!n"; body['TokenID'] = "@dm!n";
} }
body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";
// body['PatientID'] = 3648831; // body['PatientID'] = 4772993;
// body['PatientID'] = 89754444; // body['PatientID'] = 89754444;
// body['PatientTypeID'] = 1; // body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0; // body['PatientOutSA'] = 0;

@ -4,12 +4,14 @@ import 'dart:io';
import 'dart:math' as dartMath; import 'dart:math' as dartMath;
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:crypto/crypto.dart' as crypto; import 'package:crypto/crypto.dart' as crypto;
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:get_it/get_it.dart';
import 'package:google_api_availability/google_api_availability.dart'; import 'package:google_api_availability/google_api_availability.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';

@ -94,27 +94,29 @@ class LoginScreenState extends State<LoginScreen> {
LocaleKeys.welcomeToDrSulaiman.tr(context: context).toText32(isBold: true, color: AppColors.textColor ), LocaleKeys.welcomeToDrSulaiman.tr(context: context).toText32(isBold: true, color: AppColors.textColor ),
SizedBox(height: 32.h), SizedBox(height: 32.h),
Localizations.override(context: context, locale: Locale('en', 'US'), child: Container()), // Force English locale for this widget Localizations.override(context: context, locale: Locale('en', 'US'), child: Container()), // Force English locale for this widget
TextInputWidget( ClarityUnmask(
labelText: LocaleKeys.nationalIdFileNumber.tr(context: context), child: TextInputWidget(
hintText: "xxxxxxxxx", labelText: LocaleKeys.nationalIdFileNumber.tr(context: context),
controller: authVm.nationalIdController, hintText: "xxxxxxxxx",
focusNode: _nationalIdFocusNode, controller: authVm.nationalIdController,
keyboardType: TextInputType.number, focusNode: _nationalIdFocusNode,
isEnable: true, keyboardType: TextInputType.number,
prefix: null, isEnable: true,
autoFocus: true, prefix: null,
isAllowRadius: true, autoFocus: true,
isBorderAllowed: false, isAllowRadius: true,
isAllowLeadingIcon: true, isBorderAllowed: false,
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 10.h), isAllowLeadingIcon: true,
leadingIcon: AppAssets.student_card, padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 10.h),
errorMessage: authVm.nationalIdError, leadingIcon: AppAssets.student_card,
hasError: authVm.nationalIdError != null, errorMessage: authVm.nationalIdError,
fontFamily: "Poppins", hasError: authVm.nationalIdError != null,
onChange: (value) { fontFamily: "Poppins",
// Clear error when user starts typing onChange: (value) {
authVm.clearNationalIdError(); // Clear error when user starts typing
}, authVm.clearNationalIdError();
},
),
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
CustomButton( CustomButton(
@ -205,65 +207,67 @@ class LoginScreenState extends State<LoginScreen> {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Consumer<AuthenticationViewModel>( child: Consumer<AuthenticationViewModel>(
builder: (context, authVm, child) { builder: (context, authVm, child) {
return GenericBottomSheet( return ClarityUnmask(
countryCode: authVm.selectedCountrySignup.countryCode, child: GenericBottomSheet(
initialPhoneNumber: "", countryCode: authVm.selectedCountrySignup.countryCode,
textController: phoneNumberController, initialPhoneNumber: "",
isEnableCountryDropdown: true, textController: phoneNumberController,
onCountryChange: (country) { isEnableCountryDropdown: true,
authVm.onCountryChange(country); onCountryChange: (country) {
// Clear error when country changes authVm.onCountryChange(country);
authVm.clearPhoneNumberError(); // Clear error when country changes
}, authVm.clearPhoneNumberError();
onChange: (value) { },
authVm.onPhoneNumberChange(value); onChange: (value) {
// Clear error when user starts typing authVm.onPhoneNumberChange(value);
authVm.clearPhoneNumberError(); // Clear error when user starts typing
}, authVm.clearPhoneNumberError();
phoneNumberError: authVm.phoneNumberError, },
buttons: [ phoneNumberError: authVm.phoneNumberError,
if (authVm.selectedCountrySignup != CountryEnum.others) buttons: [
if (authVm.selectedCountrySignup != CountryEnum.others)
Padding(
padding: EdgeInsets.only(bottom: 10.h),
child: CustomButton(
text: LocaleKeys.sendOTPSMS.tr(context: context),
onPressed: () async {
validatePhoneAndProceed(OTPTypeEnum.sms);
},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedBorderColor,
textColor: Colors.white,
iconColor: Colors.white,
icon: AppAssets.message,
),
),
if (authVm.selectedCountrySignup != CountryEnum.others)
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.h),
child: LocaleKeys.oR.tr(context: context).toText16(color: AppColors.textColor),
),
],
),
Padding( Padding(
padding: EdgeInsets.only(bottom: 10.h), padding: EdgeInsets.only(bottom: 10.h, top: 10.h),
child: CustomButton( child: CustomButton(
text: LocaleKeys.sendOTPSMS.tr(context: context), text: LocaleKeys.sendOTPWHATSAPP.tr(context: context),
onPressed: () async { onPressed: () async {
validatePhoneAndProceed(OTPTypeEnum.sms); validatePhoneAndProceed(OTPTypeEnum.whatsapp);
}, },
backgroundColor: AppColors.primaryRedColor, backgroundColor: AppColors.whiteColor,
borderColor: AppColors.primaryRedBorderColor, borderColor: AppColors.textColor,
textColor: Colors.white, textColor: AppColors.textColor,
iconColor: Colors.white, icon: AppAssets.whatsapp,
icon: AppAssets.message, iconColor: null,
applyThemeColor: false,
), ),
), ),
if (authVm.selectedCountrySignup != CountryEnum.others) ],
Row( ),
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.h),
child: LocaleKeys.oR.tr(context: context).toText16(color: AppColors.textColor),
),
],
),
Padding(
padding: EdgeInsets.only(bottom: 10.h, top: 10.h),
child: CustomButton(
text: LocaleKeys.sendOTPWHATSAPP.tr(context: context),
onPressed: () async {
validatePhoneAndProceed(OTPTypeEnum.whatsapp);
},
backgroundColor: AppColors.whiteColor,
borderColor: AppColors.textColor,
textColor: AppColors.textColor,
icon: AppAssets.whatsapp,
iconColor: null,
applyThemeColor: false,
),
),
],
); );
}, },
), ),

@ -63,11 +63,13 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
scheduleMicrotask(() { scheduleMicrotask(() {
payfortViewModel.initPayfortViewModel(); payfortViewModel.initPayfortViewModel();
myAppointmentsViewModel.getTamaraInstallmentsDetails().then((val) { myAppointmentsViewModel.getTamaraInstallmentsDetails().then((val) {
if (num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total!) >= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.minLimit!.amount! && if (myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel != null) {
num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total!) <= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.maxLimit!.amount!) { if (num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total!) >= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.minLimit!.amount! &&
setState(() { num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total!) <= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.maxLimit!.amount!) {
isShowTamara = true; setState(() {
}); isShowTamara = true;
});
}
} }
}); });
}); });

@ -145,6 +145,8 @@ class _LandingPageState extends State<LandingPage> {
} }
if (appState.isAuthenticated) { if (appState.isAuthenticated) {
Clarity.setCustomUserId(appState.getAuthenticatedUser()!.patientId.toString());
habibWalletVM.initHabibWalletProvider(); habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount(); habibWalletVM.getPatientBalanceAmount();
habibWalletVM.getLakumAccountInformation(); habibWalletVM.getLakumAccountInformation();

@ -1,5 +1,6 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -405,64 +406,66 @@ class TextInputWidget extends StatelessWidget {
child: Localizations.override( child: Localizations.override(
context: context, context: context,
locale: const Locale('en', 'US'), // Force English locale for TextField locale: const Locale('en', 'US'), // Force English locale for TextField
child: TextField( child: ClarityUnmask(
hintLocales: const [Locale('en', 'US')], child: TextField(
enabled: isEnable, hintLocales: const [Locale('en', 'US')],
scrollPadding: EdgeInsets.zero, enabled: isEnable,
keyboardType: isMultiline scrollPadding: EdgeInsets.zero,
? TextInputType.multiline keyboardType: isMultiline
: (isWalletAmountInput! ? const TextInputType.numberWithOptions(decimal: true) : keyboardType), ? TextInputType.multiline
controller: controller, : (isWalletAmountInput! ? const TextInputType.numberWithOptions(decimal: true) : keyboardType),
readOnly: isReadOnly, controller: controller,
textAlignVertical: TextAlignVertical.top, readOnly: isReadOnly,
textAlign: isArabic ? TextAlign.right : TextAlign.left, textAlignVertical: TextAlignVertical.top,
textDirection: ui.TextDirection.ltr, textAlign: isArabic ? TextAlign.right : TextAlign.left,
onChanged: onChange, textDirection: ui.TextDirection.ltr,
focusNode: focusNode ?? _focusNode, onChanged: onChange,
autofocus: autoFocus, focusNode: focusNode ?? _focusNode,
textInputAction: TextInputAction.done, autofocus: autoFocus,
cursorHeight: isWalletAmountInput! ? 40.h : 20.h, textInputAction: TextInputAction.done,
maxLength: isWalletAmountInput! ? 7 : 100, cursorHeight: isWalletAmountInput! ? 40.h : 20.h,
inputFormatters: isWalletAmountInput! maxLength: isWalletAmountInput! ? 7 : 100,
? [ inputFormatters: isWalletAmountInput!
_ThousandSeparatorInputFormatter(), ? [
] _ThousandSeparatorInputFormatter(),
: null, ]
onTapOutside: (event) { : null,
FocusManager.instance.primaryFocus?.unfocus(); onTapOutside: (event) {
}, FocusManager.instance.primaryFocus?.unfocus();
onSubmitted: onSubmitted, },
minLines: isMultiline ? minLines : 1, onSubmitted: onSubmitted,
maxLines: isMultiline ? maxLines : 1, minLines: isMultiline ? minLines : 1,
style: TextStyle( maxLines: isMultiline ? maxLines : 1,
fontSize: fontS, style: TextStyle(
height: isMultiline ? 1.2 : (isWalletAmountInput! ? 1 / 4 : 0), fontSize: fontS,
fontWeight: FontWeight.w600, height: isMultiline ? 1.2 : (isWalletAmountInput! ? 1 / 4 : 0),
color: AppColors.textColor,
letterSpacing: -1,
fontFamily: fontFamily,
locale: const Locale('en', 'US'), // Force English locale for text style
),
decoration: InputDecoration(
counterText: "",
isDense: true,
hintText: hintText,
hintStyle: TextStyle(
fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
fontSize: 14.f,
height: 21 / 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: hintColor != null ? AppColors.textColor : Color(0xff898A8D), color: AppColors.textColor,
letterSpacing: -0.75, letterSpacing: -1,
fontFamily: fontFamily,
locale: const Locale('en', 'US'), // Force English locale for text style
),
decoration: InputDecoration(
counterText: "",
isDense: true,
hintText: hintText,
hintStyle: TextStyle(
fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
fontSize: 14.f,
height: 21 / 16,
fontWeight: FontWeight.w600,
color: hintColor != null ? AppColors.textColor : Color(0xff898A8D),
letterSpacing: -0.75,
),
prefixIconConstraints: BoxConstraints(minWidth: 30.h),
prefixIcon: prefix == null ? null : "+${prefix!}".toText14(letterSpacing: -1, color: AppColors.textColor, isBold: true),
contentPadding: EdgeInsets.only(right: isArabic ? 10.w : 0),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
// Show red border when field has error - but we handle this in the parent Container
// The parent Container in build() already shows red border based on hasError flag
), ),
prefixIconConstraints: BoxConstraints(minWidth: 30.h),
prefixIcon: prefix == null ? null : "+${prefix!}".toText14(letterSpacing: -1, color: AppColors.textColor, isBold: true),
contentPadding: EdgeInsets.only(right: isArabic ? 10.w : 0),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
// Show red border when field has error - but we handle this in the parent Container
// The parent Container in build() already shows red border based on hasError flag
), ),
), ),
), ),

Loading…
Cancel
Save