Merge pull request 'forget_password_design' (#112) from forget_password_design into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/112
This commit is contained in:
@@ -13,6 +13,9 @@ class AuthViewModel with ChangeNotifier {
|
||||
: _authRepository = authRepository {
|
||||
usernameController.addListener(_onTextChanged);
|
||||
passwordController.addListener(_onTextChanged);
|
||||
emailController.addListener(_onTextChanged);
|
||||
otpController.addListener(_onTextChanged);
|
||||
newPasswordController.addListener(_onTextChanged);
|
||||
// usernameFocus.addListener(_onTextChanged);
|
||||
// passwordFocus.addListener(_onTextChanged);
|
||||
}
|
||||
@@ -20,12 +23,18 @@ class AuthViewModel with ChangeNotifier {
|
||||
final TextEditingController usernameController = TextEditingController();
|
||||
final TextEditingController passwordController = TextEditingController();
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
final TextEditingController newPasswordController = TextEditingController();
|
||||
final TextEditingController otpController = TextEditingController();
|
||||
final FocusNode usernameFocus = FocusNode();
|
||||
final FocusNode passwordFocus = FocusNode();
|
||||
final FocusNode emailFocus = FocusNode();
|
||||
final FocusNode newPasswordFocus = FocusNode();
|
||||
final FocusNode otpFocus = FocusNode();
|
||||
|
||||
bool _obscurePassword = true;
|
||||
bool get obscurePassword => _obscurePassword;
|
||||
bool _obscureForgotPassword = true;
|
||||
bool get obscureForgotPassword => _obscureForgotPassword;
|
||||
bool get isLoginEnabled =>
|
||||
usernameController.text.isNotEmpty && passwordController.text.isNotEmpty;
|
||||
|
||||
@@ -43,6 +52,37 @@ class AuthViewModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool get isEmailValid {
|
||||
final email = emailController.text.trim();
|
||||
final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||
return emailRegex.hasMatch(email);
|
||||
}
|
||||
|
||||
bool get isOtpValid {
|
||||
final otp = otpController.text.trim();
|
||||
return otp.length == 5;
|
||||
}
|
||||
|
||||
bool get canSubmitOtpPage {
|
||||
return isEmailValid && isOtpValid;
|
||||
}
|
||||
|
||||
bool get isNewPasswordValid {
|
||||
final password = newPasswordController.text.trim();
|
||||
|
||||
final hasMinLength = password.length >= 5;
|
||||
final hasUppercase = RegExp(r'[A-Z]').hasMatch(password);
|
||||
final hasLowercase = RegExp(r'[a-z]').hasMatch(password);
|
||||
final hasSpecialChar = RegExp(r'[!@#\$%&\*\^]').hasMatch(password);
|
||||
|
||||
return hasMinLength && hasUppercase && hasLowercase && hasSpecialChar;
|
||||
}
|
||||
|
||||
void toggleForgotPasswordVisibility() {
|
||||
_obscureForgotPassword = !_obscureForgotPassword;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void _onTextChanged() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/strings/forgot_password_create_strings.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/m_forget_password_otp.dart_page.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../../login/widgets/login_textfield.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
|
||||
class DesktopForgotPasswordCreatePage extends StatelessWidget {
|
||||
const DesktopForgotPasswordCreatePage({super.key});
|
||||
|
||||
@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 Center(
|
||||
child: SizedBox(
|
||||
width: 364,
|
||||
child: 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(
|
||||
ForgotPasswordCreateStrings.forgotPasswordTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.0.sp(),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
Text(
|
||||
ForgotPasswordCreateStrings.forgotPasswordSubtitle,
|
||||
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(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeast1uppercase,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeast1lowercase,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeastSpecial,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 80.0.h()),
|
||||
viewModel.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordCreateStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isNewPasswordValid,
|
||||
text: ForgotPasswordCreateStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isNewPasswordValid
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const MobileForgotPasswordOtpPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/d_forget_password_create_page.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/m_forget_password_create_page.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/t_forget_password_create_page.dart';
|
||||
|
||||
import '../../shared/responsive_builder.dart';
|
||||
|
||||
class ForgotPasswordCreateScreen extends StatelessWidget {
|
||||
const ForgotPasswordCreateScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveBuilder(
|
||||
mobile: MobileForgotPasswordCreatePage(),
|
||||
tablet: TabletForgotPasswordCreatePage(),
|
||||
desktop: DesktopForgotPasswordCreatePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/strings/forgot_password_create_strings.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/m_forget_password_otp.dart_page.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../../login/widgets/login_textfield.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
|
||||
class MobileForgotPasswordCreatePage extends StatelessWidget {
|
||||
const MobileForgotPasswordCreatePage({super.key});
|
||||
|
||||
@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(
|
||||
ForgotPasswordCreateStrings.forgotPasswordTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.0.sp(),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
Text(
|
||||
ForgotPasswordCreateStrings.forgotPasswordSubtitle,
|
||||
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(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeast1uppercase,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeast1lowercase,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeastSpecial,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 80.0.h()),
|
||||
viewModel.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordCreateStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isNewPasswordValid,
|
||||
text: ForgotPasswordCreateStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isNewPasswordValid
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const MobileForgotPasswordOtpPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/strings/forgot_password_create_strings.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/m_forget_password_otp.dart_page.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../../login/widgets/login_textfield.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
|
||||
class TabletForgotPasswordCreatePage extends StatelessWidget {
|
||||
const TabletForgotPasswordCreatePage({super.key});
|
||||
|
||||
@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 Center(
|
||||
child: SizedBox(
|
||||
width: 364,
|
||||
child: 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(
|
||||
ForgotPasswordCreateStrings.forgotPasswordTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.0.sp(),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
Text(
|
||||
ForgotPasswordCreateStrings.forgotPasswordSubtitle,
|
||||
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(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeast1uppercase,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeast1lowercase,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.0.h()),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 16.0.w()),
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.atLeastSpecial,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 80.0.h()),
|
||||
viewModel.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordCreateStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isNewPasswordValid,
|
||||
text: ForgotPasswordCreateStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isNewPasswordValid
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const MobileForgotPasswordOtpPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
ForgotPasswordCreateStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class ForgotPasswordCreateStrings {
|
||||
ForgotPasswordCreateStrings._();
|
||||
static const String forgotPasswordTitle = 'Forgot Password';
|
||||
static const String forgotPasswordSubtitle = 'Change your password';
|
||||
static const String createNewPassword = 'Create new password';
|
||||
static const String backToSignInButton = 'Back to Sign In';
|
||||
static const String resetLink = 'Reset Link';
|
||||
static const String atLast5Character = '• At least 5 characters';
|
||||
static const String atLeast1uppercase = '• At least one uppercase letter (A–Z)';
|
||||
static const String atLeast1lowercase = '• At least one lowercase letter (a–z)';
|
||||
static const String atLeastSpecial = '• At least one special character: ! @ # \$ % & * ^';
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
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/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
import '../strings/forgot_password_otp_strings.dart';
|
||||
|
||||
class DesktopForgotPasswordOtpPage extends StatelessWidget {
|
||||
const DesktopForgotPasswordOtpPage({super.key});
|
||||
|
||||
@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 Center(
|
||||
child: SizedBox(
|
||||
width: 364,
|
||||
|
||||
child: 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: 5,
|
||||
pinAnimationType: PinAnimationType.scale,
|
||||
onCompleted: (value) {
|
||||
debugPrint('OTP: $value');
|
||||
},
|
||||
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.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled:
|
||||
viewModel.canSubmitOtpPage, // 👈 شرط جدید
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.canSubmitOtpPage
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordCreateScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(height: 12.0),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
ForgotPasswordOtpStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
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/m_forget_password_otp.dart_page.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/t_forget_password_otp.dart_page.dart';
|
||||
|
||||
import '../../shared/responsive_builder.dart';
|
||||
|
||||
class ForgotPasswordOtpScreen extends StatelessWidget {
|
||||
const ForgotPasswordOtpScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveBuilder(
|
||||
mobile: MobileForgotPasswordOtpPage(),
|
||||
tablet: TabletForgotPasswordOtpPage(),
|
||||
desktop: DesktopForgotPasswordOtpPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
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/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
import '../strings/forgot_password_otp_strings.dart';
|
||||
|
||||
class MobileForgotPasswordOtpPage extends StatelessWidget {
|
||||
const MobileForgotPasswordOtpPage({super.key});
|
||||
|
||||
@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: 5,
|
||||
pinAnimationType: PinAnimationType.scale,
|
||||
onCompleted: (value) {
|
||||
debugPrint('OTP: $value');
|
||||
},
|
||||
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.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.canSubmitOtpPage,
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.canSubmitOtpPage
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordCreateScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
ForgotPasswordOtpStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
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/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
import '../strings/forgot_password_otp_strings.dart';
|
||||
|
||||
class TabletForgotPasswordOtpPage extends StatelessWidget {
|
||||
const TabletForgotPasswordOtpPage({super.key});
|
||||
|
||||
@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 Center(
|
||||
child: SizedBox(
|
||||
width: 364,
|
||||
|
||||
child: 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: 5,
|
||||
pinAnimationType: PinAnimationType.scale,
|
||||
onCompleted: (value) {
|
||||
debugPrint('OTP: $value');
|
||||
},
|
||||
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.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled:
|
||||
viewModel.canSubmitOtpPage, // 👈 شرط جدید
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.canSubmitOtpPage
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordCreateScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(height: 12.0),
|
||||
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
ForgotPasswordOtpStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class ForgotPasswordOtpStrings {
|
||||
ForgotPasswordOtpStrings._();
|
||||
static const String forgotPasswordTitle = 'Forgot Password';
|
||||
static const String forgotPasswordSubtitle =
|
||||
'Enter the code sent to your email to reset your password.';
|
||||
static const String backToSignInButton = 'Back to Sign In';
|
||||
static const String resetLink = 'Reset Link';
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -59,37 +60,51 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40.0.h()),
|
||||
// LoginTextField(
|
||||
// controller: viewModel.emailController,
|
||||
// focusNode: viewModel.emailFocus,
|
||||
// label: ForgotPasswordStrings.usernameHint,
|
||||
// iconPath: AssetsManager.userIcon,
|
||||
// isPassword: false,
|
||||
// ),
|
||||
// SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.usernameHint,
|
||||
iconPath: AssetsManager.userIcon,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.emailAddressHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.companyIdHint,
|
||||
label: ForgotPasswordStrings.emailHint,
|
||||
isPassword: false,
|
||||
),
|
||||
// SizedBox(height: 24.0.h()),
|
||||
// LoginTextField(
|
||||
// controller: viewModel.emailController,
|
||||
// focusNode: viewModel.emailFocus,
|
||||
// label: ForgotPasswordStrings.companyIdHint,
|
||||
// isPassword: false,
|
||||
// ),
|
||||
SizedBox(height: 70.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: () async {
|
||||
if (viewModel.isLoginEnabled) {
|
||||
await viewModel.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
viewModel.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isEmailValid
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordOtpScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -54,37 +55,51 @@ class MobileForgotPasswordPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40.0.h()),
|
||||
// LoginTextField(
|
||||
// controller: viewModel.emailController,
|
||||
// focusNode: viewModel.emailFocus,
|
||||
// label: ForgotPasswordStrings.usernameHint,
|
||||
// iconPath: AssetsManager.userIcon,
|
||||
// isPassword: false,
|
||||
// ),
|
||||
// SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.usernameHint,
|
||||
iconPath: AssetsManager.userIcon,
|
||||
label: ForgotPasswordStrings.emailHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.emailAddressHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.companyIdHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 70.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: () async {
|
||||
if (viewModel.isLoginEnabled) {
|
||||
await viewModel.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
// LoginTextField(
|
||||
// controller: viewModel.emailController,
|
||||
// focusNode: viewModel.emailFocus,
|
||||
// label: ForgotPasswordStrings.companyIdHint,
|
||||
// isPassword: false,
|
||||
// ),
|
||||
// SizedBox(height: 70.0.h()),
|
||||
viewModel.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isEmailValid
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordOtpScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -53,37 +54,52 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40.0.h()),
|
||||
// LoginTextField(
|
||||
// controller: viewModel.emailController,
|
||||
// focusNode: viewModel.emailFocus,
|
||||
// label: ForgotPasswordStrings.usernameHint,
|
||||
// iconPath: AssetsManager.userIcon,
|
||||
// isPassword: false,
|
||||
// ),
|
||||
// SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.usernameHint,
|
||||
iconPath: AssetsManager.userIcon,
|
||||
label: ForgotPasswordStrings.emailHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.emailAddressHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
LoginTextField(
|
||||
controller: viewModel.emailController,
|
||||
focusNode: viewModel.emailFocus,
|
||||
label: ForgotPasswordStrings.companyIdHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 70.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: () async {
|
||||
if (viewModel.isLoginEnabled) {
|
||||
await viewModel.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
// LoginTextField(
|
||||
// controller: viewModel.emailController,
|
||||
// focusNode: viewModel.emailFocus,
|
||||
// label: ForgotPasswordStrings.companyIdHint,
|
||||
// isPassword: false,
|
||||
// ),
|
||||
// SizedBox(height: 70.0.h()),
|
||||
viewModel.isLoading
|
||||
? BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isEmailValid
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordOtpScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -4,8 +4,8 @@ class ForgotPasswordStrings {
|
||||
static const String forgotPassword = 'Forgot Password?';
|
||||
static const String forgotPasswordTitle = 'Forgot Password';
|
||||
static const String forgotPasswordSubtitle =
|
||||
'Enter your registered email and company ID and submit your request.';
|
||||
static const String emailAddressHint = 'Email Address';
|
||||
'Enter your registered email to submit your request';
|
||||
static const String emailHint = 'Email';
|
||||
static const String backToSignInButton = 'Back to Sign In';
|
||||
static const String resetLink = 'Reset Link';
|
||||
static const String usernameHint = 'Username';
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../../core/utils/app_toast.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
@@ -107,20 +106,20 @@ class _LoginDesktopPageState extends State<LoginDesktopPage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 32.0),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ForgotPasswordRouteData().push(context);
|
||||
},
|
||||
child: Text(
|
||||
LoginStrings.forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
// SizedBox(height: 32.0),
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// ForgotPasswordRouteData().push(context);
|
||||
// },
|
||||
// child: Text(
|
||||
// LoginStrings.forgotPassword,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: AppColors.mainBlue,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
@@ -103,20 +102,20 @@ class _LoginMobilePageState extends State<LoginMobilePage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 32.0.h()),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ForgotPasswordRouteData().push(context);
|
||||
},
|
||||
child: Text(
|
||||
LoginStrings.forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
// SizedBox(height: 32.0.h()),
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// ForgotPasswordRouteData().push(context);
|
||||
// },
|
||||
// child: Text(
|
||||
// LoginStrings.forgotPassword,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: AppColors.mainBlue,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../../core/utils/app_toast.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
@@ -100,20 +99,20 @@ class _LoginTabletPageState extends State<LoginTabletPage> {
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(height: 32.0),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ForgotPasswordRouteData().push(context);
|
||||
},
|
||||
child: Text(
|
||||
LoginStrings.forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
// SizedBox(height: 32.0),
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// ForgotPasswordRouteData().push(context);
|
||||
// },
|
||||
// child: Text(
|
||||
// LoginStrings.forgotPassword,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: AppColors.mainBlue,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user