Merge pull request 'forgot_password' (#82) from forgot_password into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/82
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
@@ -9,7 +8,7 @@ import 'package:tm_app/views/detail/widgets/tender_detail_card.dart';
|
||||
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
||||
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../view_models/home_view_model.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../shared/desktop_navigation_widget.dart';
|
||||
|
||||
class TenderDetailDesktopPage extends StatefulWidget {
|
||||
@@ -80,9 +79,7 @@ class _TenderDetailDesktopPageState extends State<TenderDetailDesktopPage> {
|
||||
return PopScope(
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.read<TenderDetailViewModel>().updateTenderApprovals(
|
||||
widget.tenderId,
|
||||
);
|
||||
viewModel.updateTenderApprovals(widget.tenderId);
|
||||
});
|
||||
},
|
||||
child: Scaffold(
|
||||
@@ -112,14 +109,20 @@ class _TenderDetailDesktopPageState extends State<TenderDetailDesktopPage> {
|
||||
// Navigate to different screens based on index
|
||||
switch (index) {
|
||||
case 0:
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
context.read<HomeViewModel>().init();
|
||||
Router.neglect(
|
||||
context,
|
||||
() => HomeRouteData().go(context),
|
||||
);
|
||||
viewModel.updateHome();
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
// Navigate to profile
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(
|
||||
context,
|
||||
() => ProfileRouteData().go(context),
|
||||
);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/assets.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/home_view_model.dart';
|
||||
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
||||
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
||||
import 'package:tm_app/views/detail/widgets/tender_detail_card.dart';
|
||||
@@ -14,6 +13,7 @@ import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
||||
import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
|
||||
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
|
||||
class TenderDetailTabletPage extends StatefulWidget {
|
||||
final String tenderId;
|
||||
@@ -84,9 +84,7 @@ class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
if (kIsWeb) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.read<TenderDetailViewModel>().updateTenderApprovals(
|
||||
widget.tenderId,
|
||||
);
|
||||
viewModel.updateTenderApprovals(widget.tenderId);
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -124,15 +122,15 @@ class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
|
||||
// Handle navigation to other tabs
|
||||
switch (index) {
|
||||
case 0:
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
context.read<HomeViewModel>().init();
|
||||
Router.neglect(context, () => HomeRouteData().go(context));
|
||||
viewModel.updateHome();
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
// Navigate to profile
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(context, () => ProfileRouteData().go(context));
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
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 '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.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 DesktopForgotPasswordPage extends StatelessWidget {
|
||||
const DesktopForgotPasswordPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: Center(
|
||||
child: Consumer<AuthViewModel>(
|
||||
builder: (context, viewModel, _) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 120),
|
||||
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(
|
||||
AppStrings.forgotPasswordTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.0.sp(),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
Text(
|
||||
AppStrings.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: AppStrings.emailAddressHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 70.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: false,
|
||||
text: AppStrings.resetLink,
|
||||
onPressed: () async {
|
||||
if (viewModel.isLoginEnabled) {
|
||||
await viewModel.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
AppStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(32.0),
|
||||
child: Image.asset(
|
||||
AssetsManager.forgotPasswordImage,
|
||||
width: 796.0,
|
||||
height: 944.0,
|
||||
fit: BoxFit.fitWidth,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../shared/responsive_builder.dart';
|
||||
import 'd_forgot_apssword_page.dart';
|
||||
import 'm_forgot_password_page.dart';
|
||||
import 't_forgot_password_page.dart';
|
||||
|
||||
class ForgotPasswordScreen extends StatelessWidget {
|
||||
const ForgotPasswordScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveBuilder(
|
||||
mobile: MobileForgotPasswordPage(),
|
||||
tablet: TabletForgotPasswordPage(),
|
||||
desktop: DesktopForgotPasswordPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
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 '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.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 MobileForgotPasswordPage extends StatelessWidget {
|
||||
const MobileForgotPasswordPage({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(
|
||||
AppStrings.forgotPasswordTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.0.sp(),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
Text(
|
||||
AppStrings.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: AppStrings.emailAddressHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 70.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: false,
|
||||
text: AppStrings.resetLink,
|
||||
onPressed: () async {
|
||||
if (viewModel.isLoginEnabled) {
|
||||
await viewModel.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
AppStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
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 '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.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 TabletForgotPasswordPage extends StatelessWidget {
|
||||
const TabletForgotPasswordPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: 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(
|
||||
AppStrings.forgotPasswordTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.0.sp(),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
Text(
|
||||
AppStrings.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: AppStrings.emailAddressHint,
|
||||
isPassword: false,
|
||||
),
|
||||
SizedBox(height: 70.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: false,
|
||||
text: AppStrings.resetLink,
|
||||
onPressed: () async {
|
||||
if (viewModel.isLoginEnabled) {
|
||||
await viewModel.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text(
|
||||
AppStrings.backToSignInButton,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/assets.dart';
|
||||
import 'package:tm_app/core/constants/strings.dart';
|
||||
@@ -44,11 +43,17 @@ class DesktopHomePage extends StatelessWidget {
|
||||
break;
|
||||
case 1:
|
||||
// Navigate to tenders
|
||||
Router.neglect(context, () => context.go('/tenders'));
|
||||
Router.neglect(
|
||||
context,
|
||||
() => TendersRouteData().go(context),
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
// Navigate to profile
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(
|
||||
context,
|
||||
() => ProfileRouteData().go(context),
|
||||
);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -59,12 +59,12 @@ class TabletHomePage extends StatelessWidget {
|
||||
case 1:
|
||||
// Navigate to tenders
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/tenders'));
|
||||
Router.neglect(context, () => TendersRouteData().go(context));
|
||||
break;
|
||||
case 2:
|
||||
// Navigate to profile
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(context, () => ProfileRouteData().go(context));
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:tm_app/core/theme/colors.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../widgets/widgets.dart';
|
||||
@@ -46,7 +47,6 @@ class _LoginDesktopPageState extends State<LoginDesktopPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SizeConfig.init(context);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: Center(
|
||||
@@ -55,7 +55,7 @@ class _LoginDesktopPageState extends State<LoginDesktopPage> {
|
||||
kIsWeb ? MainAxisAlignment.spaceAround : MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 526,
|
||||
width: 536,
|
||||
child: Consumer<AuthViewModel>(
|
||||
builder: (context, viewModel, _) {
|
||||
return Column(
|
||||
@@ -108,6 +108,20 @@ class _LoginDesktopPageState extends State<LoginDesktopPage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 32.0),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ForgotPasswordRouteData().push(context);
|
||||
},
|
||||
child: Text(
|
||||
AppStrings.forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ 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,6 +104,20 @@ class _LoginMobilePageState extends State<LoginMobilePage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 32.0.h()),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ForgotPasswordRouteData().push(context);
|
||||
},
|
||||
child: Text(
|
||||
AppStrings.forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:tm_app/core/theme/colors.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
import '../widgets/widgets.dart';
|
||||
@@ -45,7 +46,6 @@ class _LoginTabletPageState extends State<LoginTabletPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SizeConfig.init(context);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: Center(
|
||||
@@ -101,6 +101,20 @@ class _LoginTabletPageState extends State<LoginTabletPage> {
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(height: 32.0),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ForgotPasswordRouteData().push(context);
|
||||
},
|
||||
child: Text(
|
||||
AppStrings.forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ class LoginTextField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
final FocusNode focusNode;
|
||||
final String label;
|
||||
final String iconPath;
|
||||
final String? iconPath;
|
||||
final bool isPassword;
|
||||
final bool obscureText;
|
||||
final double? borderRedus;
|
||||
@@ -21,7 +21,7 @@ class LoginTextField extends StatelessWidget {
|
||||
required this.controller,
|
||||
required this.focusNode,
|
||||
required this.label,
|
||||
required this.iconPath,
|
||||
this.iconPath,
|
||||
super.key,
|
||||
this.isPassword = false,
|
||||
this.obscureText = false,
|
||||
@@ -45,18 +45,23 @@ class LoginTextField extends StatelessWidget {
|
||||
horizontal: 12.0.w(),
|
||||
),
|
||||
labelText: label,
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.all(prefixIconPadding ?? 12.0.w()),
|
||||
child: SvgPicture.asset(
|
||||
iconPath,
|
||||
width: 24.0.w(),
|
||||
height: 24.0.h(),
|
||||
colorFilter: ColorFilter.mode(
|
||||
focusNode.hasFocus ? AppColors.grey80 : AppColors.grey60,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
prefixIcon:
|
||||
iconPath != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.all(prefixIconPadding ?? 12.0.w()),
|
||||
child: SvgPicture.asset(
|
||||
iconPath!,
|
||||
width: 24.0.w(),
|
||||
height: 24.0.h(),
|
||||
colorFilter: ColorFilter.mode(
|
||||
focusNode.hasFocus
|
||||
? AppColors.grey80
|
||||
: AppColors.grey60,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
suffixIcon:
|
||||
isPassword
|
||||
? IconButton(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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/view_models/profile_view_model.dart';
|
||||
@@ -39,7 +38,7 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
|
||||
);
|
||||
}
|
||||
if (viewModel.loggedOut) {
|
||||
LoginScreenRoute().go(context);
|
||||
Router.neglect(context, () => LoginScreenRoute().go(context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,11 +76,17 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
|
||||
switch (index) {
|
||||
case 0:
|
||||
// Navigate to home
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
Router.neglect(
|
||||
context,
|
||||
() => HomeRouteData().go(context),
|
||||
);
|
||||
break;
|
||||
case 1:
|
||||
// Navigate to profile
|
||||
Router.neglect(context, () => context.go('/tenders'));
|
||||
Router.neglect(
|
||||
context,
|
||||
() => TendersRouteData().go(context),
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
// Already on profile
|
||||
@@ -163,6 +168,7 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
|
||||
alignment: Alignment.centerRight,
|
||||
child: InkWell(
|
||||
onTap: () => viewModel.logout(),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
child: Container(
|
||||
width: 156,
|
||||
height: 56.0.h(),
|
||||
|
||||
@@ -38,7 +38,7 @@ class _MobileProfilePageState extends State<MobileProfilePage> {
|
||||
);
|
||||
}
|
||||
if (viewModel.loggedOut) {
|
||||
LoginScreenRoute().go(context);
|
||||
Router.neglect(context, () => LoginScreenRoute().go(context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ class _MobileProfilePageState extends State<MobileProfilePage> {
|
||||
Spacer(),
|
||||
InkWell(
|
||||
onTap: () => viewModel.logout(),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 56.0.h(),
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/assets.dart';
|
||||
import 'package:tm_app/core/constants/strings.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/view_models/home_view_model.dart';
|
||||
import 'package:tm_app/view_models/profile_view_model.dart';
|
||||
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -40,7 +39,7 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
|
||||
);
|
||||
}
|
||||
if (viewModel.loggedOut) {
|
||||
LoginScreenRoute().go(context);
|
||||
Router.neglect(context, () => LoginScreenRoute().go(context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,12 +102,15 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
|
||||
switch (index) {
|
||||
case 0:
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
context.read<HomeViewModel>().init();
|
||||
Router.neglect(context, () => HomeRouteData().go(context));
|
||||
|
||||
break;
|
||||
case 1:
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/tenders'));
|
||||
Router.neglect(
|
||||
context,
|
||||
() => TendersRouteData().go(context),
|
||||
);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -190,6 +192,7 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
|
||||
alignment: Alignment.centerRight,
|
||||
child: InkWell(
|
||||
onTap: () => viewModel.logout(),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
child: Container(
|
||||
width: 156,
|
||||
height: 56.0.h(),
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/home_view_model.dart';
|
||||
import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
import 'package:tm_app/views/shared/desktop_navigation_widget.dart';
|
||||
import 'package:tm_app/views/tenders/widgets/main_tenders_slider.dart';
|
||||
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
|
||||
class DesktopTendersPage extends StatefulWidget {
|
||||
const DesktopTendersPage({super.key});
|
||||
@@ -64,16 +63,15 @@ class _DesktopTendersPageState extends State<DesktopTendersPage> {
|
||||
switch (index) {
|
||||
case 0:
|
||||
// Navigate to home
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
context.read<HomeViewModel>().init();
|
||||
Router.neglect(context, () => HomeRouteData().go(context));
|
||||
viewModel.updateHome();
|
||||
break;
|
||||
case 1:
|
||||
// Already on tenders
|
||||
break;
|
||||
case 2:
|
||||
// Navigate to profile
|
||||
// context.go('/profile');
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(context, () => ProfileRouteData().go(context));
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,17 +4,30 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/home_view_model.dart';
|
||||
import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
|
||||
import 'package:tm_app/views/tenders/widgets/main_tenders_slider.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
|
||||
class TabletTendersPage extends StatelessWidget {
|
||||
class TabletTendersPage extends StatefulWidget {
|
||||
const TabletTendersPage({super.key});
|
||||
|
||||
@override
|
||||
State<TabletTendersPage> createState() => _TabletTendersPageState();
|
||||
}
|
||||
|
||||
class _TabletTendersPageState extends State<TabletTendersPage> {
|
||||
late final TendersViewModel viewModel;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
viewModel = context.read<TendersViewModel>();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final GlobalKey<ScaffoldState> key = GlobalKey();
|
||||
@@ -52,12 +65,12 @@ class TabletTendersPage extends StatelessWidget {
|
||||
switch (index) {
|
||||
case 0:
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
context.read<HomeViewModel>().init();
|
||||
Router.neglect(context, () => HomeRouteData().go(context));
|
||||
viewModel.updateHome();
|
||||
break;
|
||||
case 2:
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(context, () => ProfileRouteData().go(context));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user