textfiled design

merge-requests/913/head
hussam al-habibeh 4 years ago
parent fbaeb1b361
commit bd7e683900

@ -12,9 +12,8 @@ class SizeConfig {
static double textMultiplier; static double textMultiplier;
static double imageSizeMultiplier; static double imageSizeMultiplier;
static double heightMultiplier; static double heightMultiplier;
static double widthMultiplier;
static bool isPortrait = true; static bool isPortrait = true;
static double widthMultiplier;
static bool isMobilePortrait = false; static bool isMobilePortrait = false;
static bool isMobile = false; static bool isMobile = false;
static bool isHeightShort = false; static bool isHeightShort = false;
@ -75,8 +74,6 @@ class SizeConfig {
print('widthMultiplier $widthMultiplier'); print('widthMultiplier $widthMultiplier');
print('isPortrait $isPortrait'); print('isPortrait $isPortrait');
print('isMobilePortrait $isMobilePortrait'); print('isMobilePortrait $isMobilePortrait');
} }
static getTextMultiplierBasedOnWidth({double width}) { static getTextMultiplierBasedOnWidth({double width}) {
@ -102,5 +99,4 @@ class SizeConfig {
} }
return heightMultiplier; return heightMultiplier;
} }
} }

@ -16,7 +16,6 @@ import 'package:provider/provider.dart';
import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart';
class LoginScreen extends StatefulWidget { class LoginScreen extends StatefulWidget {
@override @override
_LoginScreenState createState() => _LoginScreenState(); _LoginScreenState createState() => _LoginScreenState();
@ -55,151 +54,127 @@ class _LoginScreenState extends State<LoginScreen> {
children: <Widget>[ children: <Widget>[
//TODO Use App Text rather than text //TODO Use App Text rather than text
Container( Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.start,
.start, children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Column( SizedBox(
crossAxisAlignment: CrossAxisAlignment height: 30,
.start,
children: <Widget>[
SizedBox(
height: 30,
),
],
), ),
Column( ],
crossAxisAlignment: CrossAxisAlignment ),
.start, children: [ Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Text( Text(
TranslationBase TranslationBase.of(context).welcomeTo,
.of(context)
.welcomeTo,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight fontWeight: FontWeight.w600,
.w600,
fontFamily: 'Poppins'), fontFamily: 'Poppins'),
), ),
Text( Text(
TranslationBase TranslationBase.of(context)
.of(context)
.drSulaimanAlHabib, .drSulaimanAlHabib,
style: TextStyle( style: TextStyle(
color:Color(0xFF2B353E), color: Color(0xFF2B353E),
fontWeight: FontWeight fontWeight: FontWeight.bold,
.bold, fontSize: SizeConfig.isMobile
fontSize: SizeConfig
.isMobile
? 24 ? 24
: SizeConfig : SizeConfig.realScreenWidth *
.realScreenWidth * 0.029,
0.029,
fontFamily: 'Poppins'), fontFamily: 'Poppins'),
), ),
Text( Text(
"Doctor App", "Doctor App",
style: TextStyle( style: TextStyle(
fontSize: fontSize: SizeConfig.isMobile
SizeConfig.isMobile
? 16 ? 16
: SizeConfig : SizeConfig.realScreenWidth *
.realScreenWidth * 0.030,
0.030, fontWeight: FontWeight.w600,
fontWeight: FontWeight
.w600,
color: Color(0xFFD02127)), color: Color(0xFFD02127)),
), ),
]), ]),
], ],
)), )),
SizedBox( SizedBox(
height: 40, height: 40,
), ),
Form( Form(
key: loginFormKey, key: loginFormKey,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment mainAxisAlignment: MainAxisAlignment.spaceBetween,
.spaceBetween,
children: <Widget>[ children: <Widget>[
Container( Container(
width: SizeConfig width: SizeConfig.realScreenWidth * 0.90,
.realScreenWidth * 0.90, height: SizeConfig.realScreenHeight * 0.65,
height: SizeConfig child: Column(
.realScreenHeight * 0.65, crossAxisAlignment:
child: CrossAxisAlignment.start,
Column( children: [
crossAxisAlignment: CrossAxisAlignment buildSizedBox(),
.start, children: [ AppTextFieldCustom(
hintText:
buildSizedBox(), TranslationBase.of(context).enterId,
AppTextFieldCustom( hasBorder: true,
hintText: TranslationBase.of(context).enterId, controller: userIdController,
hasBorder: true, onChanged: (value) {
controller: userIdController, if (value != null)
onChanged: (value){ setState(() {
if (value != null) authenticationViewModel.userInfo
setState(() { .userID = value.trim();
authenticationViewModel.userInfo });
.userID = },
value ),
.trim(); buildSizedBox(),
}); AppTextFieldCustom(
}, hintText: TranslationBase.of(context)
), .enterPassword,
buildSizedBox(), hasBorder: true,
AppTextFieldCustom( isSecure: true,
hintText: TranslationBase.of(context).enterPassword, controller: passwordController,
hasBorder: true, onChanged: (value) {
isSecure: true, if (value != null)
controller: passwordController, setState(() {
onChanged: (value){ authenticationViewModel.userInfo
if (value != null) .password = value.trim();
setState(() { });
authenticationViewModel.userInfo // if(allowCallApi) {
.password = this.getProjects(
value authenticationViewModel
.trim(); .userInfo.userID);
}); // setState(() {
// if(allowCallApi) { // allowCallApi = false;
this.getProjects( // });
authenticationViewModel.userInfo // }
.userID); },
// setState(() { onClick: () {},
// allowCallApi = false; ),
// }); buildSizedBox(),
// } AppTextFieldCustom(
}, hintText: TranslationBase.of(context)
onClick: (){ .selectYourProject,
hasBorder: true,
}, controller: projectIdController,
), isTextFieldHasSuffix: true,
buildSizedBox(), enabled: false,
AppTextFieldCustom( onClick: () {
hintText: TranslationBase.of(context).selectYourProject, Helpers.showCupertinoPicker(
hasBorder: true, context,
controller: projectIdController, projectsList,
isTextFieldHasSuffix: true, 'facilityName',
enabled: false, onSelectProject,
onClick: (){ authenticationViewModel);
Helpers },
.showCupertinoPicker( ),
context, buildSizedBox()
projectsList, ]),
'facilityName',
onSelectProject,
authenticationViewModel);
},
),
buildSizedBox()
]),
), ),
], ],
), ),
@ -210,7 +185,6 @@ class _LoginScreenState extends State<LoginScreen> {
]), ]),
), ),
bottomSheet: Container( bottomSheet: Container(
height: 90, height: 90,
width: double.infinity, width: double.infinity,
child: Center( child: Center(
@ -220,26 +194,23 @@ class _LoginScreenState extends State<LoginScreen> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
AppButton( AppButton(
title: TranslationBase title: TranslationBase.of(context).login,
.of(context)
.login,
color: Color(0xFFD02127), color: Color(0xFFD02127),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
disabled: authenticationViewModel.userInfo disabled: authenticationViewModel.userInfo.userID == null ||
.userID == null || authenticationViewModel.userInfo.password == null,
authenticationViewModel.userInfo
.password ==
null,
onPressed: () { onPressed: () {
login(context); login(context);
}, },
), ),
SizedBox(
SizedBox(height: 25,) height: 25,
)
], ],
), ),
), ),
),), ),
),
); );
} }
@ -249,7 +220,9 @@ class _LoginScreenState extends State<LoginScreen> {
); );
} }
login(context,) async { login(
context,
) async {
if (loginFormKey.currentState.validate()) { if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save(); loginFormKey.currentState.save();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -259,7 +232,7 @@ class _LoginScreenState extends State<LoginScreen> {
Helpers.showErrorToast(authenticationViewModel.error); Helpers.showErrorToast(authenticationViewModel.error);
} else { } else {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
authenticationViewModel.setUnverified(true,isFromLogin: true); authenticationViewModel.setUnverified(true, isFromLogin: true);
// Navigator.of(context).pushReplacement( // Navigator.of(context).pushReplacement(
// MaterialPageRoute( // MaterialPageRoute(
// builder: (BuildContext context) => // builder: (BuildContext context) =>
@ -275,22 +248,25 @@ class _LoginScreenState extends State<LoginScreen> {
onSelectProject(index) { onSelectProject(index) {
setState(() { setState(() {
authenticationViewModel.userInfo.projectID = projectsList[index].facilityId; authenticationViewModel.userInfo.projectID =
projectsList[index].facilityId;
projectIdController.text = projectsList[index].facilityName; projectIdController.text = projectsList[index].facilityName;
}); });
primaryFocus.unfocus(); primaryFocus.unfocus();
} }
String memberID ="";
getProjects(memberID)async { String memberID = "";
getProjects(memberID) async {
if (memberID != null && memberID != '') { if (memberID != null && memberID != '') {
if (this.memberID !=memberID) { if (this.memberID != memberID) {
this.memberID = memberID; this.memberID = memberID;
await authenticationViewModel.getHospitalsList(memberID); await authenticationViewModel.getHospitalsList(memberID);
if(authenticationViewModel.state == ViewState.Idle) { if (authenticationViewModel.state == ViewState.Idle) {
projectsList = authenticationViewModel.hospitals; projectsList = authenticationViewModel.hospitals;
setState(() { setState(() {
authenticationViewModel.userInfo.projectID = projectsList[0].facilityId; authenticationViewModel.userInfo.projectID =
projectsList[0].facilityId;
projectIdController.text = projectsList[0].facilityName; projectIdController.text = projectsList[0].facilityName;
}); });
} }

@ -130,10 +130,11 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
// marginTop: widget.hasHintmargin ? 0 : 30, // marginTop: widget.hasHintmargin ? 0 : 30,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: widget.isPrscription == false fontSize: widget.isPrscription == false
? SizeConfig.getHeightMultiplier() * ? 11.0
(SizeConfig.isWidthLarge ? 1.1 : 1.3) // SizeConfig.getHeightMultiplier() *
// (SizeConfig.isWidthLarge ? 1.1 : 1.3)
: 0, : 0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w500,
), ),
widget.dropDownText == null widget.dropDownText == null
? Container( ? Container(

Loading…
Cancel
Save