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.
HMG_Patient_App/lib/pages/login/register_new_step_2.dart

314 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/AlHabibMedicalService/health_calculator/carbs/carbs.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 RegisterNewStep2 extends StatefulWidget {
@override
_RegisterNew createState() => _RegisterNew();
}
class _RegisterNew extends State<RegisterNewStep2> {
final nationalIDorFile = TextEditingController();
final emailAddress = TextEditingController();
DateTime? selectedDOB;
final int loginType = LoginType.loginType;
late String mobileNo;
String countryCode = '966';
var isHijri;
final util = Utils();
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: "Personal Details Verification",
isShowDecPage: false,
isShowAppBar: true,
isshowBackButton: true,
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: true,
showDropDown: false,
isShowLanguageChanger: false,
showHomeAppBarIcon: false,
resizeToAvoidBottomInset: true,
appBarIcons: [],
dropDownIndexChange: (value) {
Utils.changeAppLanguage(context: context);
},
body: SafeArea(
child: SingleChildScrollView(
reverse: false,
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Directionality(
textDirection: Directionality.of(context),
child: Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
padding: EdgeInsets.only(left: 16, right: 16),
child: Column(
children: [
inputWidget(TranslationBase.of(context).name, "Mohammad Hussain Abdul Ghaffar", nationalIDorFile,
isEnable: true,
prefix: null,
removePadding: true,
isAllowRadius: false,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: "assets/images/svg/user-circle.svg",
onChange: (value) {}),
Divider(height: 1),
inputWidget(TranslationBase.of(context).nationalIdNumber, "25293444933", nationalIDorFile,
isEnable: true,
prefix: null,
removePadding: true,
isAllowRadius: false,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: "assets/images/svg/student-card.svg",
onChange: (value) {}),
Divider(height: 1),
inputWidget(TranslationBase.of(context).gender, "Male", nationalIDorFile,
isEnable: true,
prefix: null,
removePadding: true,
isAllowRadius: false,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: "assets/images/svg/user-full.svg",
onChange: (value) {}),
Divider(height: 1),
inputWidget(TranslationBase.of(context).maritalStatus, "Married", nationalIDorFile,
isEnable: true,
prefix: null,
removePadding: true,
isAllowRadius: false,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: "assets/images/svg/smart-phone.svg",
onChange: (value) {}),
Divider(height: 1),
inputWidget(TranslationBase.of(context).nationality, "Pakistani", nationalIDorFile,
isEnable: true,
prefix: null,
removePadding: true,
isAllowRadius: false,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: "assets/images/svg/globe.svg",
onChange: (value) {}),
Divider(height: 1),
inputWidget(TranslationBase.of(context).mobileNumber, "234567876543", nationalIDorFile,
isEnable: true,
prefix: null,
removePadding: true,
isAllowRadius: false,
hasSelection: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: "assets/images/svg/call.svg",
onChange: (value) {}),
Divider(height: 1),
inputWidget(TranslationBase.of(context).dob, "11 July, 1994", nationalIDorFile,
isEnable: true,
prefix: null,
hasSelection: false,
removePadding: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
hasSelectionCustomIcon: false,
isReadOnly: true,
selectionType: SelectionType.calendar,
selectedValue: selectedDOB != null ? Utils.formatDateToDisplay(selectedDOB.toString()) : null,
selectionCustomIcon: "assets/images/svg/calendar.svg",
leadingIcon: "assets/images/svg/birthday-cake.svg",
onChange: (value) {}),
],
),
),
),
SizedBox(height: 150),
Row(
children: [
Expanded(
child: CustomButton(
text: TranslationBase.of(context).cancel,
icon: "assets/images/svg/cancel.svg",
onPressed: () {
if (nationalIDorFile == null) {
Utils.showErrorToast("Please enter your national id.");
return;
}
if (selectedDOB == null) {
Utils.showErrorToast("Please enter your date of birth.");
return;
}
},
fontFamily: context.fontFamily,
backgroundColor: Color(0xFFFEE9EA),
borderColor: Color(0xFFFEE9EA),
textColor: Color(0xFFED1C2B),
),
),
SizedBox(
width: 16,
),
Expanded(
child: CustomButton(
text: TranslationBase.of(context).confirm,
icon: "assets/images/svg/confirm.svg",
onPressed: () {
// // bool isValid = Utils.validateIqama(nationalIDorFile.text);
// if (nationalIDorFile == null) {
// Utils.showErrorToast("Please enter your national id.");
// return;
// }
// if (selectedDOB == null) {
// Utils.showErrorToast("Please enter your date of birth.");
// return;
// }
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(
textController: emailAddress,
isForEmail: true,
buttons: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(text: "Submit", onPressed: () {}, backgroundColor: Colors.red, borderColor: Colors.red, textColor: Colors.white),
),
],
),
),
),
);
},
fontFamily: context.fontFamily,
),
)
],
),
SizedBox(height: 14),
],
),
),
));
}
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,
),
),
),
],
)
],
);
}
void registerUser(int? value) {}
}