You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
6.1 KiB
Dart
198 lines
6.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import '../../config/size_config.dart';
|
|
import '../../lookups/auth_lookup.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
class AuthHeader extends StatelessWidget {
|
|
var userType;
|
|
AuthHeader(this.userType);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var screen = Container(
|
|
margin: SizeConfig.isMobile
|
|
? null
|
|
: EdgeInsetsDirectional.fromSTEB(SizeConfig.realScreenWidth * 0.30,
|
|
SizeConfig.realScreenWidth * 0.1, 0, 0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
margin: SizeConfig.isMobile
|
|
? EdgeInsetsDirectional.fromSTEB(
|
|
0, SizeConfig.realScreenHeight * 0.03, 0, 0)
|
|
: EdgeInsetsDirectional.fromSTEB(
|
|
SizeConfig.realScreenWidth * 0.13, 0, 0, 0),
|
|
child: buildImageLogo(),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
buildTextUnderLogo(context),
|
|
],
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: SizeConfig.isMobile
|
|
? <Widget>[
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
buildWelText(context),
|
|
buildDrSulText(context),
|
|
]
|
|
: <Widget>[
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
buildWelText(context),
|
|
buildDrSulText(context),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
buildDrAppContainer(context)
|
|
],
|
|
));
|
|
return screen;
|
|
}
|
|
|
|
Image buildImageLogo() {
|
|
String img = 'assets/images/dr_app_logo.png';
|
|
return Image.asset(
|
|
img,
|
|
fit: BoxFit.cover,
|
|
height: SizeConfig.isMobile ? null : SizeConfig.realScreenWidth * 0.09,
|
|
);
|
|
}
|
|
|
|
Widget buildTextUnderLogo(context) {
|
|
Widget finalWid;
|
|
double textFontSize =
|
|
SizeConfig.isMobile ? 30 : SizeConfig.textMultiplier * 3;
|
|
EdgeInsetsDirectional containerMargin;
|
|
if (userType == loginType.knownUser || userType == loginType.unknownUser) {
|
|
finalWid = Text(
|
|
TranslationBase.of(context).login,
|
|
style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800),
|
|
);
|
|
} else {
|
|
String text1;
|
|
String text2;
|
|
if (userType == loginType.changePassword) {
|
|
text1 = 'Change ';
|
|
text2 = 'Password!';
|
|
}
|
|
if (userType == loginType.verifyPassword) {
|
|
text1 = TranslationBase.of(context).verify1;
|
|
text2 = TranslationBase.of(context).yourAccount;
|
|
}
|
|
if (userType == loginType.verificationMethods) {
|
|
text1 = TranslationBase.of(context).choose;
|
|
text2 = TranslationBase.of(context).verification;
|
|
}
|
|
List<Widget> childrens = <Widget>[
|
|
Text(
|
|
text1,
|
|
style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800),
|
|
),
|
|
Text(
|
|
text2,
|
|
style: TextStyle(
|
|
color: HexColor('#B8382C'),
|
|
fontSize: textFontSize,
|
|
fontWeight: FontWeight.w800),
|
|
)
|
|
];
|
|
|
|
if (!SizeConfig.isMobile) {
|
|
finalWid = Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: childrens,
|
|
);
|
|
} else {
|
|
finalWid = Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: childrens,
|
|
);
|
|
}
|
|
}
|
|
if (!SizeConfig.isMobile) {
|
|
double start = SizeConfig.realScreenWidth * 0.13;
|
|
if (loginType.verifyPassword == userType ||
|
|
loginType.changePassword == userType ||
|
|
userType == loginType.verificationMethods) {
|
|
start = 0;
|
|
}
|
|
containerMargin = EdgeInsetsDirectional.fromSTEB(start, 0, 0, 0);
|
|
}
|
|
|
|
return Container(margin: containerMargin, child: finalWid);
|
|
}
|
|
|
|
Container buildDrAppContainer(BuildContext context) {
|
|
if (userType == loginType.changePassword ||
|
|
userType == loginType.verifyPassword ||
|
|
userType == loginType.verificationMethods) {
|
|
return Container();
|
|
}
|
|
return Container(
|
|
margin: SizeConfig.isMobile
|
|
? null
|
|
: EdgeInsetsDirectional.fromSTEB(
|
|
SizeConfig.realScreenWidth * 0.13, 0, 0, 0),
|
|
child: Text(
|
|
"Doctor App",
|
|
style: TextStyle(
|
|
fontSize:
|
|
SizeConfig.isMobile ? 26 : SizeConfig.realScreenWidth * 0.030,
|
|
fontWeight: FontWeight.w800,
|
|
color: HexColor('#B8382C')),
|
|
),
|
|
);
|
|
}
|
|
|
|
Text buildDrSulText(BuildContext context) {
|
|
if (userType == loginType.changePassword ||
|
|
userType == loginType.verifyPassword ||
|
|
userType == loginType.verificationMethods) {
|
|
return Text('');
|
|
}
|
|
return Text(
|
|
TranslationBase.of(context).drSulaimanAlHabib,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w800,
|
|
fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029,
|
|
color: HexColor('#B8382C'),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget buildWelText(BuildContext context) {
|
|
String text = TranslationBase.of(context).welcomeTo;
|
|
if (userType == loginType.unknownUser) {
|
|
text = TranslationBase.of(context).welcomeBackTo;
|
|
}
|
|
if (userType == loginType.changePassword ||
|
|
userType == loginType.verifyPassword ||
|
|
userType == loginType.verificationMethods) {
|
|
return Text('');
|
|
}
|
|
return Text(
|
|
text,
|
|
style: TextStyle(
|
|
fontSize:
|
|
SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029),
|
|
);
|
|
}
|
|
}
|