|
|
|
|
@ -47,6 +47,7 @@ class SMSOTP {
|
|
|
|
|
bool isClosed = false;
|
|
|
|
|
displayDialog(BuildContext context) async {
|
|
|
|
|
double dialogWidth = MediaQuery.of(context).size.width * 0.90;
|
|
|
|
|
double dialogInputWidth = (dialogWidth / 4) - (SizeConfig.isWidthLarge?SizeConfig.getWidthMultiplier(width:dialogWidth )* 4.5: 20);
|
|
|
|
|
double dialogHeight = SizeConfig.isHeightVeryShort ?MediaQuery.of(context).size.height * 0.50:MediaQuery.of(context).size.height * 0.40;
|
|
|
|
|
return showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
@ -56,222 +57,224 @@ class SMSOTP {
|
|
|
|
|
width: dialogWidth,
|
|
|
|
|
child: Material(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: StatefulBuilder(builder: (context, setState) {
|
|
|
|
|
if (displayTime == '') {
|
|
|
|
|
startTimer(setState);
|
|
|
|
|
}
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: StatefulBuilder(builder: (context, setState) {
|
|
|
|
|
if (displayTime == '') {
|
|
|
|
|
startTimer(setState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2,),
|
|
|
|
|
return Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2,),
|
|
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment
|
|
|
|
|
.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
type == AuthMethodTypes.SMS
|
|
|
|
|
? DoctorApp.verify_sms_1
|
|
|
|
|
: DoctorApp.verify_whtsapp,
|
|
|
|
|
size: dialogWidth * 0.13,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.close),
|
|
|
|
|
iconSize: dialogWidth * 0.13,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
this.isClosed = true;
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
this.onFailure();
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 10,),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 5, right: 5),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).verificationMessage +
|
|
|
|
|
' XXXXXX' +
|
|
|
|
|
mobileNo
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(mobileNo.toString().length - 3),
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5, //14,
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
)),
|
|
|
|
|
Form(
|
|
|
|
|
key: verifyAccountForm,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2),
|
|
|
|
|
child: Directionality(
|
|
|
|
|
textDirection: TextDirection.ltr,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment
|
|
|
|
|
.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
type == AuthMethodTypes.SMS
|
|
|
|
|
? DoctorApp.verify_sms_1
|
|
|
|
|
: DoctorApp.verify_whtsapp,
|
|
|
|
|
size: SizeConfig.getHeightMultiplier(height:dialogHeight) * 9,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: (dialogWidth / 4) - 20,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
textInputAction: TextInputAction
|
|
|
|
|
.next,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
autofocus: true,
|
|
|
|
|
maxLength: 1,
|
|
|
|
|
controller: digit1,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
|
context),
|
|
|
|
|
onSaved: (val) {},
|
|
|
|
|
validator: validateCodeDigit,
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD2);
|
|
|
|
|
},
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
if (val.length == 1) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD2);
|
|
|
|
|
verifyAccountFormValue['digit1'] =
|
|
|
|
|
val.trim();
|
|
|
|
|
checkValue();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: dialogWidth / 4 - 20,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
focusNode: focusD2,
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.close),
|
|
|
|
|
iconSize: SizeConfig.getHeightMultiplier(height:dialogHeight) * 15,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
this.isClosed = true;
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
this.onFailure();
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * (SizeConfig.isHeightVeryShort?10:5),),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 5, right: 5),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).verificationMessage +
|
|
|
|
|
' XXXXXX' +
|
|
|
|
|
mobileNo
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(mobileNo.toString().length - 3),
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5, //14,
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
)),
|
|
|
|
|
Form(
|
|
|
|
|
key: verifyAccountForm,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2),
|
|
|
|
|
child: Directionality(
|
|
|
|
|
textDirection: TextDirection.ltr,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: dialogInputWidth,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
textInputAction: TextInputAction
|
|
|
|
|
.next,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
autofocus: true,
|
|
|
|
|
maxLength: 1,
|
|
|
|
|
controller: digit2,
|
|
|
|
|
controller: digit1,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
keyboardType: TextInputType
|
|
|
|
|
.number,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
|
context),
|
|
|
|
|
onSaved: (val) {},
|
|
|
|
|
validator: validateCodeDigit,
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD3);
|
|
|
|
|
.requestFocus(focusD2);
|
|
|
|
|
},
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
if (val.length == 1) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD3);
|
|
|
|
|
verifyAccountFormValue['digit2'] =
|
|
|
|
|
.requestFocus(focusD2);
|
|
|
|
|
verifyAccountFormValue['digit1'] =
|
|
|
|
|
val.trim();
|
|
|
|
|
checkValue();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validator: validateCodeDigit),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
width: dialogWidth / 4 - 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: dialogInputWidth,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
focusNode: focusD3,
|
|
|
|
|
focusNode: focusD2,
|
|
|
|
|
textInputAction: TextInputAction
|
|
|
|
|
.next,
|
|
|
|
|
maxLength: 1,
|
|
|
|
|
controller: digit3,
|
|
|
|
|
controller: digit2,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
keyboardType: TextInputType
|
|
|
|
|
.number,
|
|
|
|
|
decoration:
|
|
|
|
|
buildInputDecoration(context),
|
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
|
context),
|
|
|
|
|
onSaved: (val) {},
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD4);
|
|
|
|
|
.requestFocus(focusD3);
|
|
|
|
|
},
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
if (val.length == 1) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD4);
|
|
|
|
|
verifyAccountFormValue['digit3'] =
|
|
|
|
|
.requestFocus(focusD3);
|
|
|
|
|
verifyAccountFormValue['digit2'] =
|
|
|
|
|
val.trim();
|
|
|
|
|
checkValue();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validator: validateCodeDigit)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
width: dialogWidth / 4 - 20,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
validator: validateCodeDigit),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
width: dialogInputWidth,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
focusNode: focusD3,
|
|
|
|
|
textInputAction: TextInputAction
|
|
|
|
|
.next,
|
|
|
|
|
maxLength: 1,
|
|
|
|
|
controller: digit3,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
keyboardType: TextInputType
|
|
|
|
|
.number,
|
|
|
|
|
decoration:
|
|
|
|
|
buildInputDecoration(context),
|
|
|
|
|
onSaved: (val) {},
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD4);
|
|
|
|
|
},
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
if (val.length == 1) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD4);
|
|
|
|
|
verifyAccountFormValue['digit3'] =
|
|
|
|
|
val.trim();
|
|
|
|
|
checkValue();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validator: validateCodeDigit)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
|
|
|
|
|
width: dialogInputWidth,
|
|
|
|
|
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
|
|
|
|
|
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
focusNode: focusD4,
|
|
|
|
|
maxLength: 1,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
controller: digit4,
|
|
|
|
|
keyboardType: TextInputType
|
|
|
|
|
.number,
|
|
|
|
|
decoration:
|
|
|
|
|
buildInputDecoration(context),
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD4);
|
|
|
|
|
},
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
if (val.length == 1) {
|
|
|
|
|
verifyAccountFormValue['digit4'] =
|
|
|
|
|
val.trim();
|
|
|
|
|
checkValue();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validator: validateCodeDigit)),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
focusNode: focusD4,
|
|
|
|
|
maxLength: 1,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: buildTextStyle(),
|
|
|
|
|
controller: digit4,
|
|
|
|
|
keyboardType: TextInputType
|
|
|
|
|
.number,
|
|
|
|
|
decoration:
|
|
|
|
|
buildInputDecoration(context),
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context)
|
|
|
|
|
.requestFocus(focusD4);
|
|
|
|
|
},
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
if (val.length == 1) {
|
|
|
|
|
verifyAccountFormValue['digit4'] =
|
|
|
|
|
val.trim();
|
|
|
|
|
checkValue();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validator: validateCodeDigit)),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).validationMessage +
|
|
|
|
|
' ',
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
displayTime,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
)
|
|
|
|
|
])
|
|
|
|
|
],
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).validationMessage +
|
|
|
|
|
' ',
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
displayTime,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5,
|
|
|
|
|
)
|
|
|
|
|
])
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|