improve the auth header
parent
1abdf8e721
commit
24c87dc2b1
@ -0,0 +1 @@
|
|||||||
|
enum loginType { knownUser, unknownUser }
|
||||||
@ -1,100 +1,125 @@
|
|||||||
|
import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter_device_type/flutter_device_type.dart';
|
import 'package:flutter_device_type/flutter_device_type.dart';
|
||||||
|
|
||||||
class AuthHeader extends StatelessWidget {
|
class AuthHeader extends StatelessWidget {
|
||||||
const AuthHeader({
|
var userType;
|
||||||
Key key,
|
AuthHeader(this.userType);
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print(Device.get().isPhone);
|
|
||||||
print(Device.get().isAndroid);
|
|
||||||
print(Device.get().isIos);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var smallScreenSize = 660;
|
var smallScreenSize = 660;
|
||||||
return LayoutBuilder(builder: (ctx, constraints) {
|
return LayoutBuilder(builder: (ctx, constraints) {
|
||||||
|
bool isSmallScreen = constraints.maxWidth <= smallScreenSize;
|
||||||
bool isSmallScreen = constraints.maxWidth<=smallScreenSize;
|
|
||||||
var screen = Container(
|
var screen = Container(
|
||||||
margin: isSmallScreen?null:EdgeInsetsDirectional.fromSTEB(constraints.maxWidth*0.30, constraints.maxWidth*0.1, 0, 0),
|
margin: isSmallScreen
|
||||||
child: Column(
|
? null
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
: EdgeInsetsDirectional.fromSTEB(constraints.maxWidth * 0.30,
|
||||||
children: <Widget>[
|
constraints.maxWidth * 0.1, 0, 0),
|
||||||
Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Column(
|
||||||
margin: isSmallScreen?EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0):EdgeInsetsDirectional.fromSTEB(constraints.maxWidth*0.13, 0, 0, 0),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Image.asset(
|
children: <Widget>[
|
||||||
'assets/images/login_icon.png',
|
Container(
|
||||||
fit: BoxFit.cover,
|
margin: isSmallScreen
|
||||||
height: isSmallScreen?null: constraints.maxWidth*0.09,
|
? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0)
|
||||||
),
|
: EdgeInsetsDirectional.fromSTEB(
|
||||||
),
|
constraints.maxWidth * 0.13, 0, 0, 0),
|
||||||
SizedBox(
|
child: Image.asset(
|
||||||
height: 10,
|
'assets/images/login_icon.png',
|
||||||
),
|
fit: BoxFit.cover,
|
||||||
Container(
|
height:
|
||||||
margin: isSmallScreen?null:EdgeInsetsDirectional.fromSTEB(constraints.maxWidth*0.13, 0, 0, 0),
|
isSmallScreen ? null : constraints.maxWidth * 0.09,
|
||||||
child: Text(
|
),
|
||||||
"LOGIN",
|
),
|
||||||
style: TextStyle(fontSize: isSmallScreen?30:constraints.maxWidth*0.035, fontWeight: FontWeight.w800),
|
SizedBox(
|
||||||
),
|
height: 10,
|
||||||
)
|
),
|
||||||
],
|
Container(
|
||||||
),
|
margin: isSmallScreen
|
||||||
Column(
|
? null
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
: EdgeInsetsDirectional.fromSTEB(
|
||||||
|
constraints.maxWidth * 0.13, 0, 0, 0),
|
||||||
children: isSmallScreen?<Widget>[
|
child: Text(
|
||||||
SizedBox(
|
"LOGIN",
|
||||||
height: 10,
|
style: TextStyle(
|
||||||
),
|
fontSize:
|
||||||
Text(
|
isSmallScreen ? 30 : constraints.maxWidth * 0.035,
|
||||||
"Welcome to",
|
fontWeight: FontWeight.w800),
|
||||||
style: TextStyle(fontSize: isSmallScreen?24:constraints.maxWidth*0.029),
|
),
|
||||||
),
|
)
|
||||||
Text(
|
],
|
||||||
'Dr Sulaiman Al Habib',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: isSmallScreen?24:constraints.maxWidth*0.029,
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
]:<Widget>[SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
"Welcome to ",
|
|
||||||
style: TextStyle(fontSize: isSmallScreen?24:constraints.maxWidth*0.029),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Dr Sulaiman Al Habib',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: isSmallScreen?24:constraints.maxWidth*0.029,
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
),
|
),
|
||||||
),
|
Column(
|
||||||
],
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),Container(
|
children: isSmallScreen
|
||||||
margin: isSmallScreen?null:EdgeInsetsDirectional.fromSTEB(constraints.maxWidth*0.13, 0, 0, 0),
|
? <Widget>[
|
||||||
child: Text(
|
SizedBox(
|
||||||
"Doctor App",
|
height: 10,
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: isSmallScreen?26:constraints.maxWidth*0.030, color: Theme.of(context).primaryColor),
|
buildWelText(isSmallScreen, constraints),
|
||||||
|
buildDrSulText(isSmallScreen, constraints, context),
|
||||||
|
]
|
||||||
|
: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
buildWelText(isSmallScreen, constraints),
|
||||||
|
buildDrSulText(isSmallScreen, constraints, context),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
)],
|
buildDrAppContainer(isSmallScreen, constraints, context)
|
||||||
)
|
],
|
||||||
],
|
));
|
||||||
));
|
|
||||||
return screen;
|
return screen;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Container buildDrAppContainer(
|
||||||
|
bool isSmallScreen, BoxConstraints constraints, BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: isSmallScreen
|
||||||
|
? null
|
||||||
|
: EdgeInsetsDirectional.fromSTEB(
|
||||||
|
constraints.maxWidth * 0.13, 0, 0, 0),
|
||||||
|
child: Text(
|
||||||
|
"Doctor App",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isSmallScreen ? 26 : constraints.maxWidth * 0.030,
|
||||||
|
color: Theme.of(context).primaryColor),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Text buildDrSulText(
|
||||||
|
bool isSmallScreen, BoxConstraints constraints, BuildContext context) {
|
||||||
|
return Text(
|
||||||
|
'Dr Sulaiman Al Habib',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isSmallScreen ? 24 : constraints.maxWidth * 0.029,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Text buildWelText(bool isSmallScreen, BoxConstraints constraints) {
|
||||||
|
String text = 'Welcome to ';
|
||||||
|
if (userType == loginType.unknownUser) {
|
||||||
|
text = 'Welcome Back to';
|
||||||
|
}
|
||||||
|
|
||||||
|
return Text(
|
||||||
|
text,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isSmallScreen ? 24 : constraints.maxWidth * 0.029),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue