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,6 +57,7 @@ class SMSOTP {
width: dialogWidth, width: dialogWidth,
child: Material( child: Material(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Center(
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: StatefulBuilder(builder: (context, setState) { child: StatefulBuilder(builder: (context, setState) {
@ -79,14 +81,14 @@ class SMSOTP {
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>[ children: <Widget>[
IconButton( IconButton(
icon: Icon(Icons.close), icon: Icon(Icons.close),
iconSize: dialogWidth * 0.13, iconSize: SizeConfig.getHeightMultiplier(height:dialogHeight) * 15,
onPressed: () { onPressed: () {
this.isClosed = true; this.isClosed = true;
Navigator.pop(context); Navigator.pop(context);
@ -96,7 +98,7 @@ class SMSOTP {
], ],
) )
]), ]),
SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 10,), SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * (SizeConfig.isHeightVeryShort?10:5),),
Padding( Padding(
padding: EdgeInsets.only(top: 5, right: 5), padding: EdgeInsets.only(top: 5, right: 5),
child: AppText( child: AppText(
@ -120,7 +122,7 @@ class SMSOTP {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
width: (dialogWidth / 4) - 20, width: dialogInputWidth,
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
child: TextFormField( child: TextFormField(
@ -152,7 +154,7 @@ class SMSOTP {
), ),
), ),
Container( Container(
width: dialogWidth / 4 - 20, width: dialogInputWidth,
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
@ -186,7 +188,7 @@ class SMSOTP {
), ),
Container( Container(
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
width: dialogWidth / 4 - 20, width: dialogInputWidth,
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
child: TextFormField( child: TextFormField(
focusNode: focusD3, focusNode: focusD3,
@ -217,7 +219,7 @@ class SMSOTP {
validator: validateCodeDigit)), validator: validateCodeDigit)),
Container( Container(
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
width: dialogWidth / 4 - 20, width: dialogInputWidth,
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
child: TextFormField( child: TextFormField(
@ -261,7 +263,7 @@ class SMSOTP {
color: Colors.red, color: Colors.red,
textAlign: TextAlign.start, textAlign: TextAlign.start,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5,
) )
]) ])
], ],
@ -277,6 +279,7 @@ class SMSOTP {
), ),
), ),
), ),
),
); );
} }

Loading…
Cancel
Save