You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
311 lines
13 KiB
Dart
311 lines
13 KiB
Dart
import 'package:flutter/gestures.dart';
|
|
import 'package:hmg_patient_app/config/size_config.dart';
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart';
|
|
import 'package:hmg_patient_app/pages/login/login-type.dart';
|
|
import 'package:hmg_patient_app/pages/login/register-info.dart';
|
|
import 'package:hmg_patient_app/pages/login/register.dart';
|
|
import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';
|
|
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
|
|
import 'package:hmg_patient_app/uitl/utils.dart';
|
|
import 'package:hmg_patient_app/uitl/utils_new.dart';
|
|
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class RegisterNew extends StatefulWidget {
|
|
@override
|
|
_RegisterNew createState() => _RegisterNew();
|
|
}
|
|
|
|
class _RegisterNew extends State<RegisterNew> {
|
|
final nationalIDorFile = TextEditingController();
|
|
TextEditingController phoneController = TextEditingController();
|
|
final int loginType = LoginType.loginType;
|
|
late String mobileNo;
|
|
String countryCode = '966';
|
|
var isHijri;
|
|
final util = Utils();
|
|
late DateTime selectedDate;
|
|
late String dob;
|
|
bool isButtonDisabled = true;
|
|
final authService = new AuthProvider();
|
|
final sharedPref = new AppSharedPreferences();
|
|
late PageController _controller;
|
|
late bool isLoading;
|
|
int _currentIndex = 0;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = new PageController();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
changePageViewIndex(pageIndex) {
|
|
_controller.jumpToPage(pageIndex);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: TranslationBase.of(context).register,
|
|
isShowDecPage: false,
|
|
isShowAppBar: true,
|
|
isshowBackButton: true,
|
|
showNewAppBar: true,
|
|
backgroundColor: Color(0xffF8F8F8),
|
|
showNewAppBarTitle: false,
|
|
showDropDown: true,
|
|
isShowLanguageChanger: true,
|
|
appBarIcons: [],
|
|
dropDownList: [],
|
|
dropDownIndexChange: (value) {
|
|
Utils.changeAppLanguage(context: context);
|
|
},
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
height: SizeConfig.realScreenHeight! * .9,
|
|
width: SizeConfig.realScreenWidth,
|
|
child: Column(children: <Widget>[
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.only(left: 20, right: 20, top: 12),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).enterDetails,
|
|
status: _currentIndex == 0
|
|
? TranslationBase.of(context).inPrgress
|
|
: _currentIndex > 0
|
|
? TranslationBase.of(context).completed
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).patientInfo,
|
|
status: _currentIndex == 1
|
|
? TranslationBase.of(context).inPrgress
|
|
: _currentIndex > 1
|
|
? TranslationBase.of(context).completed
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex == 1
|
|
? CustomColors.orange
|
|
: _currentIndex > 1
|
|
? CustomColors.green
|
|
: CustomColors.grey2,
|
|
),
|
|
),
|
|
showProgress(
|
|
title: TranslationBase.of(context).otherInfo,
|
|
status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked,
|
|
color: _currentIndex == 2
|
|
? CustomColors.orange
|
|
: _currentIndex > 3
|
|
? CustomColors.green
|
|
: CustomColors.grey2,
|
|
isNeedBorder: false,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: PageView(
|
|
physics: NeverScrollableScrollPhysics(),
|
|
controller: _controller,
|
|
onPageChanged: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
scrollDirection: Axis.horizontal,
|
|
children: <Widget>[
|
|
Register(
|
|
changePageViewIndex: changePageViewIndex,
|
|
),
|
|
|
|
RegisterInfo(
|
|
changePageViewIndex: changePageViewIndex,
|
|
),
|
|
RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2),
|
|
// NewEReferralStepOnePage(
|
|
// changePageViewIndex: changePageViewIndex,
|
|
// createEReferralRequestModel: createEReferralRequestModel,
|
|
// ),
|
|
// NewEReferralStepTowPage(
|
|
// changePageViewIndex: changePageViewIndex,
|
|
// createEReferralRequestModel: createEReferralRequestModel,
|
|
// ),
|
|
// NewEReferralStepThreePage(
|
|
// changePageViewIndex: changePageViewIndex,
|
|
// createEReferralRequestModel: createEReferralRequestModel,
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
),
|
|
bottomSheet: Container(
|
|
decoration: BoxDecoration(color: Color(0xffF8F8F8)),
|
|
// height: 160,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
child: CustomButton(
|
|
text: TranslationBase.of(context).login,
|
|
icon: "assets/images/svg/login1.svg",
|
|
onPressed: () {
|
|
// bool isValid = validateIqama(nationIdController.text);
|
|
// print("Iqama is valid: $isValid");
|
|
if (true) {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
isDismissible: false,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (bottomSheetContext) => Padding(
|
|
padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
|
|
child: SingleChildScrollView(
|
|
child: GenericBottomSheet(
|
|
countryCode: "966",
|
|
initialPhoneNumber: "",
|
|
textController: phoneController, // Assumed to be a TextEditingController
|
|
buttons: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
child: CustomButton(
|
|
text: "Send me OTP on SMS",
|
|
onPressed: () {
|
|
Utils.onOtpBtnPressed(OTPType.sms, phoneController);
|
|
},
|
|
backgroundColor: Colors.red,
|
|
borderColor: Colors.red,
|
|
textColor: Colors.white,
|
|
icon: "assets/images/svg/message.svg",
|
|
),
|
|
),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
child: AppText(
|
|
"OR",
|
|
fontSize: 16,
|
|
fontFamily: 'poppins',
|
|
color: Color(0xFF2E3039),
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
child: CustomButton(
|
|
text: "Send me OTP on WhatsApp",
|
|
onPressed: () {
|
|
Utils.onOtpBtnPressed(OTPType.whatsapp, phoneController);
|
|
},
|
|
backgroundColor: Colors.white,
|
|
borderColor: Color(0xFF2E3039),
|
|
textColor: Color(0xFF2E3039),
|
|
icon: "assets/images/svg/whatsapp.svg",
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
));
|
|
} else {
|
|
Utils.showErrorToast("Please enter a valid Iqama number.");
|
|
}
|
|
}),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
SizedBox(
|
|
height: 30,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget showProgress({String? title, String? status, Color? color, bool isNeedBorder = true}) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: 26,
|
|
height: 26,
|
|
decoration: containerRadius(color!, 200),
|
|
child: Icon(
|
|
Icons.done,
|
|
color: Colors.white,
|
|
size: 16,
|
|
),
|
|
),
|
|
if (isNeedBorder)
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: mDivider(Colors.grey),
|
|
)),
|
|
],
|
|
),
|
|
mHeight(8),
|
|
Text(
|
|
title!,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.44,
|
|
),
|
|
),
|
|
mHeight(2),
|
|
Container(
|
|
padding: EdgeInsets.all(5),
|
|
decoration: containerRadius(color!.withOpacity(0.2), 4),
|
|
child: Text(
|
|
status!,
|
|
style: TextStyle(
|
|
fontSize: 8,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.32,
|
|
color: color,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|