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

Added support for tables using RichText. #60

Merged
merged 7 commits into from
Feb 5, 2019

Conversation

jeffmikels
Copy link
Contributor

No description provided.

@jeffmikels
Copy link
Contributor Author

The RichText renderer now successfully handles the table in the example/main.dart file, and appears to handle that entire html properly. Except there is some extra whitespace at the beginning of block elements. I'm working on removing that.

@Sub6Resources Sub6Resources self-requested a review February 4, 2019 19:32
@Sub6Resources Sub6Resources self-assigned this Feb 4, 2019
@Sub6Resources Sub6Resources added bugfix Fixes a bug in the package high-priority labels Feb 4, 2019
parseContext.parentElement.children.add(span);
} else {
print('doing nothing');
Copy link
Owner

Choose a reason for hiding this comment

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

Can we just make this a comment since it doesn't really affect the average user?

Suggested change
print('doing nothing');
//Doing nothing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@jeffmikels
Copy link
Contributor Author

Tables are rendered using Column>Row>Expanded Widgets colspan attributes are honored, but no computation is made over the whole table. That is, if different rows have different numbers of cells, browsers will create an empty dummy cell to keep the columns lined up. This code will simply create a row with a different number of cells and the columns will no longer line up.

In the future, the parser should use a scrolling grid layout instead of columns and rows, but that will require significant modifications to the way the parser currently works.

I'm still hoping for a native html widget from the Flutter developers!

Copy link
Owner

@Sub6Resources Sub6Resources left a comment

Choose a reason for hiding this comment

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

Just one more issue I noticed, then I'll merge.

Thanks for being so willing to contribute to the project!

parseContext.parentElement is LinkTextSpan) {
String lastString = parseContext.parentElement.text ?? '';
if (!parseContext.parentElement.children.isEmpty) {
lastString = parseContext.parentElement.children.last.text;
Copy link
Owner

Choose a reason for hiding this comment

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

I had an issue with endsWith(' ') (below) getting called on a null lastString.

Suggested change
lastString = parseContext.parentElement.children.last.text;
lastString = parseContext.parentElement.children.last.text ?? '';

Adding the ?? '' fixed the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes a bug in the package high-priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants