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: Better support for intrinsics, table, vertical-align, and display #1306

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Sub6Resources
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Patch coverage: 44.94% and project coverage change: -0.95 ⚠️

Comparison is base (79ec194) 64.91% compared to head (90550dd) 63.96%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1306      +/-   ##
==========================================
- Coverage   64.91%   63.96%   -0.95%     
==========================================
  Files          38       39       +1     
  Lines        2981     3022      +41     
==========================================
- Hits         1935     1933       -2     
- Misses       1046     1089      +43     
Impacted Files Coverage Δ
lib/src/style/margin.dart 62.61% <0.00%> (-1.39%) ⬇️
lib/src/css_box_widget.dart 59.13% <23.91%> (-5.82%) ⬇️
lib/src/style.dart 83.87% <50.00%> (-1.78%) ⬇️
lib/src/builtins/styled_element_builtin.dart 92.85% <77.77%> (+0.37%) ⬆️
lib/src/builtins/image_builtin.dart 61.16% <100.00%> (+0.76%) ⬆️
lib/src/builtins/interactive_element_builtin.dart 95.45% <100.00%> (+0.85%) ⬆️
lib/src/processing/margins.dart 71.15% <100.00%> (-22.73%) ⬇️
lib/src/style/display.dart 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

context.styledElement!.style.display == Display.inlineBlock) &&
final style = context.styledElement!.style;
final display = style.display ?? Display.inline;
if (display.displayListItem ||
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this

],
style: Style(),
),
child: SizedBox.expand(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now allows nested tables I think, which is great! Can we still use a wrapper TagWrapExtension to make the table horizontally scrollable?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I didn't check that in my testing. I'll look over that again and let you know!

@Sembauke
Copy link

Sembauke commented Jun 7, 2023

What does this pr do?

@Sub6Resources
Copy link
Owner Author

Sub6Resources commented Jun 7, 2023

Sorry @Sembauke I opened this right as a flight I was waiting for started boarding, so it didn't include any details and still needs some tests written.

Mainly, this fixes #1165 by properly interpreting the CSS vertical-align property on all elements. Most elements, block-level elements in particular, don't need to align with the text baseline, so they will default to PlaceholderAlignment.bottom, which has no issues in an intrinsically sized context. It also adds a try-catch that keeps dry layout from failing and instead prints a more developer-friendly message to the console letting them know that their html in an intrinsic context may have layout bugs that can be fixed by explicitly setting vertical-align to bottom. So far I've only seen this triggered by images within a table, but I'm sure there are many other cases this will come up in, especially within the intrinsic context of tables.

This PR also expands the Display enum to use a more css-like approach under the hood and adds the full set of values, even if they aren't supported by the core flutter_html so that extensions like flutter_html_table can utilize display: table; and other related properties. This means that extension authors can more easily implement things like grid and flex display types without needing to parse the CSS on their own.

@Sub6Resources Sub6Resources changed the title Fix/intrinsics and table fix: Better support for intrinsics, table, vertical-align, and display Jun 7, 2023
@droplet-js
Copy link

Any news update? I have same issue, when i use Html Widget as CupertinoAlertDialog content.

@frankvollebregt
Copy link

For me, the current beta version doesn't correctly calculate the intrinsic height, so I'm using a dependency override from this branch (which works great for my needs!). When is this expected to be merged into a (pre)release?

@omar3alaa
Copy link

omar3alaa commented Aug 3, 2023

Hey! Any ETA when this gonna be merged and released? @Sub6Resources

@EtcGonza
Copy link

EtcGonza commented Aug 8, 2023

Greetings! Any update? I have the same issue...

@omar3alaa
Copy link

Hey @Sub6Resources! Really appreciate your efforts on this PR, it helps a lot to fix an existing issue for a lot of the plugin's users. Do we have any expected timeline for it to be released as we blocked by it for releasing a new feature for our company?

@ManuEspesoJbs
Copy link

No ETA? I'm facing same problem

@Sub6Resources Sub6Resources self-assigned this Dec 18, 2023
@Sub6Resources Sub6Resources added this to the 3.0.0 milestone Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

None yet

8 participants