fixed rtl supoort in some pages

This commit is contained in:
amirrezaghabeli
2025-09-17 14:33:04 +03:30
parent 576d277d62
commit e015c941d2
14 changed files with 270 additions and 240 deletions
+4
View File
@@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.57 5.93018L3.5 12.0002L9.57 18.0702" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M20.5 12H3.67004" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 395 B

+2 -2
View File
@@ -8,13 +8,13 @@ class AppConfig {
// این متد بر اساس محیط فعال، URL مناسب را برمی‌گرداند. // این متد بر اساس محیط فعال، URL مناسب را برمی‌گرداند.
static String get apiBaseUrl { static String get apiBaseUrl {
return 'http://10.0.2.2:8081'; // return 'http://10.0.2.2:8081';
// return '192.168.1.103:8081'; // return '192.168.1.103:8081';
// if (isDevelopment) { // if (isDevelopment) {
// // Handle different platforms for local development // // Handle different platforms for local development
// if (kIsWeb) { // if (kIsWeb) {
// For web, use localhost // For web, use localhost
// return 'https://app.opplens.com'; return 'https://app.opplens.com';
// return 'http://localhost:8081'; // return 'http://localhost:8081';
// } else { // } else {
// For Android emulator, use 10.0.2.2 (special IP for host machine) // For Android emulator, use 10.0.2.2 (special IP for host machine)
+1
View File
@@ -47,6 +47,7 @@ class AssetsManager {
static const shield = 'assets/icons/shield.svg'; static const shield = 'assets/icons/shield.svg';
static const edit = 'assets/icons/edit.svg'; static const edit = 'assets/icons/edit.svg';
static const arrowRight = 'assets/icons/arrow-right.svg'; static const arrowRight = 'assets/icons/arrow-right.svg';
static const leftArrow = 'assets/icons/left-arrow.svg';
static const notification = 'assets/icons/notification.svg'; static const notification = 'assets/icons/notification.svg';
static const danger = 'assets/icons/danger.svg'; static const danger = 'assets/icons/danger.svg';
@@ -86,6 +86,8 @@ class _TenderDetailMobilePageState extends State<TenderDetailMobilePage> {
}); });
} }
}, },
child: Directionality(
textDirection: TextDirection.rtl,
child: Scaffold( child: Scaffold(
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
appBar: appBar( appBar: appBar(
@@ -96,7 +98,9 @@ class _TenderDetailMobilePageState extends State<TenderDetailMobilePage> {
builder: (context, tenderViewModel, child) { builder: (context, tenderViewModel, child) {
if (tenderViewModel.isLoading) { if (tenderViewModel.isLoading) {
return const Center( return const Center(
child: CircularProgressIndicator(color: AppColors.secondary50), child: CircularProgressIndicator(
color: AppColors.secondary50,
),
); );
} }
@@ -132,6 +136,7 @@ class _TenderDetailMobilePageState extends State<TenderDetailMobilePage> {
}, },
), ),
), ),
),
); );
} }
} }
+1 -1
View File
@@ -182,7 +182,7 @@ class DesktopHomePage extends StatelessWidget {
return ConstrainedBox( return ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 740), constraints: const BoxConstraints(maxWidth: 740),
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: AlignmentDirectional.centerStart,
child: Text( child: Text(
isYourTenders isYourTenders
? HomeStrings.yourTenders ? HomeStrings.yourTenders
+10 -1
View File
@@ -31,6 +31,7 @@ class TenderCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final directionality = Directionality.of(context);
return InkWell( return InkWell(
onTap: enableTap ? onTap : null, onTap: enableTap ? onTap : null,
child: Container( child: Container(
@@ -67,7 +68,15 @@ class TenderCard extends StatelessWidget {
), ),
), ),
enableTap enableTap
? SvgPicture.asset(AssetsManager.arrowRight) ? SvgPicture.asset(
directionality == TextDirection.rtl
? AssetsManager.leftArrow
: AssetsManager.arrowRight,
colorFilter: ColorFilter.mode(
AppColors.grey50,
BlendMode.srcIn,
),
)
: const SizedBox(), : const SizedBox(),
], ],
), ),
+2 -1
View File
@@ -87,9 +87,10 @@ class TendersListItem extends StatelessWidget {
width: double.infinity, width: double.infinity,
child: Text( child: Text(
tender.description!, tender.description!,
textAlign: TextAlign.left, textAlign: TextAlign.start,
maxLines: 4, maxLines: 4,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -56,9 +56,7 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
endDrawer: Drawer( endDrawer: Drawer(
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.horizontal(left: Radius.circular(20)),
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Column( child: Column(
@@ -131,10 +129,6 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
return Column( return Column(
children: [ children: [
Expanded( Expanded(
child: RefreshIndicator(
onRefresh: () async {
await viewModel.getLikedTenders(reset: true);
},
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 24.0.w(), horizontal: 24.0.w(),
@@ -147,8 +141,7 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
bool hasApproval = viewModel bool hasApproval = viewModel
.hasTenderApprovalForTender(item.tenderId!); .hasTenderApprovalForTender(item.tenderId!);
if (hasApproval) { if (hasApproval) {
approval = viewModel approval = viewModel.getApprovalStatusForTender(
.getApprovalStatusForTender(
item.tenderId!, item.tenderId!,
); );
} else { } else {
@@ -185,7 +178,6 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
}, },
), ),
), ),
),
SizedBox(height: 10.0.h()), SizedBox(height: 10.0.h()),
+1 -1
View File
@@ -140,7 +140,7 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
SizedBox(height: 24.0.h()), SizedBox(height: 24.0.h()),
// Spacer(), // Spacer(),
Align( Align(
alignment: Alignment.centerRight, alignment: AlignmentDirectional.centerEnd,
child: InkWell( child: InkWell(
onTap: () => viewModel.logout(), onTap: () => viewModel.logout(),
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
+1 -1
View File
@@ -145,7 +145,7 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
SizedBox(height: 24.0.h()), SizedBox(height: 24.0.h()),
// Spacer(), // Spacer(),
Align( Align(
alignment: Alignment.centerRight, alignment: AlignmentDirectional.centerStart,
child: InkWell( child: InkWell(
onTap: () => viewModel.logout(), onTap: () => viewModel.logout(),
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
+2 -1
View File
@@ -35,6 +35,7 @@ PreferredSizeWidget appBar({
required BuildContext context, required BuildContext context,
required String title, required String title,
}) { }) {
final isRtl = Directionality.of(context) == TextDirection.rtl;
return PreferredSize( return PreferredSize(
preferredSize: const Size.fromHeight(60), preferredSize: const Size.fromHeight(60),
child: AppBar( child: AppBar(
@@ -43,7 +44,7 @@ PreferredSizeWidget appBar({
titleSpacing: 0, titleSpacing: 0,
leading: IconButton( leading: IconButton(
icon: SvgPicture.asset( icon: SvgPicture.asset(
AssetsManager.arrowLeft, isRtl ? AssetsManager.arrowRight : AssetsManager.arrowLeft,
height: 24.0.w(), height: 24.0.w(),
width: 24.0.w(), width: 24.0.w(),
), ),
+10 -5
View File
@@ -34,8 +34,7 @@ class _TabletTendersPageState extends State<TabletTendersPage> {
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
appBar: tabletAppBar(title: TendersStrings.tendersTitle, key: key), appBar: tabletAppBar(title: TendersStrings.tendersTitle, key: key),
drawer: const TabletNavigationWidget(currentIndex: 1), drawer: const TabletNavigationWidget(currentIndex: 1),
body: SingleChildScrollView( body: Consumer<TendersViewModel>(
child: Consumer<TendersViewModel>(
builder: (context, viewModel, child) { builder: (context, viewModel, child) {
if (viewModel.isLoading) { if (viewModel.isLoading) {
return const Center( return const Center(
@@ -50,15 +49,21 @@ class _TabletTendersPageState extends State<TabletTendersPage> {
viewModel.isLoading == false) { viewModel.isLoading == false) {
return const Center(child: Text(CommonStrings.noData)); return const Center(child: Text(CommonStrings.noData));
} }
return Padding( return Expanded(
padding: EdgeInsets.only(right: 24.0.w(), top: 128.0.h()), child: SingleChildScrollView(
child: Padding(
padding: EdgeInsetsDirectional.only(
end: 24.0.w(),
top: 128.0.h(),
),
child: MainTendersSlider( child: MainTendersSlider(
tenders: viewModel.tendersResponse?.data?.tenders ?? [], tenders: viewModel.tendersResponse?.data?.tenders ?? [],
), ),
),
),
); );
}, },
), ),
),
); );
} }
} }
@@ -83,8 +83,11 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool isLtr = Directionality.of(context) == TextDirection.ltr;
return SingleChildScrollView( return SingleChildScrollView(
child: Stack(children: [_tendersPageView(), _nextPreviousArrows()]), child: Stack(
children: [_tendersPageView(), _nextPreviousArrows(isLtr: isLtr)],
),
); );
} }
@@ -127,23 +130,26 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
); );
} }
Widget _nextPreviousArrows() { Widget _nextPreviousArrows({required bool isLtr}) {
return Positioned( return PositionedDirectional(
top: 607.0.h(), top: 607.0.h(),
bottom: 52.0.h(), bottom: 52.0.h(),
left: 9.0.w(), start: 9.0.w(),
right: 9.0.w(), end: 9.0.w(),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [_leftArrowButton(), _pageNumberText(), _rightArrowButton()], children: [
_leftArrowButton(isLtr: isLtr),
_pageNumberText(),
_rightArrowButton(isLtr: isLtr),
],
), ),
); );
} }
Widget _leftArrowButton() { Widget _leftArrowButton({required bool isLtr}) {
return Visibility( return currentPage != 1
visible: currentPage != 1, ? InkWell(
child: InkWell(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
onTap: _goToPreviousPage, onTap: _goToPreviousPage,
child: Container( child: Container(
@@ -155,15 +161,17 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: SvgPicture.asset( child: SvgPicture.asset(
AssetsManager.arrowLeftSmall, isLtr
? AssetsManager.arrowLeftSmall
: AssetsManager.arrowRightSmall,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
AppColors.iconColor, AppColors.iconColor,
BlendMode.srcATop, BlendMode.srcATop,
), ),
), ),
), ),
), )
); : SizedBox(width: 32.0.h(), height: 32.0.h());
} }
Widget _pageNumberText() { Widget _pageNumberText() {
@@ -195,10 +203,9 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
); );
} }
Widget _rightArrowButton() { Widget _rightArrowButton({required bool isLtr}) {
return Visibility( return currentPage != widget.tenders.length
visible: currentPage != widget.tenders.length, ? InkWell(
child: InkWell(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
onTap: _goToNextPage, onTap: _goToNextPage,
child: Container( child: Container(
@@ -210,14 +217,16 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: SvgPicture.asset( child: SvgPicture.asset(
AssetsManager.arrowRightSmall, isLtr
? AssetsManager.arrowRightSmall
: AssetsManager.arrowLeftSmall,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
AppColors.iconColor, AppColors.iconColor,
BlendMode.srcATop, BlendMode.srcATop,
), ),
), ),
), ),
), )
); : SizedBox(width: 32.0.h(), height: 32.0.h());
} }
} }
@@ -35,7 +35,9 @@ class _YourTendersMobilePageState extends State<YourTendersMobilePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
backgroundColor: AppColors.backgroundColor, backgroundColor: AppColors.backgroundColor,
appBar: appBar(context: context, title: YourTendersStrings.yourTenders), appBar: appBar(context: context, title: YourTendersStrings.yourTenders),
body: Column( body: Column(
@@ -104,6 +106,7 @@ class _YourTendersMobilePageState extends State<YourTendersMobilePage> {
), ),
], ],
), ),
),
); );
} }
} }