fix sms popup

middle_screen
Elham Rababah 5 years ago
parent a5ea23c38e
commit 3d5bb08adf

@ -19,6 +19,7 @@ class SizeConfig {
static bool isMobile = false; static bool isMobile = false;
static bool isHeightShort = false; static bool isHeightShort = false;
static bool isHeightVeryShort = false; static bool isHeightVeryShort = false;
static bool isWidthLarge = false;
void init(BoxConstraints constraints, Orientation orientation) { void init(BoxConstraints constraints, Orientation orientation) {
realScreenHeight = constraints.maxHeight; realScreenHeight = constraints.maxHeight;
@ -32,20 +33,21 @@ class SizeConfig {
} else if (constraints.maxHeight < 800) { } else if (constraints.maxHeight < 800) {
isHeightShort = true; isHeightShort = true;
} }
if(constraints.maxWidth > 600) {
isWidthLarge = true;
}
if (orientation == Orientation.portrait) { if (orientation == Orientation.portrait) {
isPortrait = true; isPortrait = true;
if (realScreenWidth < 450) { if (realScreenWidth < 450) {
isMobilePortrait = true; isMobilePortrait = true;
} }
// textMultiplier = _blockHeight;
// imageSizeMultiplier = _blockWidth;
screenHeight = realScreenHeight; screenHeight = realScreenHeight;
screenWidth = realScreenWidth; screenWidth = realScreenWidth;
} else { } else {
isPortrait = false; isPortrait = false;
isMobilePortrait = false; isMobilePortrait = false;
// textMultiplier = _blockWidth;
// imageSizeMultiplier = _blockHeight;
screenHeight = realScreenWidth; screenHeight = realScreenWidth;
screenWidth = realScreenHeight; screenWidth = realScreenHeight;
} }

@ -24,7 +24,7 @@ class Label extends StatelessWidget {
children: [ children: [
AppText( AppText(
firstLine, firstLine,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3 , fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *(SizeConfig.isWidthLarge?2:3) ,
// fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
color: color, color: color,
fontHeight: .5, fontHeight: .5,

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

Loading…
Cancel
Save