|
|
|
|
@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
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/authentication/authentication_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
|
|
|
|
|
@ -18,6 +19,7 @@ import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dar
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/otp/otp.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class RegisterNew extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
@ -25,8 +27,6 @@ class RegisterNew extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
bool isTermsAccepted = true;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
@ -40,6 +40,8 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
AppState appState = getIt.get<AppState>();
|
|
|
|
|
AuthenticationViewModel authVm = context.read<AuthenticationViewModel>();
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
|
appBar: CustomAppBar(
|
|
|
|
|
@ -68,12 +70,7 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Utils.showLottie(context: context,
|
|
|
|
|
assetPath: 'assets/animations/lottie/register.json',
|
|
|
|
|
width: 200.h,
|
|
|
|
|
height: 200.h,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
repeat: true),
|
|
|
|
|
Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/register.json', width: 200.h, height: 200.h, fit: BoxFit.cover, repeat: true),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
LocaleKeys.prepareToElevate.tr().toText32(isBold: true),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
@ -125,22 +122,25 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 25.h),
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
onTap: authVm.onTermAccepted,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
AnimatedContainer(
|
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
|
height: 24.h,
|
|
|
|
|
width: 24.h,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: isTermsAccepted ? const Color(0xFFE92227) : Colors.transparent,
|
|
|
|
|
borderRadius: BorderRadius.circular(6),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: isTermsAccepted ? const Color(0xFFE92227) : Colors.grey,
|
|
|
|
|
width: 2.h,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: isTermsAccepted ? Icon(Icons.check, size: 16.fSize, color: Colors.white) : null,
|
|
|
|
|
Selector<AuthenticationViewModel, bool>(
|
|
|
|
|
selector: (_, viewModel) => viewModel.isTermsAccepted,
|
|
|
|
|
shouldRebuild: (previous, next) => previous != next,
|
|
|
|
|
builder: (context, isTermsAccepted, child) {
|
|
|
|
|
return AnimatedContainer(
|
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
|
height: 24.h,
|
|
|
|
|
width: 24.h,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: isTermsAccepted ? AppColors.primaryRedColor : Colors.transparent,
|
|
|
|
|
borderRadius: BorderRadius.circular(6),
|
|
|
|
|
border: Border.all(color: isTermsAccepted ? AppColors.primaryRedBorderColor : AppColors.greyColor, width: 2.h),
|
|
|
|
|
),
|
|
|
|
|
child: isTermsAccepted ? Icon(Icons.check, size: 16.fSize, color: Colors.white) : null,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 12.h),
|
|
|
|
|
Expanded(
|
|
|
|
|
@ -157,7 +157,7 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
text: "Register",
|
|
|
|
|
icon: AppAssets.note_edit,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
showRegisterModel(context: context);
|
|
|
|
|
showRegisterModel(context: context, authVM: authVm);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 14),
|
|
|
|
|
@ -200,118 +200,116 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void showRegisterModel({required BuildContext context, TextEditingController? textController}) {
|
|
|
|
|
void showRegisterModel({required BuildContext context, required AuthenticationViewModel authVM}) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (bottomSheetContext) =>
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(bottom: MediaQuery
|
|
|
|
|
.of(bottomSheetContext)
|
|
|
|
|
.viewInsets
|
|
|
|
|
.bottom),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: GenericBottomSheet(
|
|
|
|
|
countryCode: "966",
|
|
|
|
|
initialPhoneNumber: "",
|
|
|
|
|
textController: TextEditingController(),
|
|
|
|
|
isEnableCountryDropdown: true,
|
|
|
|
|
onChange: (String? value) {},
|
|
|
|
|
buttons: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.sendOTPSMS.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567',)));
|
|
|
|
|
|
|
|
|
|
builder: (bottomSheetContext) => Padding(
|
|
|
|
|
padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: GenericBottomSheet(
|
|
|
|
|
countryCode: authVM.selectedCountry.countryCode,
|
|
|
|
|
initialPhoneNumber: "",
|
|
|
|
|
textController: authVM.phoneNumberController,
|
|
|
|
|
isEnableCountryDropdown: true,
|
|
|
|
|
onCountryChange: authVM.onCountryChange,
|
|
|
|
|
onChange: authVM.onPhoneNumberChange,
|
|
|
|
|
buttons: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.sendOTPSMS.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) => OTPVerificationPage(
|
|
|
|
|
phoneNumber: '12234567',
|
|
|
|
|
)));
|
|
|
|
|
|
|
|
|
|
// if (mobileNo.isEmpty) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else if (!Utils.validateMobileNumber(mobileNo)) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterValidMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else {
|
|
|
|
|
// registerUser(1);
|
|
|
|
|
// }
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567')));
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.primaryRedColor,
|
|
|
|
|
borderColor: AppColors.primaryRedBorderColor,
|
|
|
|
|
textColor: AppColors.whiteColor,
|
|
|
|
|
icon: AppAssets.message,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8.h),
|
|
|
|
|
child: LocaleKeys.oR.tr().toText16(color: AppColors.textColor),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// if (mobileNo.isEmpty) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else if (!Utils.validateMobileNumber(mobileNo)) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterValidMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else {
|
|
|
|
|
// registerUser(1);
|
|
|
|
|
// }
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567')));
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.primaryRedColor,
|
|
|
|
|
borderColor: AppColors.primaryRedBorderColor,
|
|
|
|
|
textColor: AppColors.whiteColor,
|
|
|
|
|
icon: AppAssets.message,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 10.h, top: 10.h),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.sendOTPWHATSAPP.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// if (mobileNo.isEmpty) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else if (!Utils.validateMobileNumber(mobileNo)) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterValidMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else {
|
|
|
|
|
// registerUser(4);
|
|
|
|
|
// }
|
|
|
|
|
// int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
|
|
|
|
|
// registerUser(val);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.whiteColor,
|
|
|
|
|
borderColor: AppColors.borderOnlyColor,
|
|
|
|
|
textColor: AppColors.textColor,
|
|
|
|
|
icon: AppAssets.whatsapp,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8.h),
|
|
|
|
|
child: LocaleKeys.oR.tr().toText16(color: AppColors.textColor),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 10.h, top: 10.h),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.sendOTPWHATSAPP.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// if (mobileNo.isEmpty) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else if (!Utils.validateMobileNumber(mobileNo)) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: TranslationBase.of(context).pleaseEnterValidMobile,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// } else {
|
|
|
|
|
// registerUser(4);
|
|
|
|
|
// }
|
|
|
|
|
// int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
|
|
|
|
|
// registerUser(val);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.whiteColor,
|
|
|
|
|
borderColor: AppColors.borderOnlyColor,
|
|
|
|
|
textColor: AppColors.textColor,
|
|
|
|
|
icon: AppAssets.whatsapp,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|