Skip to content

fix RTL Table View #1147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

yasseralsaidi
Copy link

to fix RTL Table View that show content table from left to right instead of right to left
i add an option to show RTL content in table as proper RTL direction
just by adding .showRTL() in headers & data .

example code:

final table = pw.Table.fromTextArray(
    headers: tableHeaders.showRTL(),
    data: tableData.showRTL(),
...

before add showRTL:
01

after add showRTL:
02

add an option to show RTL content in table as RTL direction
@yasseralsaidi yasseralsaidi mentioned this pull request Sep 10, 2022
5 tasks
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2022

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 38.13%. Comparing base (016cba4) to head (78bb055).
Report is 222 commits behind head on master.

Files with missing lines Patch % Lines
pdf/lib/src/widgets/table.dart 0.00% 7 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1147      +/-   ##
==========================================
- Coverage   38.35%   38.13%   -0.22%     
==========================================
  Files         131      131              
  Lines       19550    19523      -27     
==========================================
- Hits         7499     7446      -53     
- Misses      12051    12077      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DavBfr
Copy link
Owner

DavBfr commented Sep 10, 2022

It's not the right way to do it. Flutter automatically reverse the columns when there is a Directionality(textDirection: TextDirection.rtl) ancester Widget.

@yasseralsaidi
Copy link
Author

@DavBfr so why it shows the wrong direction even if we use textDirection as RTL?
can we fix it and integrated with (textDirection == TextDirection.rtl) to do my method automatically!

like:

if (textDirection == TextDirection.rtl) {
  headers= headers.showRTL();
  data= data.showRTL();
} else {
headers= headers;
data= data;
}

@DavBfr
Copy link
Owner

DavBfr commented Sep 10, 2022

The table layout must take the direction into account.
in this function: https://github.com/DavBfr/dart_pdf/blob/master/pdf/lib/src/widgets/table.dart#L432

@DavBfr DavBfr force-pushed the master branch 2 times, most recently from 2f5f621 to 9ea6533 Compare May 3, 2023 11:48
@minhdanh
Copy link
Contributor

Hi @DavBfr, it looks like the direction of the table is not working. I tried rtl and ltr and the direction of the table is still the same: #1526 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants