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.
doctor_app_flutter/lib/widgets/auth/auth_header.dart

128 lines
4.3 KiB
Dart

import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_device_type/flutter_device_type.dart';
class AuthHeader extends StatelessWidget {
var userType;
AuthHeader(this.userType);
@override
Widget build(BuildContext context) {
var smallScreenSize = 660;
return LayoutBuilder(builder: (ctx, constraints) {
bool isSmallScreen = constraints.maxWidth <= smallScreenSize;
var screen = Container(
margin: isSmallScreen
? null
: EdgeInsetsDirectional.fromSTEB(constraints.maxWidth * 0.30,
constraints.maxWidth * 0.1, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: isSmallScreen
? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0)
: EdgeInsetsDirectional.fromSTEB(
constraints.maxWidth * 0.13, 0, 0, 0),
child: Image.asset(
'assets/images/login_icon.png',
fit: BoxFit.cover,
height:
isSmallScreen ? null : constraints.maxWidth * 0.09,
),
),
SizedBox(
height: 10,
),
Container(
margin: isSmallScreen
? null
: EdgeInsetsDirectional.fromSTEB(
constraints.maxWidth * 0.13, 0, 0, 0),
child: Text(
"LOGIN",
style: TextStyle(
fontSize:
isSmallScreen ? 30 : constraints.maxWidth * 0.035,
fontWeight: FontWeight.w800),
),
)
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: isSmallScreen
? <Widget>[
SizedBox(
height: 10,
),
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;
});
}
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,
fontWeight: FontWeight.w800,
color: Theme.of(context).primaryColor),
),
);
}
Text buildDrSulText(
bool isSmallScreen, BoxConstraints constraints, BuildContext context) {
return Text(
'Dr Sulaiman Al Habib',
style: TextStyle(
fontWeight: FontWeight.w800,
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),
);
}
}