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, ), 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) { Widget finalWid; double textFontSize = SizeConfig.isMobile ? 30 : SizeConfig.textMultiplier * 3; EdgeInsetsDirectional containerMargin; if (userType == loginType.knownUser || userType == loginType.unknownUser) { finalWid = Text( "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 = 'Verify '; text2 = 'Your Account!'; } List childrens = [ Text( text1, style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), ), Text( text2, style: TextStyle( color: Theme.of(context).primaryColor, 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.screenWidth * 0.13; if (loginType.verifyPassword == userType || loginType.changePassword == userType) { 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) { 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), ); } }