improve responsive sizes

This commit is contained in:
mohamadmahdi jebeli 2025-07-31 10:49:36 +03:30
parent ae5b280ffa
commit 0586fde872
5 changed files with 30 additions and 21 deletions

View File

@ -141,12 +141,14 @@ class _OfferCardState extends State<OfferCard> {
children: [ children: [
SvgPicture.asset(Assets.icons.routing.path), SvgPicture.asset(Assets.icons.routing.path),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Flexible(
'نوع تخفیف : ${(100 - widget.offer.finalPrice / widget.offer.originalPrice * 100).toInt()}% ${widget.offer.discountType}', child: Text(
style: const TextStyle( 'نوع تخفیف : ${(100 - widget.offer.finalPrice / widget.offer.originalPrice * 100).toInt()}% ${widget.offer.discountType}',
color: Color.fromARGB(255, 183, 28, 28), fontSize: 14), style: const TextStyle(
maxLines: 1, color: Color.fromARGB(255, 183, 28, 28), fontSize: 13),
overflow: TextOverflow.ellipsis, maxLines: 1,
overflow: TextOverflow.ellipsis,
),
), ),
], ],
), ),

View File

@ -6,6 +6,7 @@ import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart' show NumberFormat;
import 'package:maps_launcher/maps_launcher.dart'; import 'package:maps_launcher/maps_launcher.dart';
import 'package:proxibuy/core/config/api_config.dart'; import 'package:proxibuy/core/config/api_config.dart';
import 'package:proxibuy/core/config/app_colors.dart'; import 'package:proxibuy/core/config/app_colors.dart';
@ -76,7 +77,7 @@ class ProductDetailPage extends StatelessWidget {
final dio = Dio(); final dio = Dio();
final url = ApiConfig.baseUrl + ApiConfig.addReservation; final url = ApiConfig.baseUrl + ApiConfig.addReservation;
final data = { final data = {
'Discount': offer.id, 'Discount': offer.id,
'Distance': offer.distanceInMeters.toString(), 'Distance': offer.distanceInMeters.toString(),
@ -94,7 +95,7 @@ class ProductDetailPage extends StatelessWidget {
final response = final response =
await dio.post(url, data: data, options: options); await dio.post(url, data: data, options: options);
debugPrint("---------- RESPONSE-----------"); debugPrint("---------- RESPONSE-----------");
debugPrint("StatusCode: ${response.statusCode}"); debugPrint("StatusCode: ${response.statusCode}");
debugPrint("Data: ${response.data}"); debugPrint("Data: ${response.data}");
@ -134,7 +135,7 @@ class ProductDetailPage extends StatelessWidget {
debugPrint("StatusCode: ${e.response?.statusCode}"); debugPrint("StatusCode: ${e.response?.statusCode}");
debugPrint("Data: ${e.response?.data}"); debugPrint("Data: ${e.response?.data}");
debugPrint("--------------------------"); debugPrint("--------------------------");
final errorMessage = e.response?.data?['message'] ?? final errorMessage = e.response?.data?['message'] ??
'خطای سرور هنگام رزرو. لطفاً دوباره تلاش کنید.'; 'خطای سرور هنگام رزرو. لطفاً دوباره تلاش کنید.';
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
@ -404,6 +405,9 @@ class _ProductDetailViewState extends State<ProductDetailView> {
? widget.offer.expiryTime.difference(DateTime.now()) ? widget.offer.expiryTime.difference(DateTime.now())
: Duration.zero; : Duration.zero;
final formatCurrency =
NumberFormat.decimalPattern('fa_IR'); // Or 'en_US'
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0) padding: const EdgeInsets.symmetric(horizontal: 24.0)
.copyWith(bottom: 5.0, top: 24.0), .copyWith(bottom: 5.0, top: 24.0),
@ -588,7 +592,7 @@ class _ProductDetailViewState extends State<ProductDetailView> {
children: [ children: [
Container( Container(
padding: padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 8), const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.singleOfferType, color: AppColors.singleOfferType,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
@ -598,7 +602,7 @@ class _ProductDetailViewState extends State<ProductDetailView> {
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 17, fontSize: 13,
), ),
), ),
), ),
@ -612,16 +616,16 @@ class _ProductDetailViewState extends State<ProductDetailView> {
Text( Text(
'(${(100 - widget.offer.finalPrice / widget.offer.originalPrice * 100).toInt()}%)', '(${(100 - widget.offer.finalPrice / widget.offer.originalPrice * 100).toInt()}%)',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 14,
color: AppColors.singleOfferType, color: AppColors.singleOfferType,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
widget.offer.originalPrice.toStringAsFixed(0), formatCurrency.format(widget.offer.originalPrice),
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 14,
color: Colors.grey.shade600, color: Colors.grey.shade600,
decoration: TextDecoration.lineThrough, decoration: TextDecoration.lineThrough,
), ),
@ -630,10 +634,10 @@ class _ProductDetailViewState extends State<ProductDetailView> {
), ),
const SizedBox(height: 1), const SizedBox(height: 1),
Text( Text(
'${widget.offer.finalPrice.toStringAsFixed(0)} تومان', '${formatCurrency.format(widget.offer.finalPrice)} تومان',
style: const TextStyle( style: const TextStyle(
color: AppColors.singleOfferType, color: AppColors.singleOfferType,
fontSize: 22, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -4,6 +4,7 @@ import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:intl/intl.dart';
import 'package:proxibuy/core/gen/assets.gen.dart'; import 'package:proxibuy/core/gen/assets.gen.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
import 'package:proxibuy/core/config/app_colors.dart'; import 'package:proxibuy/core/config/app_colors.dart';
@ -64,7 +65,6 @@ class _ReservedListItemCardState extends State<ReservedListItemCard> {
}); });
} }
void _calculateRemainingTime() { void _calculateRemainingTime() {
final now = DateTime.now(); final now = DateTime.now();
if (widget.offer.expiryTime.isAfter(now)) { if (widget.offer.expiryTime.isAfter(now)) {
@ -115,7 +115,7 @@ class _ReservedListItemCardState extends State<ReservedListItemCard> {
0.2126, 0.7152, 0.0722, 0, 0, 0.2126, 0.7152, 0.0722, 0, 0,
0.2126, 0.7152, 0.0722, 0, 0, 0.2126, 0.7152, 0.0722, 0, 0,
0.2126, 0.7152, 0.0722, 0, 0, 0.2126, 0.7152, 0.0722, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 1, 0,
]), ]),
child: cardContent, child: cardContent,
); );
@ -323,6 +323,8 @@ class _ReservedListItemCardState extends State<ReservedListItemCard> {
} }
Widget _buildExpansionPanel() { Widget _buildExpansionPanel() {
final formatCurrency = NumberFormat.decimalPattern('fa_IR');
return AnimatedCrossFade( return AnimatedCrossFade(
firstChild: Container(), firstChild: Container(),
secondChild: Container( secondChild: Container(
@ -370,7 +372,7 @@ class _ReservedListItemCardState extends State<ReservedListItemCard> {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
widget.offer.originalPrice.toStringAsFixed(0), formatCurrency.format(widget.offer.originalPrice),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Colors.grey.shade600, color: Colors.grey.shade600,
@ -381,7 +383,7 @@ class _ReservedListItemCardState extends State<ReservedListItemCard> {
), ),
const SizedBox(height: 1), const SizedBox(height: 1),
Text( Text(
'${widget.offer.finalPrice.toStringAsFixed(0)} تومان', '${formatCurrency.format(widget.offer.finalPrice)} تومان',
style: const TextStyle( style: const TextStyle(
color: AppColors.singleOfferType, color: AppColors.singleOfferType,
fontSize: 18, fontSize: 18,

View File

@ -894,7 +894,7 @@ packages:
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
intl: intl:
dependency: transitive dependency: "direct main"
description: description:
name: intl name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf

View File

@ -61,6 +61,7 @@ dependencies:
connectivity_plus: ^6.1.4 connectivity_plus: ^6.1.4
dart_jsonwebtoken: ^3.2.0 dart_jsonwebtoken: ^3.2.0
audioplayers: ^6.5.0 audioplayers: ^6.5.0
intl: ^0.19.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: