Merge pull request 'TM-164,165,167 bugs fixed' (#192) from bugs into main

Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/192
This commit is contained in:
a.ghabeli
2025-09-30 12:14:35 +03:30
14 changed files with 369 additions and 301 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ class YourTendersApi {
required String createdTo,
required String status,
}) {
String url = '$tenderApproval?limit=$limit&offset=$offset';
String url = '$tenderApproval?limit=$limit&offset=$offset&status=submitted';
if (createdFrom.isNotEmpty && createdTo.isNotEmpty) {
url += '&created_from=$createdFrom&created_to=$createdTo';
@@ -56,143 +56,139 @@ class _DesktopForgotPasswordCreatePageState
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Center(
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 110),
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(),
),
Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Expanded(
child: 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: 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,
),
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(),
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.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.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: 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.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,
),
),
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(
onPressed: () {
context.pop();
},
child: Text(
ForgotPasswordCreateStrings.backToSignInButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
TextButton(
onPressed: () {
context.pop();
},
child: Text(
ForgotPasswordCreateStrings.backToSignInButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
],
),
),
],
),
),
);
},
),
),
);
},
),
Padding(
padding: EdgeInsets.symmetric(
@@ -61,8 +61,7 @@ class _DesktopForgotPasswordOtpPageState
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 100),
Expanded(
child: Center(
child: SizedBox(
width: 364,
@@ -62,80 +62,83 @@ class _DesktopForgotPasswordPageState extends State<DesktopForgotPasswordPage> {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 110),
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(
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: 70.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,
Expanded(
child: 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(),
),
const SizedBox(height: 12),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
ForgotPasswordStrings.backToSignInButton,
),
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.w500,
color: AppColors.mainBlue,
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: 70.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,
),
const SizedBox(height: 12),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
ForgotPasswordStrings.backToSignInButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
],
),
),
),
),
+8 -1
View File
@@ -230,7 +230,14 @@ class DesktopHomePage extends StatelessWidget {
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index < homeViewModel.tenders.length) {
return TendersListItem(tender: homeViewModel.tenders[index]);
return TendersListItem(
tender: homeViewModel.tenders[index],
onTap: () {
TenderDetailRouteData(
tenderId: homeViewModel.tenders[index].id!,
).push(context);
},
);
} else {
return const Center(
child: Padding(
+8 -1
View File
@@ -211,7 +211,14 @@ class MobileHomePage extends StatelessWidget {
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index < homeViewModel.tenders.length) {
return TendersListItem(tender: homeViewModel.tenders[index]);
return TendersListItem(
tender: homeViewModel.tenders[index],
onTap: () {
TenderDetailRouteData(
tenderId: homeViewModel.tenders[index].id!,
).push(context);
},
);
} else {
return const Center(
child: Padding(
+8 -1
View File
@@ -232,7 +232,14 @@ class TabletHomePage extends StatelessWidget {
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index < homeViewModel.tenders.length) {
return TendersListItem(tender: homeViewModel.tenders[index]);
return TendersListItem(
tender: homeViewModel.tenders[index],
onTap: () {
TenderDetailRouteData(
tenderId: homeViewModel.tenders[index].id!,
).push(context);
},
);
} else {
return const Center(
child: Padding(
+1
View File
@@ -16,4 +16,5 @@ class HomeStrings {
static const String tenderDeadline = 'Deadline';
static const String recommendedTenders = 'Recommended Tenders';
static const String tenderMatchProfile = 'Match with your profile';
static const String seeMoreButton = 'See More';
}
+32 -18
View File
@@ -8,11 +8,13 @@ import 'package:tm_app/views/home/widgets/tender_card_progress_bar.dart';
import '../../core/constants/assets.dart';
import '../../core/theme/colors.dart';
import '../../core/utils/size_config.dart';
import '../shared/base_button.dart';
import '../shared/flag.dart';
class TendersListItem extends StatelessWidget {
const TendersListItem({required this.tender, super.key});
const TendersListItem({required this.tender, required this.onTap, super.key});
final TenderData tender;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
@@ -102,24 +104,36 @@ class TendersListItem extends StatelessWidget {
const TenderCardProgressBar(),
SizedBox(height: 15.0.h()),
Row(
children: [
SvgPicture.asset(AssetsManager.location),
SizedBox(width: 1.0.w()),
Text(
tender.countryCode!,
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey80,
Expanded(
child: Row(
children: [
SvgPicture.asset(AssetsManager.location),
SizedBox(width: 1.0.w()),
Text(
tender.countryCode!,
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey80,
),
),
),
SizedBox(width: 8.0.w()),
tender.countryCode != null
? Flag(countryCode: tender.countryCode!)
: const Flag(countryCode: ''),
const Spacer(),
],
SizedBox(width: 8.0.w()),
tender.countryCode != null
? Flag(countryCode: tender.countryCode!)
: const Flag(countryCode: ''),
const Spacer(),
BaseButton(
text: HomeStrings.seeMoreButton,
backgroundColor: AppColors.primary2,
isEnabled: true,
width: 100.0.w(),
height: 40.0.h(),
textColor: AppColors.mainBlue,
fontSize: 12.0.sp(),
onPressed: onTap,
),
],
),
),
],
),
+91 -84
View File
@@ -52,93 +52,100 @@ class _LoginDesktopPageState extends State<LoginDesktopPage> {
mainAxisAlignment:
kIsWeb ? MainAxisAlignment.spaceAround : MainAxisAlignment.center,
children: [
SizedBox(
width: 536,
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
AssetsManager.logoBig,
width: 320,
height: 50,
fit: BoxFit.cover,
),
SizedBox(height: 72.0.h()),
const LoginTitle(),
SizedBox(height: 32.0.h()),
LoginTextField(
controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus,
label: LoginStrings.usernameLabel,
iconPath: AssetsManager.userIcon,
fieldHeight: 60.0.h(),
borderRedus: 12,
prefixIconPadding: 7.0.w(),
),
SizedBox(height: 16.0.h()),
LoginTextField(
controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus,
label: LoginStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon,
prefixIconPadding: 7.0.w(),
isPassword: true,
obscureText: viewModel.obscurePassword,
fieldHeight: 60.0.h(),
onToggleVisibility: viewModel.togglePasswordVisibility,
borderRedus: 12,
),
SizedBox(height: 32.0.h()),
if (viewModel.isLoading)
const BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
)
else
BaseButton(
isEnabled: viewModel.isLoginEnabled,
onPressed: () async {
if (viewModel.isLoginEnabled) {
await viewModel.login();
}
},
),
const SizedBox(height: 32.0),
TextButton(
onPressed: () {
const ForgotPasswordRouteData().push(context);
},
child: Text(
LoginStrings.forgotPassword,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
Expanded(
child: Center(
child: SizedBox(
width: 364,
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
AssetsManager.logoBig,
width: 320,
height: 50,
fit: BoxFit.cover,
),
),
),
],
);
},
SizedBox(height: 72.0.h()),
const LoginTitle(),
SizedBox(height: 32.0.h()),
LoginTextField(
controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus,
label: LoginStrings.usernameLabel,
iconPath: AssetsManager.userIcon,
fieldHeight: 60.0.h(),
borderRedus: 12,
prefixIconPadding: 7.0.w(),
),
SizedBox(height: 16.0.h()),
LoginTextField(
controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus,
label: LoginStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon,
prefixIconPadding: 7.0.w(),
isPassword: true,
obscureText: viewModel.obscurePassword,
fieldHeight: 60.0.h(),
onToggleVisibility:
viewModel.togglePasswordVisibility,
borderRedus: 12,
),
SizedBox(height: 32.0.h()),
if (viewModel.isLoading)
const BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
)
else
BaseButton(
isEnabled: viewModel.isLoginEnabled,
onPressed: () async {
if (viewModel.isLoginEnabled) {
await viewModel.login();
}
},
),
const SizedBox(height: 32.0),
TextButton(
onPressed: () {
const ForgotPasswordRouteData().push(context);
},
child: Text(
LoginStrings.forgotPassword,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
],
);
},
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 20.0.h(),
horizontal: 25.0.w(),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(32),
child: Image.asset(
AssetsManager.webLoginImage,
width: 796.0,
height: 944.0,
fit: BoxFit.fitWidth,
),
),
),
kIsWeb
? Padding(
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
child: ClipRRect(
borderRadius: BorderRadius.circular(32),
child: Image.asset(
AssetsManager.webLoginImage,
width: 796.0,
height: 944.0,
fit: BoxFit.fitWidth,
),
),
)
: Container(),
],
),
),
+9 -1
View File
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/theme/colors.dart';
@@ -56,7 +57,14 @@ class _LoginTabletPageState extends State<LoginTabletPage> {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
LoginLogo(width: 190.0.w(), height: 88.0.h()),
Padding(
padding: EdgeInsets.symmetric(horizontal: 22.0.w()),
child: SvgPicture.asset(
AssetsManager.logoBig,
width: double.infinity,
height: 50.0.h(),
),
),
SizedBox(height: 32.0.h()),
const LoginTitle(),
SizedBox(height: 32.0.h()),
@@ -45,6 +45,8 @@ class LoginTextField extends StatelessWidget {
horizontal: 12.0.w(),
),
labelText: label,
filled: true,
fillColor: AppColors.grey0,
prefixIcon:
iconPath != null
? Padding(
+8 -4
View File
@@ -16,9 +16,11 @@ class BaseButton extends StatelessWidget {
final double? borderRadius;
final double? elevation;
final double? width;
final double? height;
final bool isLoading;
final String? icon;
final Color? iconColor;
final double? fontSize;
const BaseButton({
required this.isEnabled,
@@ -31,9 +33,11 @@ class BaseButton extends StatelessWidget {
this.borderRadius,
this.elevation,
this.width,
this.height,
this.isLoading = false,
this.icon,
this.iconColor,
this.fontSize,
super.key,
});
@@ -42,7 +46,7 @@ class BaseButton extends StatelessWidget {
return isLoading
? Container(
width: double.infinity,
height: 55.0.h(),
height: height ?? 55.0.h(),
decoration: BoxDecoration(
color: AppColors.mainBlue,
borderRadius: BorderRadius.circular(28.0.w()),
@@ -60,7 +64,7 @@ class BaseButton extends StatelessWidget {
)
: SizedBox(
width: width ?? double.infinity,
height: 55.0.h(),
height: height ?? 55.0.h(),
child: ElevatedButton(
onPressed: isEnabled ? onPressed : null,
style: ElevatedButton.styleFrom(
@@ -94,7 +98,7 @@ class BaseButton extends StatelessWidget {
Text(
text ?? LoginStrings.loginButton,
style: TextStyle(
fontSize: 16.0.sp(),
fontSize: fontSize ?? 16.0.sp(),
fontWeight: FontWeight.bold,
color: textColor ?? AppColors.white,
),
@@ -104,7 +108,7 @@ class BaseButton extends StatelessWidget {
: Text(
text ?? LoginStrings.loginButton,
style: TextStyle(
fontSize: 16.0.sp(),
fontSize: fontSize ?? 16.0.sp(),
fontWeight: FontWeight.bold,
color: textColor ?? AppColors.white,
),
@@ -36,7 +36,20 @@ class DesktopNavigationWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(width: 40),
SvgPicture.asset(AssetsManager.logoSmall),
InkWell(
onTap: () {
if (currentIndex == 0) {
return;
} else {
Router.neglect(
context,
() => const HomeRouteData().go(context),
);
context.read<HomeViewModel>().init();
}
},
child: SvgPicture.asset(AssetsManager.logoSmall),
),
const Spacer(),
_navigationItem(
context: context,