import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import '../../config/size_config.dart'; import '../../lookups/auth_lookup.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.screenWidth * 0.30, SizeConfig.screenWidth * 0.1, 0, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: SizeConfig.isMobile ? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0) : EdgeInsetsDirectional.fromSTEB( SizeConfig.screenWidth * 0.13, 0, 0, 0), child: buildImageLogo(), ), SizedBox( height: 10, ), Container( margin: SizeConfig.isMobile ? null : EdgeInsetsDirectional.fromSTEB( SizeConfig.screenWidth * 0.13, 0, 0, 0), child: buildTextUnderLogo(context), ) ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: SizeConfig.isMobile ? [ SizedBox( height: 10, ), buildWelText(), buildDrSulText(context), ] : [ SizedBox( height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ buildWelText(), buildDrSulText(context), ], ), ], ), buildDrAppContainer(context) ], )); return screen; } Image buildImageLogo() { String img = 'assets/images/login_icon.png'; if (userType == loginType.unknownUser) { img = 'assets/images/welcome_login_icon.png'; } if (userType == loginType.verifyPassword) { img = 'assets/images/verified_icon.png'; } return Image.asset( img, fit: BoxFit.cover, height: SizeConfig.isMobile ? null : SizeConfig.screenWidth * 0.09, ); } Widget buildTextUnderLogo(context) { if (userType == loginType.knownUser || userType == loginType.unknownUser) { return Text( "LOGIN", style: TextStyle( fontSize: SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035, fontWeight: FontWeight.w800), ); } else { String text1; String text2; if (userType == loginType.changePassword) { text1 = 'Change'; text2 = 'Password!'; } if (userType == loginType.verifyPassword) { text1 = 'verify'; text2 = 'Your Account!'; } return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( text1, style: TextStyle( fontSize: SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035, fontWeight: FontWeight.w800), ), Text( text2, style: TextStyle( color: Theme.of(context).primaryColor, fontSize: SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035, fontWeight: FontWeight.w800), ) ], ); } } Container buildDrAppContainer(BuildContext context) { if (userType == loginType.changePassword || userType == loginType.verifyPassword ) { return Container(); } return Container( margin: SizeConfig.isMobile ? null : EdgeInsetsDirectional.fromSTEB( SizeConfig.screenWidth * 0.13, 0, 0, 0), child: Text( "Doctor App", style: TextStyle( fontSize: SizeConfig.isMobile ? 26 : SizeConfig.screenWidth * 0.030, fontWeight: FontWeight.w800, color: Theme.of(context).primaryColor), ), ); } Text buildDrSulText(BuildContext context) { if (userType == loginType.changePassword || userType == loginType.verifyPassword ) { return Text(''); } return Text( 'Dr Sulaiman Al Habib', style: TextStyle( fontWeight: FontWeight.w800, fontSize: SizeConfig.isMobile ? 24 : SizeConfig.screenWidth * 0.029, color: Theme.of(context).primaryColor, ), ); } Widget buildWelText() { String text = 'Welcome to '; if (userType == loginType.unknownUser) { text = 'Welcome Back to '; } if (userType == loginType.changePassword || userType == loginType.verifyPassword ) { return Text(''); } return Text( text, style: TextStyle( fontSize: SizeConfig.isMobile ? 24 : SizeConfig.screenWidth * 0.029), ); } }