Skip to content
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

fix RTL Table View #1147

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 Report

Merging #1147 (78bb055) into master (016cba4) will decrease coverage by 0.21%.
The diff coverage is 0.00%.

@@            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     
Impacted Files Coverage Δ
pdf/lib/src/widgets/table.dart 93.14% <0.00%> (-2.74%) ⬇️
pdf/lib/src/pdf/obj/border.dart 0.00% <0.00%> (-10.00%) ⬇️
pdf/lib/src/pdf/obj/signature.dart 0.00% <0.00%> (-4.55%) ⬇️
pdf/lib/src/pdf/obj/page_label.dart 0.00% <0.00%> (-1.67%) ⬇️
pdf/lib/src/widgets/chart/point_chart.dart 32.69% <0.00%> (-1.27%) ⬇️
pdf/lib/src/pdf/document.dart 73.91% <0.00%> (-1.09%) ⬇️
pdf/lib/src/pdf/obj/outline.dart 74.07% <0.00%> (-0.93%) ⬇️
pdf/lib/src/pdf/obj/page.dart 72.22% <0.00%> (-0.76%) ⬇️
pdf/lib/src/widgets/flex.dart 71.76% <0.00%> (-0.65%) ⬇️
pdf/lib/src/widgets/decoration.dart 75.79% <0.00%> (-0.61%) ⬇️
... and 26 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? 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
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.

None yet

3 participants