diff --git a/lib/data/di/service_locator.config.dart b/lib/data/di/service_locator.config.dart index bf31112e..3b29259e 100644 --- a/lib/data/di/service_locator.config.dart +++ b/lib/data/di/service_locator.config.dart @@ -274,7 +274,7 @@ extension GetItInjectableX on _i1.GetIt { gh<_i25.UserStateNotifier>(), gh<_i23.StorageService>(), )); - gh.singleton<_i52.EmployeeRepo>( + gh.lazySingleton<_i52.EmployeeRepo>( () => _i52.EmployeeRepo( gh<_i30.EmployeeService>(), gh<_i25.UserStateNotifier>(), diff --git a/lib/data/repo/employee_repo.dart b/lib/data/repo/employee_repo.dart index 51252a3a..9567650c 100644 --- a/lib/data/repo/employee_repo.dart +++ b/lib/data/repo/employee_repo.dart @@ -7,7 +7,7 @@ import 'package:rxdart/rxdart.dart'; import '../model/employee/employee.dart'; import '../services/employee_service.dart'; -@Singleton() +@LazySingleton() class EmployeeRepo { final EmployeeService _employeeService; final UserStateNotifier _userStateNotifier; diff --git a/lib/style/other/app_button.dart b/lib/style/other/app_button.dart index 40f5d36b..e249569c 100644 --- a/lib/style/other/app_button.dart +++ b/lib/style/other/app_button.dart @@ -9,15 +9,21 @@ class AppButton extends StatelessWidget { final VoidCallback? onTap; final bool loading; final Widget? child; + final Color? backgroundColor; const AppButton( - {super.key, this.tag, this.onTap, this.loading = false, this.child}); + {super.key, + this.tag, + this.onTap, + this.loading = false, + this.child, + this.backgroundColor}); @override Widget build(BuildContext context) { return ElevatedButton( style: ElevatedButton.styleFrom( - backgroundColor: context.colorScheme.primary, + backgroundColor: backgroundColor ?? context.colorScheme.primary, fixedSize: Size(MediaQuery.of(context).size.width, 50), elevation: 2), onPressed: onTap, diff --git a/lib/ui/sign_in/sign_in_screen.dart b/lib/ui/sign_in/sign_in_screen.dart index 3469d65c..b5b73178 100644 --- a/lib/ui/sign_in/sign_in_screen.dart +++ b/lib/ui/sign_in/sign_in_screen.dart @@ -41,62 +41,80 @@ class SignInScreenState extends State { Widget build(BuildContext context) { return AppPage( backGroundColor: context.colorScheme.surface, - body: BlocListener( - listenWhen: (previous, current) => current.error != null, - listener: (context, state) { - if (state.error != null) { - showSnackBar(context: context, error: state.error); - } - }, - child: SafeArea( - child: SmartScrollView( - padding: const EdgeInsets.all(16).copyWith(bottom: 50), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - ImageConst.loginPageVectorImage, - fit: BoxFit.cover, - ), - const SizedBox( - height: 50, - ), - Text( - context.l10n.sign_in_title_text, - textAlign: TextAlign.center, - style: AppTextStyle.style24.copyWith( - color: context.colorScheme.textPrimary, - overflow: TextOverflow.fade, - fontWeight: FontWeight.w700, - ), - ), - Padding( - padding: const EdgeInsets.only( - left: 20.0, right: 20, top: 20, bottom: 40), - child: Text( - context.l10n.sign_in_description_text, - style: AppTextStyle.style16.copyWith( - color: context.colorScheme.textSecondary), - overflow: TextOverflow.fade, - textAlign: TextAlign.center, - ), + body: Stack( + children: [ + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + context.colorScheme.surface, + context.colorScheme.primary.withOpacity(0.5) + ], + stops: const [ + 0.5, + 1 + ])), + ), + BlocListener( + listenWhen: (previous, current) => current.error != null, + listener: (context, state) { + if (state.error != null) { + showSnackBar(context: context, error: state.error); + } + }, + child: SafeArea( + child: SmartScrollView( + padding: const EdgeInsets.all(16).copyWith(bottom: 50), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + ImageConst.loginPageVectorImage, + fit: BoxFit.cover, + ), + const SizedBox( + height: 50, + ), + Text( + context.l10n.sign_in_title_text, + textAlign: TextAlign.center, + style: AppTextStyle.style24.copyWith( + color: context.colorScheme.textPrimary, + overflow: TextOverflow.fade, + fontWeight: FontWeight.w700, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 20.0, right: 20, top: 20, bottom: 40), + child: Text( + context.l10n.sign_in_description_text, + style: AppTextStyle.style16.copyWith( + color: context.colorScheme.textSecondary), + overflow: TextOverflow.fade, + textAlign: TextAlign.center, + ), + ), + ], ), - ], - ), - ), - const GoogleSignInButton(), - const SizedBox( - height: 20, + ), + const GoogleSignInButton(), + const SizedBox( + height: 20, + ), + if (kIsWeb || Platform.isIOS) const AppleSignInButton() + ], ), - if (kIsWeb || Platform.isIOS) const AppleSignInButton() - ], - ), - ), - )), + ), + )), + ], + ), ); } } diff --git a/lib/ui/sign_in/widget/apple_signin_button.dart b/lib/ui/sign_in/widget/apple_signin_button.dart index 17f83f26..9e1917aa 100644 --- a/lib/ui/sign_in/widget/apple_signin_button.dart +++ b/lib/ui/sign_in/widget/apple_signin_button.dart @@ -1,4 +1,4 @@ -import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:projectunity/data/core/extensions/context_extension.dart'; @@ -21,25 +21,25 @@ class AppleSignInButton extends StatelessWidget { previous.appleSignInLoading != current.appleSignInLoading, builder: (context, state) { return AppButton( + backgroundColor: Colors.white, onTap: () => context.read().add(AppleSignInEvent()), loading: state.appleSignInLoading, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - padding: const EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: context.colorScheme.surface), - child: SvgPicture.asset(Assets.images.appleLogo)), + SvgPicture.asset( + Assets.images.appleLogo, + colorFilter: + const ColorFilter.mode(Colors.black, BlendMode.srcIn), + ), const SizedBox( width: 20, ), Flexible( child: Text( context.l10n.apple_login_button_text, - style: AppTextStyle.style18 - .copyWith(color: context.colorScheme.surface), + style: AppTextStyle.style18.copyWith( + color: Colors.black, fontWeight: FontWeight.w600), overflow: TextOverflow.clip, ), ), diff --git a/lib/ui/sign_in/widget/google_signin_button.dart b/lib/ui/sign_in/widget/google_signin_button.dart index 80b1a9dc..a2f1a33d 100644 --- a/lib/ui/sign_in/widget/google_signin_button.dart +++ b/lib/ui/sign_in/widget/google_signin_button.dart @@ -21,27 +21,23 @@ class GoogleSignInButton extends StatelessWidget { previous.googleSignInLoading != current.googleSignInLoading, builder: (context, state) { return AppButton( + backgroundColor: Colors.white, onTap: () => context.read().add(GoogleSignInEvent()), loading: state.googleSignInLoading, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - padding: const EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: context.colorScheme.surface), - child: SvgPicture.asset( - Assets.images.googleLogo, - )), + SvgPicture.asset( + Assets.images.googleLogo, + ), const SizedBox( width: 20, ), Flexible( child: Text( context.l10n.google_login_button_text, - style: AppTextStyle.style18 - .copyWith(color: context.colorScheme.surface), + style: AppTextStyle.style18.copyWith( + color: Colors.black, fontWeight: FontWeight.w600), overflow: TextOverflow.clip, ), ),