@ -93,7 +93,6 @@ class _WelcomeLogin extends State<WelcomeLogin> {
var healthId ;
var healthId ;
int _selectedLanguage = 0 ;
int _selectedLanguage = 0 ;
@ override
@ override
void initState ( ) {
void initState ( ) {
isLoading = true ;
isLoading = true ;
@ -104,12 +103,12 @@ class _WelcomeLogin extends State<WelcomeLogin> {
sharedPref . setBool ( IS_ROBOT_INIT , false ) ;
sharedPref . setBool ( IS_ROBOT_INIT , false ) ;
sharedPref . remove ( CLINICS_LIST ) ;
sharedPref . remove ( CLINICS_LIST ) ;
if ( projectViewModel . isArabic ) {
if ( projectViewModel . isArabic ) {
_selectedLanguage = value ;
_selectedLanguage = 1 ;
projectViewModel . changeLanguage ( ' en ' ) ;
projectViewModel . changeLanguage ( ' en ' ) ;
locator < GAnalytics > ( ) . hamburgerMenu . logMenuItemClick ( ' change language to english ' ) ;
locator < GAnalytics > ( ) . hamburgerMenu . logMenuItemClick ( ' change language to english ' ) ;
} else {
} else {
_selectedLanguage = value ;
_selectedLanguage = 0 ;
projectViewModel . changeLanguage ( ' ar ' ) ;
projectViewModel . changeLanguage ( ' ar ' ) ;
locator < GAnalytics > ( ) . hamburgerMenu . logMenuItemClick ( ' change language to arabic ' ) ;
locator < GAnalytics > ( ) . hamburgerMenu . logMenuItemClick ( ' change language to arabic ' ) ;
}
}
@ -119,98 +118,103 @@ class _WelcomeLogin extends State<WelcomeLogin> {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
final initialProjectViewModel = Provider . of < ProjectViewModel > ( context , listen: false ) ;
projectViewModel = context . read < ProjectViewModel > ( ) ;
/ / final initialProjectViewModel = Provider . of < ProjectViewModel > ( context , listen: false ) ;
/ / _selectedLanguage = initialProjectViewModel . isArabic ? 0 : 1 ;
/ / _selectedLanguage = initialProjectViewModel . isArabic ? 0 : 1 ;
return Consumer2 < ProjectViewModel , ToDoCountProviderModel > (
return SafeArea (
builder: ( context , projectViewModel , toDoProvider , child ) {
child: AppScaffold (
_selectedLanguage = projectViewModel . isArabic ? 0 : 1 ;
appBarTitle: TranslationBase . of ( context ) . welcome ,
return AppScaffold (
isShowDecPage: false ,
appBarTitle: TranslationBase . of ( context ) . welcome ,
isShowAppBar: true ,
isShowDecPage: false ,
isshowBackButton: false ,
isShowAppBar: true ,
showNewAppBar: true ,
isshowBackButton: false ,
backgroundColor: Color ( 0xffF8F8F8 ) ,
showNewAppBar: true ,
showNewAppBarTitle: false ,
backgroundColor: Color ( 0xffF8F8F8 ) ,
showDropDown: true ,
showNewAppBarTitle: false ,
isShowLanguageChanger: true ,
showDropDown: true ,
appBarIcons: [ ] ,
isShowLanguageChanger: true ,
dropDownList: [
appBarIcons: [ ] ,
/ / TranslationBase . of ( context ) . arabicChange ,
dropDownList: [
/ / TranslationBase . of ( context ) . english ,
TranslationBase . of ( context ) . arabicChange ,
] ,
TranslationBase . of ( context ) . english ,
dropDownIndexChange: ( value ) {
] ,
changeLanguage ( projectViewModel , value ! ) ;
dropDownIndexChange: ( value ) {
} ,
changeLanguage ( projectViewModel , value ! ) ;
dropdownIndexValue: _selectedLanguage ,
} ,
/ / Use the state variable
dropdownIndexValue: _selectedLanguage ,
body: Column (
/ / Use the state variable
children: < Widget > [
body: Column (
Expanded (
children: < Widget > [
child: ListView (
Expanded (
padding: EdgeInsets . only ( left: 21 , right: 21 ) ,
child: ListView (
physics: BouncingScrollPhysics ( ) ,
padding: EdgeInsets . only ( left: 21 , right: 21 ) ,
children: [
physics: BouncingScrollPhysics ( ) ,
SizedBox ( height: 30 ) ,
children: [
Row (
SizedBox ( height: 30 ) ,
children: [
Row (
SvgPicture . asset (
children: [
" assets/images/new/hmg_icon.svg " ,
SvgPicture . asset (
height: 62 ,
" assets/images/new/hmg_icon.svg " ,
width: 62 ,
height: 62 ,
) ,
width: 62 ,
] ,
) ,
] ,
) ,
/ / Example of using toDoProvider:
/ / if ( toDoProvider . count > 0 ) Text ( " To-Do items: ${ toDoProvider . count } " ) ,
] ,
) ,
) ,
Spacer ( ) ,
Expanded (
child: Container (
padding: EdgeInsets . only ( top: 30 , bottom: 0 , right: 21 , left: 21 ) ,
child: Text (
" Welcome to Dr. Sulaiman Al Habib Medical Group " ,
style: TextStyle ( fontSize: 36 , fontWeight: FontWeight . w600 , color: Color ( 0xff2B353E ) , letterSpacing: - 0.4 , height: 47 / 36 ) ,
) ,
) ,
) ,
/ / Example of using toDoProvider:
/ / if ( toDoProvider . count > 0 ) Text ( " To-Do items: ${ toDoProvider . count } " ) ,
] ,
) ,
) ,
Container (
) ,
padding: EdgeInsets . only ( top: 16 , bottom: 10 , right: 21 , left: 21 ) ,
Spacer ( ) ,
child: Column (
Container (
crossAxisAlignment: CrossAxisAlignment . stretch ,
padding: EdgeInsets . only ( top: 30 , bottom: 0 , right: 21 , left: 21 ) ,
children: [
child: Text (
Directionality (
TranslationBase . of ( context ) . welcomeToDrSulaiman ,
textDirection: TextDirection . ltr , / / Consider making this dynamic based on language
style: TextStyle (
child: inputWidget (
fontSize: 36 ,
" National ID. or File No " ,
fontFamily: ( projectViewModel . currentLanguage = = ' ar ' ? ' Cairo ' : ' Poppins ' ) ,
" 1xxxxxxxx " ,
fontWeight: FontWeight . w600 ,
nationIdController , / / Assumed to be a TextEditingController in your State class
color: Color ( 0xff2B353E ) ,
isEnable: true ,
letterSpacing: - 0.4 ,
prefix: null ,
height: 47 / 36 ,
hasSelection: false ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
leadingIcon: " assets/images/svg/student-card.svg " ,
) ,
) ,
] ,
) ,
) ,
) ,
) ,
SizedBox (
) ,
height: 15 ,
Container (
padding: EdgeInsets . only ( top: 16 , bottom: 10 , right: 21 , left: 21 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . stretch ,
children: [
Directionality (
textDirection: TextDirection . ltr , / / Consider making this dynamic based on language
child: inputWidget (
" National ID. or File No " ,
" 1xxxxxxxx " ,
nationIdController , / / Assumed to be a TextEditingController in your State class
isEnable: true ,
prefix: null ,
hasSelection: false ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
leadingIcon: " assets/images/svg/student-card.svg " ,
) ,
) ,
] ,
) ,
) ,
Row (
) ,
mainAxisSize: MainAxisSize . min ,
SizedBox (
children: < Widget > [
height: 15 ,
Expanded (
) ,
child: Container (
Row (
padding: EdgeInsets . only ( top: 0 , bottom: 16 , right: 21 , left: 21 ) ,
mainAxisSize: MainAxisSize . min ,
child: DefaultButton (
children: < Widget > [
TranslationBase . of ( context ) . login ,
Expanded (
( ) {
child: Padding (
padding: const EdgeInsets . all ( 10.0 ) ,
child: CustomButton (
text: TranslationBase . of ( context ) . login ,
icon: " assets/images/svg/login1.svg " ,
onPressed: ( ) {
bool isValid = validateIqama ( nationIdController . text ) ;
bool isValid = validateIqama ( nationIdController . text ) ;
print ( " Iqama is valid: $ isValid " ) ;
print ( " Iqama is valid: $ isValid " ) ;
@ -280,53 +284,56 @@ class _WelcomeLogin extends State<WelcomeLogin> {
} else {
} else {
Utils . showErrorToast ( " Please enter a valid Iqama number. " ) ;
Utils . showErrorToast ( " Please enter a valid Iqama number. " ) ;
}
}
} ,
} ) ,
textColor: Colors . white ,
) ,
) ,
) ,
) ,
] ,
) ,
) ,
] ,
Row (
) ,
crossAxisAlignment: CrossAxisAlignment . center ,
Row (
mainAxisAlignment: MainAxisAlignment . center ,
crossAxisAlignment: CrossAxisAlignment . center ,
children: [
mainAxisAlignment: MainAxisAlignment . center ,
RichText (
children: [
textAlign: TextAlign . center ,
RichText (
text: TextSpan (
textAlign: TextAlign . center ,
style: TextStyle (
text: TextSpan (
color: Colors . black ,
style: TextStyle (
fontSize: 16 ,
color: Colors . black ,
height: 26 / 16 ,
fontSize: 16 ,
fontFamily: ' poppins ' ,
height: 26 / 16 ,
fontWeight: FontWeight . w500 ,
fontFamily: ' poppins ' ,
fontWeight: FontWeight . w500 ,
) ,
children: < TextSpan > [
TextSpan (
text: TranslationBase . of ( context ) . dontHaveAccount ,
) ,
) ,
children: < TextSpan > [
TextSpan ( text: " " ) ,
TextSpan ( text: ' Don’ t have an account? ' ) ,
TextSpan (
TextSpan (
text: TranslationBase . of ( context ) . registerNow ,
text: ' Register now ' ,
style: const TextStyle (
style: const TextStyle (
color: Colors . red ,
color: Colors . red ,
fontSize: 16 ,
fontSize: 16 ,
height: 26 / 16 ,
height: 26 / 16 ,
fontFamily: ' poppins ' ,
fontFamily: ' poppins ' ,
fontWeight: FontWeight . w500 ,
fontWeight: FontWeight . w500 ,
) ,
recognizer: TapGestureRecognizer ( )
. . onTap = ( ) {
Navigator . of ( context ) . push ( FadePage ( page: RegisterNew ( ) ) ) ;
locator < GAnalytics > ( ) . loginRegistration . visited_alhabib_group ( true ) ;
} ,
) ,
) ,
] ,
recognizer: TapGestureRecognizer ( )
) ,
. . onTap = ( ) {
Navigator . of ( context ) . push ( FadePage ( page: RegisterNew ( ) ) ) ;
locator < GAnalytics > ( ) . loginRegistration . visited_alhabib_group ( true ) ;
} ,
) ,
] ,
) ,
) ,
] ,
) ,
)
] ,
] ,
) ,
) ,
SizedBox (
) ;
height: 10 ,
} ,
) ,
] ,
) ,
) ,
) ;
) ;
}
}