fix sms pop up scrolling

merge-requests/709/head
Elham Rababah 5 years ago
parent 837ff69c82
commit 2b8caab71d

@ -17,6 +17,7 @@ class SizeConfig {
static bool isPortrait = true; static bool isPortrait = true;
static bool isMobilePortrait = false; static bool isMobilePortrait = false;
static bool isMobile = false; static bool isMobile = false;
static bool isHeightShort = false;
void init(BoxConstraints constraints, Orientation orientation) { void init(BoxConstraints constraints, Orientation orientation) {
realScreenHeight = constraints.maxHeight; realScreenHeight = constraints.maxHeight;
@ -26,6 +27,9 @@ class SizeConfig {
if (constraints.maxWidth <= MAX_SMALL_SCREEN) { if (constraints.maxWidth <= MAX_SMALL_SCREEN) {
isMobile = true; isMobile = true;
} }
if (constraints.maxHeight < 800) {
isHeightShort = true;
}
if (orientation == Orientation.portrait) { if (orientation == Orientation.portrait) {
isPortrait = true; isPortrait = true;
if (realScreenWidth < 450) { if (realScreenWidth < 450) {
@ -60,4 +64,29 @@ class SizeConfig {
print('isPortrait $isPortrait'); print('isPortrait $isPortrait');
print('isMobilePortrait $isMobilePortrait'); print('isMobilePortrait $isMobilePortrait');
} }
static getTextMultiplierBasedOnWidth({double width}){
// TODO handel LandScape case
if(width != null) {
return width / 100;
}
return widthMultiplier;
}
static getWidthMultiplier({double width}){
// TODO handel LandScape case
if(width != null) {
return width / 100;
}
return widthMultiplier;
}
static getHeightMultiplier({double height}){
// TODO handel LandScape case
if(height != null) {
return height / 100;
}
return heightMultiplier;
}
} }

@ -5,7 +5,9 @@ import 'package:doctor_app_flutter/core/enum/auth_method_types.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class SMSOTP { class SMSOTP {
@ -47,50 +49,46 @@ class SMSOTP {
String displayTime = ''; String displayTime = '';
bool isClosed = false; bool isClosed = false;
displayDialog(BuildContext context) async { displayDialog(BuildContext context) async {
double dialogWidth = MediaQuery.of(context).size.width * 0.84; double dialogWidth = MediaQuery.of(context).size.width * 0.90;
double dialogHeight = MediaQuery.of(context).size.height * 0.50; double dialogHeight = SizeConfig.isHeightShort ?MediaQuery.of(context).size.height * 0.50:MediaQuery.of(context).size.height * 0.40;
return showDialog( return showDialog(
context: context, context: context,
barrierColor: Colors.black.withOpacity(0.7), builder: (ctx) => Center(
builder: (context) { child: Container(
projectProvider = Provider.of(context); height: dialogHeight,
return AlertDialog( width: dialogWidth,
contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 0.0, 24.0), child: AppScaffold(
content: StatefulBuilder(builder: (context, setState) { isShowAppBar: false,
body: SingleChildScrollView(
child: Container(
color: Colors.white,
child: StatefulBuilder(builder: (context, setState) {
if (displayTime == '') { if (displayTime == '') {
startTimer(setState); startTimer(setState);
} }
return Container(
color: Colors.white, return Center(
height: dialogHeight, child: FractionallySizedBox(
width: dialogWidth, widthFactor: 0.9,
child: Center(
child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Padding( SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2,),
padding: EdgeInsets.all(13),
child: Row( Row(
mainAxisAlignment: MainAxisAlignment mainAxisAlignment: MainAxisAlignment
.spaceBetween, .spaceBetween,
children: [ children: [
Padding( Icon(
child: 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: dialogWidth * 0.13,
), ),
padding: EdgeInsets.only(bottom: 20),
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Padding( IconButton(
padding: EdgeInsets.only(
left: 10, right: 10, bottom: 20),
child: IconButton(
icon: Icon(Icons.close), icon: Icon(Icons.close),
iconSize: dialogWidth * 0.13, iconSize: dialogWidth * 0.13,
onPressed: () { onPressed: () {
@ -98,10 +96,11 @@ class SMSOTP {
Navigator.pop(context); Navigator.pop(context);
this.onFailure(); this.onFailure();
}, },
)) )
], ],
) )
])), ]),
SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 10,),
Padding( Padding(
padding: EdgeInsets.only(top: 5, right: 5), padding: EdgeInsets.only(top: 5, right: 5),
child: AppText( child: AppText(
@ -112,13 +111,13 @@ class SMSOTP {
.substring(mobileNo.toString().length - 3), .substring(mobileNo.toString().length - 3),
textAlign: TextAlign.start, textAlign: TextAlign.start,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5, //14,
maxLines: 2, maxLines: 2,
)), )),
Form( Form(
key: verifyAccountForm, key: verifyAccountForm,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2),
child: Directionality( child: Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Row( child: Row(
@ -126,8 +125,8 @@ class SMSOTP {
children: <Widget>[ children: <Widget>[
Container( Container(
width: (dialogWidth / 4) - 20, width: (dialogWidth / 4) - 20,
height: 100, height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
margin: EdgeInsets.all(5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
child: TextFormField( child: TextFormField(
textInputAction: TextInputAction textInputAction: TextInputAction
.next, .next,
@ -157,8 +156,10 @@ class SMSOTP {
), ),
), ),
Container( Container(
width: dialogWidth / 4 - 30, width: dialogWidth / 4 - 20,
margin: EdgeInsets.all(5), height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
child: TextFormField( child: TextFormField(
focusNode: focusD2, focusNode: focusD2,
textInputAction: TextInputAction textInputAction: TextInputAction
@ -188,8 +189,9 @@ class SMSOTP {
validator: validateCodeDigit), validator: validateCodeDigit),
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
width: dialogWidth / 4 - 30, width: dialogWidth / 4 - 20,
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
child: TextFormField( child: TextFormField(
focusNode: focusD3, focusNode: focusD3,
textInputAction: TextInputAction textInputAction: TextInputAction
@ -218,8 +220,10 @@ class SMSOTP {
}, },
validator: validateCodeDigit)), validator: validateCodeDigit)),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5),
width: dialogWidth / 4 - 30, width: dialogWidth / 4 - 20,
height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30,
child: TextFormField( child: TextFormField(
focusNode: focusD4, focusNode: focusD4,
maxLength: 1, maxLength: 1,
@ -246,9 +250,7 @@ class SMSOTP {
)), )),
), ),
), ),
Padding( Column(
padding: const EdgeInsets.all(12.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -256,7 +258,7 @@ class SMSOTP {
TranslationBase.of(context).validationMessage + TranslationBase.of(context).validationMessage +
' ', ' ',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5,
), ),
AppText( AppText(
displayTime, displayTime,
@ -265,19 +267,27 @@ class SMSOTP {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 14,
) )
]), ])
)
], ],
))), ),
),
); );
}),
})
),
),
),
),
),
); );
});
} }
TextStyle buildTextStyle() { TextStyle buildTextStyle() {
return TextStyle( return TextStyle(
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier * 2.5,
); );
} }

Loading…
Cancel
Save