Merge pull request 'fixed auth pages sizes and push notification navigate bug' (#159) from some_fixes into main

Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/159
This commit is contained in:
a.ghabeli
2025-09-24 13:13:52 +03:30
11 changed files with 445 additions and 431 deletions
@@ -38,9 +38,11 @@ class AppShellScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ResponsiveBuilder( return ResponsiveBuilder(
mobile: MobileShellPage( mobile: SafeArea(
navigationShell: navigationShell, child: MobileShellPage(
onTap: (value) => _gotoBranch(value, context), navigationShell: navigationShell,
onTap: (value) => _gotoBranch(value, context),
),
), ),
tablet: TabletShellPage( tablet: TabletShellPage(
navigationShell: navigationShell, navigationShell: navigationShell,
+17 -12
View File
@@ -54,21 +54,26 @@ class MyApp extends StatefulWidget {
} }
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {
Future<void> setupInteractedMessage() async {
final initialMessage = await FirebaseMessaging.instance.getInitialMessage();
if (initialMessage != null) {
_handleMessage(initialMessage);
}
FirebaseMessaging.onMessageOpenedApp.listen(_handleMessage);
}
void _handleMessage(RemoteMessage message) {
appRouter.go(
const SplashScreenRoute(navigateToNotification: true).location,
);
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_handleInitialMessage(); setupInteractedMessage();
}
Future<void> _handleInitialMessage() async {
final message = await FirebaseMessaging.instance.getInitialMessage();
if (message != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
appRouter.go(
const SplashScreenRoute(navigateToNotification: true).location,
);
});
}
} }
@override @override
@@ -52,135 +52,138 @@ class _MobileForgotPasswordCreatePageState
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
body: Center( resizeToAvoidBottomInset: false,
child: SingleChildScrollView( body: SafeArea(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()), child: Center(
child: Consumer<AuthViewModel>( child: SingleChildScrollView(
builder: (context, viewModel, _) { padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
return Column( child: Consumer<AuthViewModel>(
mainAxisSize: MainAxisSize.min, builder: (context, viewModel, _) {
children: [ return Column(
Padding( mainAxisSize: MainAxisSize.min,
padding: EdgeInsets.symmetric(horizontal: 22.0.w()), children: [
child: SvgPicture.asset( Padding(
AssetsManager.logoBig, padding: EdgeInsets.symmetric(horizontal: 22.0.w()),
width: double.infinity, child: SvgPicture.asset(
height: 50.0.h(), AssetsManager.logoBig,
width: double.infinity,
height: 50.0.h(),
),
), ),
), SizedBox(height: 72.0.h()),
SizedBox(height: 72.0.h()), Text(
Text( ForgotPasswordCreateStrings.forgotPasswordTitle,
ForgotPasswordCreateStrings.forgotPasswordTitle, style: TextStyle(
style: TextStyle( fontSize: 28.0.sp(),
fontSize: 28.0.sp(), fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, color: AppColors.grey80,
color: AppColors.grey80, ),
), ),
), SizedBox(height: 16.0.h()),
SizedBox(height: 16.0.h()), Text(
Text( ForgotPasswordCreateStrings.forgotPasswordSubtitle,
ForgotPasswordCreateStrings.forgotPasswordSubtitle, textAlign: TextAlign.center,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
SizedBox(height: 40.0.h()),
LoginTextField(
controller: viewModel.newPasswordController,
focusNode: viewModel.newPasswordFocus,
label: ForgotPasswordCreateStrings.createNewPassword,
iconPath: AssetsManager.passwordIcon,
isPassword: true,
obscureText: viewModel.obscureForgotPassword,
onToggleVisibility:
viewModel.toggleForgotPasswordVisibility,
),
SizedBox(height: 16.0.h()),
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 16.0.w()),
child: Text(
ForgotPasswordCreateStrings.atLast5Character,
style: TextStyle( style: TextStyle(
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60, color: AppColors.grey60,
), ),
), ),
), SizedBox(height: 40.0.h()),
SizedBox(height: 6.0.h()), LoginTextField(
Container( controller: viewModel.newPasswordController,
alignment: Alignment.centerLeft, focusNode: viewModel.newPasswordFocus,
padding: EdgeInsets.only(left: 16.0.w()), label: ForgotPasswordCreateStrings.createNewPassword,
child: Text( iconPath: AssetsManager.passwordIcon,
ForgotPasswordCreateStrings.atLeast1uppercase, isPassword: true,
style: TextStyle( obscureText: viewModel.obscureForgotPassword,
fontSize: 14.0.sp(), onToggleVisibility:
color: AppColors.grey60, viewModel.toggleForgotPasswordVisibility,
),
SizedBox(height: 16.0.h()),
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 16.0.w()),
child: Text(
ForgotPasswordCreateStrings.atLast5Character,
style: TextStyle(
fontSize: 14.0.sp(),
color: AppColors.grey60,
),
), ),
), ),
), SizedBox(height: 6.0.h()),
SizedBox(height: 6.0.h()), Container(
Container( alignment: Alignment.centerLeft,
alignment: Alignment.centerLeft, padding: EdgeInsets.only(left: 16.0.w()),
padding: EdgeInsets.only(left: 16.0.w()), child: Text(
child: Text( ForgotPasswordCreateStrings.atLeast1uppercase,
ForgotPasswordCreateStrings.atLeast1lowercase, style: TextStyle(
style: TextStyle( fontSize: 14.0.sp(),
fontSize: 14.0.sp(), color: AppColors.grey60,
color: AppColors.grey60, ),
), ),
), ),
), SizedBox(height: 6.0.h()),
SizedBox(height: 6.0.h()), Container(
Container( alignment: Alignment.centerLeft,
alignment: Alignment.centerLeft, padding: EdgeInsets.only(left: 16.0.w()),
padding: EdgeInsets.only(left: 16.0.w()), child: Text(
child: Text( ForgotPasswordCreateStrings.atLeast1lowercase,
ForgotPasswordCreateStrings.atLeastSpecial, style: TextStyle(
style: TextStyle( fontSize: 14.0.sp(),
fontSize: 14.0.sp(), color: AppColors.grey60,
color: AppColors.grey60, ),
), ),
), ),
), SizedBox(height: 6.0.h()),
SizedBox(height: 80.0.h()), Container(
viewModel.isResetPasswordLoading alignment: Alignment.centerLeft,
? BaseButton( padding: EdgeInsets.only(left: 16.0.w()),
isEnabled: viewModel.isNewPasswordValid, child: Text(
text: ForgotPasswordCreateStrings.resetLink, ForgotPasswordCreateStrings.atLeastSpecial,
onPressed: null, style: TextStyle(
isLoading: true, fontSize: 14.0.sp(),
) color: AppColors.grey60,
: BaseButton( ),
isEnabled: viewModel.isNewPasswordValid,
text: ForgotPasswordCreateStrings.resetLink,
onPressed:
viewModel.isNewPasswordValid
? () async {
viewModel.resetPassword();
}
: null,
), ),
),
SizedBox(height: 80.0.h()),
viewModel.isResetPasswordLoading
? BaseButton(
isEnabled: viewModel.isNewPasswordValid,
text: ForgotPasswordCreateStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.isNewPasswordValid,
text: ForgotPasswordCreateStrings.resetLink,
onPressed:
viewModel.isNewPasswordValid
? () async {
viewModel.resetPassword();
}
: null,
),
TextButton( TextButton(
onPressed: () { onPressed: () {
context.pop(); context.pop();
}, },
child: Text( child: Text(
ForgotPasswordCreateStrings.backToSignInButton, ForgotPasswordCreateStrings.backToSignInButton,
style: TextStyle( style: TextStyle(
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: AppColors.mainBlue, color: AppColors.mainBlue,
),
), ),
), ),
), ],
], );
); },
}, ),
), ),
), ),
), ),
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:tm_app/views/forget_password_otp.dart/pages/d_forget_password_otp.dart_page.dart'; import 'package:tm_app/views/forget_password_otp.dart/pages/d_forget_password_otp_page.dart';
import 'package:tm_app/views/forget_password_otp.dart/pages/m_forget_password_otp.dart_page.dart'; import 'package:tm_app/views/forget_password_otp.dart/pages/m_forget_password_otp_page.dart';
import 'package:tm_app/views/forget_password_otp.dart/pages/t_forget_password_otp.dart_page.dart'; import 'package:tm_app/views/forget_password_otp.dart/pages/t_forget_password_otp_page.dart';
import '../../shared/responsive_builder.dart'; import '../../shared/responsive_builder.dart';
@@ -1,149 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:pinput/pinput.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/routes/app_routes.dart';
import 'package:tm_app/core/utils/size_config.dart';
import '../../../core/constants/assets.dart';
import '../../../core/theme/colors.dart';
import '../../../core/utils/app_toast.dart';
import '../../../view_models/auth_view_model.dart';
import '../../shared/base_button.dart';
import '../strings/forgot_password_otp_strings.dart';
class MobileForgotPasswordOtpPage extends StatefulWidget {
const MobileForgotPasswordOtpPage({super.key});
@override
State<MobileForgotPasswordOtpPage> createState() =>
_MobileForgotPasswordOtpPageState();
}
class _MobileForgotPasswordOtpPageState
extends State<MobileForgotPasswordOtpPage> {
late final AuthViewModel viewModel;
@override
void initState() {
super.initState();
viewModel = context.read<AuthViewModel>();
viewModel.addListener(_viewModelListener);
}
void _viewModelListener() {
if (viewModel.errorMessageOtp != null) {
AppToast.error(context, viewModel.errorMessageOtp!);
} else if (!viewModel.isLoadingOtp &&
viewModel.verifyOtpSuccess &&
viewModel.resetToken != null) {
const ForgotPasswordCreateRouteData().pushReplacement(context);
viewModel.clearOtpFlow();
}
}
@override
void dispose() {
viewModel.removeListener(_viewModelListener);
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Center(
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 22.0.w()),
child: SvgPicture.asset(
AssetsManager.logoBig,
width: double.infinity,
height: 50.0.h(),
),
),
SizedBox(height: 72.0.h()),
Text(
ForgotPasswordOtpStrings.forgotPasswordTitle,
style: TextStyle(
fontSize: 28.0.sp(),
fontWeight: FontWeight.bold,
color: AppColors.grey80,
),
),
SizedBox(height: 16.0.h()),
Text(
ForgotPasswordOtpStrings.forgotPasswordSubtitle,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
SizedBox(height: 40.0.h()),
Pinput(
controller: viewModel.otpController,
length: 6,
pinAnimationType: PinAnimationType.scale,
defaultPinTheme: PinTheme(
width: 50.0.w(),
height: 50.0.h(),
textStyle: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.bold,
),
decoration: BoxDecoration(
color: AppColors.grey0,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: AppColors.grey40),
),
),
),
SizedBox(height: 24.0.h()),
viewModel.isLoadingOtp
? BaseButton(
isEnabled: viewModel.isOtpValid,
text: ForgotPasswordOtpStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.canSubmitOtpPage,
text: ForgotPasswordOtpStrings.resetLink,
onPressed:
viewModel.canSubmitOtpPage
? () async {
await viewModel.verifyOtp(context);
}
: null,
),
TextButton(
onPressed: () {
context.pop();
},
child: Text(
ForgotPasswordOtpStrings.backToSignInButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
],
);
},
),
),
),
);
}
}
@@ -0,0 +1,151 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:pinput/pinput.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/routes/app_routes.dart';
import 'package:tm_app/core/utils/size_config.dart';
import '../../../core/constants/assets.dart';
import '../../../core/theme/colors.dart';
import '../../../core/utils/app_toast.dart';
import '../../../view_models/auth_view_model.dart';
import '../../shared/base_button.dart';
import '../strings/forgot_password_otp_strings.dart';
class MobileForgotPasswordOtpPage extends StatefulWidget {
const MobileForgotPasswordOtpPage({super.key});
@override
State<MobileForgotPasswordOtpPage> createState() =>
_MobileForgotPasswordOtpPageState();
}
class _MobileForgotPasswordOtpPageState
extends State<MobileForgotPasswordOtpPage> {
late final AuthViewModel viewModel;
@override
void initState() {
super.initState();
viewModel = context.read<AuthViewModel>();
viewModel.addListener(_viewModelListener);
}
void _viewModelListener() {
if (viewModel.errorMessageOtp != null) {
AppToast.error(context, viewModel.errorMessageOtp!);
} else if (!viewModel.isLoadingOtp &&
viewModel.verifyOtpSuccess &&
viewModel.resetToken != null) {
const ForgotPasswordCreateRouteData().pushReplacement(context);
viewModel.clearOtpFlow();
}
}
@override
void dispose() {
viewModel.removeListener(_viewModelListener);
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: SafeArea(
child: Center(
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 22.0.w()),
child: SvgPicture.asset(
AssetsManager.logoBig,
width: double.infinity,
height: 50.0.h(),
),
),
SizedBox(height: 72.0.h()),
Text(
ForgotPasswordOtpStrings.forgotPasswordTitle,
style: TextStyle(
fontSize: 28.0.sp(),
fontWeight: FontWeight.bold,
color: AppColors.grey80,
),
),
SizedBox(height: 16.0.h()),
Text(
ForgotPasswordOtpStrings.forgotPasswordSubtitle,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
SizedBox(height: 40.0.h()),
Pinput(
controller: viewModel.otpController,
length: 6,
pinAnimationType: PinAnimationType.scale,
defaultPinTheme: PinTheme(
width: 50.0.w(),
height: 50.0.h(),
textStyle: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.bold,
),
decoration: BoxDecoration(
color: AppColors.grey0,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: AppColors.grey40),
),
),
),
SizedBox(height: 24.0.h()),
viewModel.isLoadingOtp
? BaseButton(
isEnabled: viewModel.isOtpValid,
text: ForgotPasswordOtpStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.canSubmitOtpPage,
text: ForgotPasswordOtpStrings.resetLink,
onPressed:
viewModel.canSubmitOtpPage
? () async {
await viewModel.verifyOtp(context);
}
: null,
),
TextButton(
onPressed: () {
context.pop();
},
child: Text(
ForgotPasswordOtpStrings.backToSignInButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
],
);
},
),
),
),
),
);
}
}
@@ -53,82 +53,84 @@ class _MobileForgotPasswordPageState extends State<MobileForgotPasswordPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
body: Center( body: SafeArea(
child: SingleChildScrollView( child: Center(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()), child: SingleChildScrollView(
child: Consumer<AuthViewModel>( padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
builder: (context, viewModel, _) { child: Consumer<AuthViewModel>(
return Column( builder: (context, viewModel, _) {
mainAxisSize: MainAxisSize.min, return Column(
children: [ mainAxisSize: MainAxisSize.min,
Padding( children: [
padding: EdgeInsets.symmetric(horizontal: 22.0.w()), Padding(
child: SvgPicture.asset( padding: EdgeInsets.symmetric(horizontal: 22.0.w()),
AssetsManager.logoBig, child: SvgPicture.asset(
width: double.infinity, AssetsManager.logoBig,
height: 50.0.h(), width: double.infinity,
), height: 50.0.h(),
),
SizedBox(height: 72.0.h()),
Text(
ForgotPasswordStrings.forgotPasswordTitle,
style: TextStyle(
fontSize: 28.0.sp(),
fontWeight: FontWeight.bold,
color: AppColors.grey80,
),
),
SizedBox(height: 16.0.h()),
Text(
ForgotPasswordStrings.forgotPasswordSubtitle,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
SizedBox(height: 40.0.h()),
LoginTextField(
controller: viewModel.emailController,
focusNode: viewModel.emailFocus,
label: ForgotPasswordStrings.emailHint,
isPassword: false,
),
SizedBox(height: 24.0.h()),
viewModel.isLoadingForgot
? const BaseButton(
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed:
viewModel.isEmailValid
? () async {
await viewModel.forgotPassword(context);
}
: null,
), ),
TextButton( ),
onPressed: () { SizedBox(height: 72.0.h()),
Navigator.pop(context); Text(
}, ForgotPasswordStrings.forgotPasswordTitle,
child: Text( style: TextStyle(
ForgotPasswordStrings.backToSignInButton, fontSize: 28.0.sp(),
fontWeight: FontWeight.bold,
color: AppColors.grey80,
),
),
SizedBox(height: 16.0.h()),
Text(
ForgotPasswordStrings.forgotPasswordSubtitle,
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w400,
color: AppColors.mainBlue, color: AppColors.grey60,
), ),
), ),
), SizedBox(height: 40.0.h()),
], LoginTextField(
); controller: viewModel.emailController,
}, focusNode: viewModel.emailFocus,
label: ForgotPasswordStrings.emailHint,
isPassword: false,
),
SizedBox(height: 24.0.h()),
viewModel.isLoadingForgot
? const BaseButton(
isEnabled: false,
text: ForgotPasswordStrings.resetLink,
onPressed: null,
isLoading: true,
)
: BaseButton(
isEnabled: viewModel.isEmailValid,
text: ForgotPasswordStrings.resetLink,
onPressed:
viewModel.isEmailValid
? () async {
await viewModel.forgotPassword(context);
}
: null,
),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
ForgotPasswordStrings.backToSignInButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
],
);
},
),
), ),
), ),
), ),
+73 -71
View File
@@ -46,79 +46,81 @@ class _LoginMobilePageState extends State<LoginMobilePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
body: Center( body: SafeArea(
child: SingleChildScrollView( child: Center(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()), child: SingleChildScrollView(
child: Consumer<AuthViewModel>( padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
builder: (context, viewModel, _) { child: Consumer<AuthViewModel>(
return Column( builder: (context, viewModel, _) {
mainAxisSize: MainAxisSize.min, return Column(
children: [ mainAxisSize: MainAxisSize.min,
// LoginLogo(width: 190.0.w(), height: 88.0.h()), children: [
Padding( // LoginLogo(width: 190.0.w(), height: 88.0.h()),
padding: EdgeInsets.symmetric(horizontal: 22.0.w()), Padding(
child: SvgPicture.asset( padding: EdgeInsets.symmetric(horizontal: 22.0.w()),
AssetsManager.logoBig, child: SvgPicture.asset(
width: double.infinity, AssetsManager.logoBig,
height: 50.0.h(), width: double.infinity,
), height: 50.0.h(),
),
SizedBox(height: 32.0.h()),
const LoginTitle(),
SizedBox(height: 32.0.h()),
LoginTextField(
controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus,
label: LoginStrings.usernameLabel,
iconPath: AssetsManager.userIcon,
),
SizedBox(height: 16.0.h()),
LoginTextField(
controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus,
label: LoginStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon,
isPassword: true,
obscureText: viewModel.obscurePassword,
onToggleVisibility: viewModel.togglePasswordVisibility,
),
SizedBox(height: 32.0.h()),
if (viewModel.isLoading)
BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
textColor: AppColors.white,
)
else
BaseButton(
isEnabled: viewModel.isLoginEnabled,
onPressed: () async {
if (viewModel.isLoginEnabled) {
await viewModel.login();
}
},
),
SizedBox(height: 32.0.h()),
TextButton(
onPressed: () {
const ForgotPasswordRouteData().push(context);
},
child: Text(
LoginStrings.forgotPassword,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
), ),
), ),
), SizedBox(height: 32.0.h()),
], const LoginTitle(),
); SizedBox(height: 32.0.h()),
},
LoginTextField(
controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus,
label: LoginStrings.usernameLabel,
iconPath: AssetsManager.userIcon,
),
SizedBox(height: 16.0.h()),
LoginTextField(
controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus,
label: LoginStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon,
isPassword: true,
obscureText: viewModel.obscurePassword,
onToggleVisibility: viewModel.togglePasswordVisibility,
),
SizedBox(height: 32.0.h()),
if (viewModel.isLoading)
BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
textColor: AppColors.white,
)
else
BaseButton(
isEnabled: viewModel.isLoginEnabled,
onPressed: () async {
if (viewModel.isLoginEnabled) {
await viewModel.login();
}
},
),
SizedBox(height: 32.0.h()),
TextButton(
onPressed: () {
const ForgotPasswordRouteData().push(context);
},
child: Text(
LoginStrings.forgotPassword,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
],
);
},
),
), ),
), ),
), ),
+8 -10
View File
@@ -27,16 +27,14 @@ class _MobileSplashPageState extends State<MobileSplashPage> {
void _viewModelListener() { void _viewModelListener() {
if (viewModel.isLoggedIn) { if (viewModel.isLoggedIn) {
WidgetsBinding.instance.addPostFrameCallback((_) { if (widget.navigateToNotification) {
if (widget.navigateToNotification) { Router.neglect(
Router.neglect( context,
context, () => const NotificationRouteData().go(context),
() => const NotificationRouteData().go(context), );
); } else {
} else { Router.neglect(context, () => const HomeRouteData().go(context));
Router.neglect(context, () => const HomeRouteData().go(context)); }
}
});
} else { } else {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
Router.neglect(context, () => const LoginScreenRoute().go(context)); Router.neglect(context, () => const LoginScreenRoute().go(context));