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

blockquote support #4

Closed
wants to merge 405 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
405 commits
Select commit Hold shift + click to select a range
d715173
Fix inline rendering of (text) links
erickok Jan 15, 2021
783178c
Fixes #475 by passing the raw node to allow access to the raw attribu…
erickok Jan 15, 2021
640fd02
Fix video aspect ratio (huge black bars on top and bottom of video el…
tneotia Jan 16, 2021
30b6e74
Add basic support for svg elements in <img>
tneotia Jan 16, 2021
632e597
Merge pull request #501 from tneotia/fix/video-aspect-ratio
ryan-berger Jan 17, 2021
6704b8e
Merge pull request #502 from tneotia/feature/img-tag-svg-support
ryan-berger Jan 17, 2021
dea464b
Merge pull request #500 from vrtdev/bugfix/475-iframe-customrender-at…
ryan-berger Jan 17, 2021
b2467e7
Merge remote-tracking branch 'upstream/master' into feature/inlinespa…
erickok Jan 17, 2021
5429f07
Merge pull request #498 from vrtdev/feature/inlinespan-customrender
ryan-berger Jan 17, 2021
1f40f96
Image render API proposal
erickok Jan 18, 2021
39644f4
Also fix #312 as really only text in a <a> tag should have the text s…
erickok Jan 18, 2021
3fa2409
Removed old commented-out code
erickok Jan 18, 2021
c050862
Merge remote-tracking branch 'upstream/master' into bugfix/link-wrapping
erickok Jan 18, 2021
e2a9933
Merge pull request #499 from vrtdev/bugfix/link-wrapping
ryan-berger Jan 18, 2021
b8dc16c
Respect iframe sandbox attribute to enable/disable javascript; fixes …
erickok Jan 20, 2021
e5e24d0
Merge pull request #506 from vrtdev/feature/iframe-sandbox
ryan-berger Jan 20, 2021
97da193
Add support for HTML <details> and <summary> tags
tneotia Jan 20, 2021
724c45f
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Jan 20, 2021
3f89d81
Finish merging changes
tneotia Jan 20, 2021
cf9c684
Reshuffle <details> tag rendering to layout_element.dart to accomodat…
tneotia Jan 20, 2021
deac075
Add todo item
tneotia Jan 20, 2021
a733289
Fixes #515 by properly, recursively applying linking and styling to t…
erickok Jan 29, 2021
ee3eb73
Remove comment-out temporary code
erickok Jan 29, 2021
c6d6fa9
Use intrinsic with for <table> columns with otherwise undefined size
erickok Jan 29, 2021
bfadd44
bug fixed: when table col width is NaN
yuc-zhu Jan 29, 2021
d85df34
Overhaul README
tneotia Feb 1, 2021
661bfc8
Minor fix to prevent completer.complete() firing multiple times when …
tneotia Feb 1, 2021
24fda6b
Update README.md
tneotia Feb 1, 2021
f98bb5e
Update README.md
tneotia Feb 1, 2021
5fa3818
Minor fix to prevent rendering exception when video and audio sources…
tneotia Feb 2, 2021
bff3251
Solve case where <source /> is given with no src
tneotia Feb 2, 2021
3cfb18e
Update README.md
tneotia Feb 2, 2021
cfbc4f6
Add support for the font-size inline style
tneotia Feb 2, 2021
7c1644f
Minor update
tneotia Feb 2, 2021
f98fa6d
Fix % font size transferring to child rather than the font size itsel…
tneotia Feb 2, 2021
4cc782d
Add support for inline direction, display, font-family, font-style, f…
tneotia Feb 2, 2021
26488c6
Add font-feature-settings support
tneotia Feb 3, 2021
9073fd2
Refine font-size implementation, add support for line-height and text…
tneotia Feb 3, 2021
a209912
Conform line height default sizing to CSS spec (1.2 x font size)
tneotia Feb 3, 2021
cc3c833
Add support for text-decoration, text-decoration-color, text-decorati…
tneotia Feb 3, 2021
28da60f
Improve text-decoration algorithm and make units optional on FontSize…
tneotia Feb 3, 2021
e3b95f7
A few more minor fixes
tneotia Feb 3, 2021
7a157c1
Remove regexp when checking sources for <audio> and <video>
tneotia Feb 3, 2021
69aa227
Merge pull request #525 from tneotia/bugfix/empty-video-src
ryan-berger Feb 3, 2021
048a00a
Merge pull request #523 from tneotia/bugfix/gif-completer-issue
ryan-berger Feb 3, 2021
62743d8
Update README to add customImageRender details
tneotia Feb 4, 2021
8bd4e0b
Merge pull request #526 from tneotia/feature/inline-font-size
erickok Feb 4, 2021
c914679
Merge pull request #520 from yuc-zhu/patch-1
erickok Feb 4, 2021
17735ce
Merge pull request #519 from vrtdev/bugfix/491-table-columns-intrinsi…
ryan-berger Feb 4, 2021
0bd3132
Extend custom image API with svg support
erickok Feb 5, 2021
f24f461
Merge pull request #517 from vrtdev/bugfix/515-link-inner-html-linkin…
ryan-berger Feb 5, 2021
972861b
Remove summary child when displaying contents of dropdown, handle emp…
tneotia Feb 6, 2021
bae56f5
parent 4406a4f151eef92bb15669730d1a070dc4a143b8
ryan-berger Aug 8, 2020
f25a9c0
Merge remote-tracking branch 'origin/feature/details-tag' into featur…
tneotia Feb 6, 2021
1b3ab73
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Feb 6, 2021
db68e21
Fix shrink wrap not applying correctly
tneotia Feb 6, 2021
ecbd78f
Concise-ify code
tneotia Feb 6, 2021
d833de1
add custom
Feb 8, 2021
062d2fd
update sample
Feb 8, 2021
1719cfe
add missing param
Feb 8, 2021
645b49b
Add unit tests for all image source matchers
erickok Feb 8, 2021
d0b9319
Merge remote-tracking branch 'upstream/master' into feature/498-image…
erickok Feb 8, 2021
321bbfa
Apply fix from #523 back into new image loading API
erickok Feb 8, 2021
035c0a2
Code formatting on test with long literals
erickok Feb 8, 2021
3385afe
Bump dependency versions to those with Flutter 1.26 support; fixes #528
erickok Feb 8, 2021
e790aaa
Merge pull request #522 from tneotia/misc/update-readme
erickok Feb 8, 2021
25427fd
Fix incorrect detection of dropdown title and generally harden code
tneotia Feb 8, 2021
234adb4
Set alignment to left by default
tneotia Feb 8, 2021
e8f50ed
Merge pull request #505 from vrtdev/feature/498-image-render-api
erickok Feb 8, 2021
def53ac
Merge pull request #507 from tneotia/feature/details-tag
ryan-berger Feb 8, 2021
02465f6
Support relative paths for network image rendering via custom image r…
erickok Feb 8, 2021
82de69e
Merge remote-tracking branch 'remotes/Sub6Resources/master' into bugf…
tneotia Feb 8, 2021
bec5d84
Merge remote-tracking branch 'remotes/Sub6Resources/master' into bugf…
tneotia Feb 8, 2021
426c85d
Update documentation and clean up code
tneotia Feb 8, 2021
18be50f
Allow custom image loading widget for network images
erickok Feb 8, 2021
8eca2a3
Merge pull request #533 from vrtdev/feature/278-image-loading-widget
ryan-berger Feb 8, 2021
d5fd222
Allow rewriting urls for network images
erickok Feb 8, 2021
077cf1d
Update documentation with advanced uses of custom image renders
erickok Feb 9, 2021
252f784
Merge pull request #531 from vrtdev/feature/528-flutter-1-26-upgrades
ryan-berger Feb 9, 2021
1c51d62
Merge pull request #532 from vrtdev/feature/146-image-base-url
ryan-berger Feb 9, 2021
14ccce6
Clean up code 2
tneotia Feb 9, 2021
eab4eac
Update documentation and bump version in advance of 1.3.0 release
erickok Feb 9, 2021
14a9461
Code cleanup 3
tneotia Feb 9, 2021
9327fe9
Merge pull request #530 from tneotia/bugfix/shrink-wrap
ryan-berger Feb 9, 2021
b45b827
Support padding and 'start' attribute for lists, support RTL directio…
tneotia Feb 10, 2021
86e42ab
[URGENT] fix for `copyOnlyInherited on null` error after shrinkWrap f…
tneotia Feb 10, 2021
c43b903
Modify fix slightly to correct the actual source of the issue
tneotia Feb 10, 2021
7c3b33a
Fix "unknown character" box showing up when font-weight is below w400…
tneotia Feb 10, 2021
86ac375
Merge pull request #538 from tneotia/bugfix/hotfix-for-shrinkwrap-fixes
ryan-berger Feb 10, 2021
8d4d529
Add the ability for iframe to switch url if HTML data changes
tneotia Feb 11, 2021
900b685
Removed the 'example' entries from the readme index as they don't rea…
erickok Feb 11, 2021
037429e
Support switching multiple iframes
tneotia Feb 11, 2021
8db0104
Upgrade link functions to provide more control over onImageTap and on…
tneotia Feb 13, 2021
29668fb
Remove unnecessary code
tneotia Feb 13, 2021
33a2941
Revert "Remove unnecessary code"
tneotia Feb 13, 2021
d538662
Remove unnecessary code
tneotia Feb 13, 2021
e54a758
Support border inline style and hsl & named colors
tneotia Feb 14, 2021
fd978ab
Update README to include supported inline styles
tneotia Feb 14, 2021
c1bed37
Merge pull request #543 from tneotia/misc/remove-unnecessary-code
erickok Feb 14, 2021
5ee28d1
Replace GlobalKey with UniqueKey
tneotia Feb 16, 2021
226e2d3
Merge pull request #539 from tneotia/bugfix/iframe-src-change
erickok Feb 16, 2021
98c725c
Support creating Html widget from dom.Document
tneotia Feb 16, 2021
705ea53
Merge pull request #534 from vrtdev/prepare-120-release
ryan-berger Feb 16, 2021
03aa3f6
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Feb 16, 2021
4f1306f
Minor refactor to reduce the number of changes
tneotia Feb 16, 2021
083248d
Minor update to changelog for new changes before 1.3.0
tneotia Feb 16, 2021
f3da867
Merge pull request #547 from tneotia/misc/update-changelog
ryan-berger Feb 16, 2021
d9f04b1
Pre-nullsafety changes
tneotia Feb 17, 2021
dccdf30
Migrate example to nullsafety
tneotia Feb 17, 2021
0e5fb4e
Migrate src to nullsafety
tneotia Feb 17, 2021
2698376
Migrate lib & test to nullsafety
tneotia Feb 17, 2021
bf70b7c
add maxline
Feb 18, 2021
aa56c60
add overflow in text
Feb 18, 2021
8ca2aad
fix maxline
Feb 18, 2021
b06c883
add text overflow
Feb 18, 2021
a48fd9d
Adds support for data image uri with encoded svg
erickok Feb 22, 2021
957ae3b
Merge pull request #537 from tneotia/feature/start-and-padding-for-lists
erickok Feb 23, 2021
149e0f4
Support table margins and paddings.
erickok Feb 23, 2021
0392050
Merge remote-tracking branch 'tneotia/feature/upgrade-link-functions'…
erickok Feb 23, 2021
3bd2765
Support inner links
erickok Feb 23, 2021
c71774c
Fix bad-state no element bug on certain text decorations
tneotia Feb 24, 2021
64a0078
Misc changes & add support for numbers/em/rem/%/px/literal terms for …
tneotia Feb 24, 2021
3a6170b
Move parsing of html string to Html() constructor
tneotia Feb 24, 2021
b5c5ea0
Merge pull request #541 from tneotia/feature/upgrade-link-functions
erickok Feb 24, 2021
6ce25f6
Merge pull request #557 from tneotia/bugfix/bad-state
erickok Feb 24, 2021
baf9874
Fix example app errors due to #541
tneotia Feb 24, 2021
ba4c2e1
Merge pull request #558 from tneotia/bugfix/example-app-errors
erickok Feb 24, 2021
10b3726
Initial web support
tneotia Feb 24, 2021
ee8b56f
Initial support for Flutter Web - support iframes
tneotia Feb 24, 2021
2c52275
Revert change to example main.dart
tneotia Feb 24, 2021
328ccff
Merge pull request #559 from tneotia/feature/web-support
erickok Feb 25, 2021
b88d400
Fix merge conflicts
tneotia Mar 4, 2021
5dc121f
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Mar 4, 2021
65e4bc3
Fix merge conflicts 2
tneotia Mar 4, 2021
e8bb0fd
Fix null value issue and improve formatting
tneotia Mar 4, 2021
20b903f
Update dependencies (just chewie_audio left)
tneotia Mar 4, 2021
9639cdb
migration flutter 2.0
Mar 5, 2021
498eb45
Fix secondary issue from #569
tneotia Mar 5, 2021
90869b1
Hardcode chewie_audio height
tneotia Mar 5, 2021
3efa894
Update chewie_audio
tneotia Mar 5, 2021
6cbbdba
Final changes before 2.0.0-nullsafety.0 release
tneotia Mar 6, 2021
e421c47
Merge pull request #548 from tneotia/misc/nullsafety
erickok Mar 6, 2021
016de39
Fix nested bg color not showing through
tneotia Mar 6, 2021
bd1c5ff
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Mar 6, 2021
d39ca16
Update Html.fromDom() to nullsafety
tneotia Mar 6, 2021
acf383b
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Mar 6, 2021
022313a
Update border and hsl/named colors to nullsafety, fix orElse: bug wit…
tneotia Mar 6, 2021
cab3533
Merge pull request #544 from tneotia/feature/more-inline-styles
erickok Mar 6, 2021
fbfb505
Fix leading and trailing whitespaces issue
tneotia Mar 7, 2021
daab33c
Fix lists not rendering correctly
tneotia Mar 7, 2021
4688f1a
Merge pull request #575 from tneotia/bugfix/lists
erickok Mar 7, 2021
0d666a2
Add preliminary support for MathML
tneotia Mar 8, 2021
bf980a7
Add custom <tex> tag?
tneotia Mar 8, 2021
8391d56
migration 2.0.0
Mar 9, 2021
c0f5f93
Test for baseline alignment
tneotia Mar 12, 2021
7e7ec9b
Fixes #581 which caused a crash when using table cell rowspans in dif…
erickok Mar 13, 2021
d3187ba
Merge pull request #573 from tneotia/bugfix/nested-bg-color
erickok Mar 13, 2021
5d2293e
Final changes to MathML implementation
tneotia Mar 13, 2021
2eedb3a
Remove 3.5 bottom padding and remove accidental change to main.dart
tneotia Mar 15, 2021
9a8c4c8
Merge pull request #582 from vrtdev/bugfix/581-rowspan-crash
erickok Mar 16, 2021
47e3931
Proposal for #584 to add element (tree) to custom render, allowing to…
erickok Mar 16, 2021
e6032bb
Merge pull request #553 from vrtdev/bugfix/491-table-margin-and-padding
erickok Mar 16, 2021
c64b091
Merge remote-tracking branch 'upstream/master' into feature/data-uri-svg
erickok Mar 16, 2021
85decd4
Merged with nullsafety changes
erickok Mar 16, 2021
8200613
Merge pull request #546 from tneotia/feature/html-from-dom
erickok Mar 16, 2021
15c5cb5
Merge pull request #551 from vrtdev/feature/data-uri-svg
ryan-berger Mar 16, 2021
1fa33d8
Merge pull request #574 from tneotia/bugfix/leading-trailing-whitespaces
erickok Mar 16, 2021
4d67c41
Remove "display: block" behavior from <tex> whose parent is <body>
tneotia Mar 17, 2021
7801392
Merge branch 'master' into master
tneotia Mar 17, 2021
d7550d7
Remove official tex support and add note in README for customRender i…
tneotia Mar 18, 2021
ee0c641
Fix minor merge conflict
tneotia Mar 18, 2021
ad237b6
Merge pull request #577 from tneotia/master
erickok Mar 18, 2021
34aad28
Fix issue #590:type 'List<Expression>' is not a subtype of type 'List…
addcn-ai-10733 Mar 22, 2021
b792d06
Merge pull request #591 from windows7lake/master
erickok Mar 22, 2021
df53f43
Merge pull request #587 from vrtdev/feature/584-custom-render-tree-pr…
erickok Mar 26, 2021
93303a5
add maxlines support
Mar 30, 2021
b5a4516
update pubspec.yaml
Mar 30, 2021
546e54e
Merged with nullsafety changes
erickok Apr 1, 2021
9ec83cb
Fix exception because a default non-null id is used, but not usable
erickok Apr 1, 2021
ea949e8
Merge remote-tracking branch 'upstream/master' into feature/268-inner…
erickok Apr 1, 2021
5aaa9bf
Prepare 2.0.0 non-preview release
erickok Apr 1, 2021
2117832
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 2, 2021
246ab58
Update README after small public API change for customRender
erickok Apr 2, 2021
1d5fdba
Handle anchor taps also when no onLinkTap function is attached
erickok Apr 6, 2021
6b7e327
Export some libs to reduce the number of imports required
tneotia Apr 9, 2021
6888b0a
Fix text decoration not cascading between children and parent
tneotia Apr 9, 2021
4d75e7c
Merge pull request #614 from tneotia/bugfix/text-decoration-cascading
erickok Apr 9, 2021
ab974f4
Merge pull request #613 from tneotia/misc/expose-classes
erickok Apr 10, 2021
9a43e15
Use a global key for internal anchors to ensure uniqueness without ca…
erickok Apr 10, 2021
0192cef
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 10, 2021
6618e65
Add table with horizontal scroll as custom render example
erickok Apr 10, 2021
9c0bbc9
Add support for whitelisting tags
tneotia Apr 12, 2021
a274abe
Minor changes to README
tneotia Apr 21, 2021
b785705
Merge pull request #619 from tneotia/feature/whitelist-tags
erickok Apr 21, 2021
e3ebd0f
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 21, 2021
b473307
Update changelog with tagsList param
erickok Apr 21, 2021
5eacbf6
Bump flutter_svg to stable nullsafety relesae
erickok Apr 23, 2021
f6a2d29
Fix failed assertion when tap/scrolling on any link
tneotia Apr 24, 2021
0ed979c
Update pubspec.yaml with latest flutter_svg
erickok Apr 24, 2021
8dca91b
Improve linking support to (hopefully) all elements
tneotia Apr 24, 2021
8a28f93
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia Apr 24, 2021
8bee5a6
Add support for border-bottom/left/right/top, margin, margin-bottom/l…
tneotia Apr 26, 2021
35ac32c
Merge pull request #631 from tneotia/bugfix/gesture-recognizer-exception
erickok Apr 26, 2021
d38e952
chore: updated non-breaking dependencies
abhinandval Apr 27, 2021
617a081
Switch from try/catch to firstWhereOrNull from 'collections'
tneotia Apr 27, 2021
595cdd1
Remove unnecessary comments
tneotia Apr 28, 2021
15afa53
Merge pull request #638 from tneotia/misc/first-where
erickok Apr 28, 2021
2b8e1d1
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 28, 2021
afc3808
Merge pull request #636 from abhinandval/master
erickok Apr 28, 2021
7637c9d
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 28, 2021
2f36f5c
Merge remote-tracking branch 'origin/feature/200' into feature/200
erickok Apr 28, 2021
47d657a
Switch to dependency expressions to improve compatibility
tneotia Apr 28, 2021
4b153dd
Merge pull request #640 from tneotia/misc/dependency-expressions
erickok Apr 28, 2021
478506a
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 28, 2021
96f66d8
Add issue templates to help with organization
tneotia Apr 28, 2021
ba391f7
Updated CHANGELOG with latest changes
erickok Apr 29, 2021
3e026f5
rename maxLine to maxLines
Apr 29, 2021
4866bef
Revert regression when trying to add anchor support for inline elements
erickok Apr 29, 2021
0874d55
Merge pull request #555 from vrtdev/feature/268-inner-links
erickok Apr 29, 2021
de22c1c
Merge remote-tracking branch 'upstream/master' into feature/200
erickok Apr 29, 2021
ad75c59
Update changelog with inner links support
erickok Apr 29, 2021
0c6db96
Prepare 2.0.0-nullsafety.1
erickok Apr 29, 2021
3b72002
Mention 2.0.0 in README
erickok Apr 29, 2021
9cea071
Fix Stack Overflow error when using before and afters
tneotia May 1, 2021
2cd044e
Fix Bad State error when setting a ul to have an ol list type
tneotia May 1, 2021
89a89ba
Merge pull request #652 from tneotia/bugfix/olstack-ul
erickok May 1, 2021
ca7d26a
Remove unnecessary code
tneotia May 1, 2021
a5e5c8c
change style
May 2, 2021
2973ebb
Merge branch 'master' of https://github.com/Sub6Resources/flutter_html
May 2, 2021
e722421
Add support for the style tag
tneotia May 2, 2021
0f194f1
Remove unnecessary loop
tneotia May 2, 2021
d890115
Add getFromThemeData method to Style
tneotia May 3, 2021
acc288c
Merge pull request #653 from tneotia/bugfix/before-and-afters
erickok May 3, 2021
2857b20
remove unuse code + resolve conflict
May 3, 2021
754cb24
Rename getFromThemeData to fromThemeData
tneotia May 3, 2021
974def2
Add support for style.fromCSS
tneotia May 3, 2021
b744025
Add error handling for CSS parsing
tneotia May 3, 2021
e32e68a
Merge pull request #656 from tneotia/feature/style-from-theme-data
erickok May 3, 2021
c15d499
Merge pull request #596 from nguyenxdat/master
erickok May 3, 2021
380ca5a
Remove head from html_elements and fix empty space at the top of the …
tneotia May 3, 2021
9661568
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia May 3, 2021
ac0b573
Add shim for dart:ui (increase pub score)
tneotia May 5, 2021
b643264
Merge branch 'master' of https://github.com/Sub6Resources/flutter_htm…
tneotia May 5, 2021
3313d5a
Merge pull request #657 from tneotia/misc/dart-ui-shim
erickok May 5, 2021
6cc6c37
Merge pull request #603 from vrtdev/feature/200
erickok May 11, 2021
554dc15
Merge pull request #634 from tneotia/feature/more-inline-styles-2
erickok May 12, 2021
6a9fb1a
Make CSS camelCase (Css)
tneotia May 12, 2021
d344b8d
Add a little bit of flair to templates ;)
tneotia May 12, 2021
758867f
Merge pull request #642 from tneotia/misc/issue-templates
erickok May 12, 2021
5de96d7
Merge pull request #655 from tneotia/feature/style-tag-support
erickok May 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add support for HTML <details> and <summary> tags
  • Loading branch information
tneotia committed Jan 20, 2021
commit 97da193d039540bb1bad8ecfc642313b5bee4c4a
22 changes: 1 addition & 21 deletions lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,27 +334,7 @@ class HtmlParser extends StatelessWidget {
}
} else if (tree is InteractableElement) {
return WidgetSpan(
child: RawGestureDetector(
gestures: {
MultipleTapGestureRecognizer: GestureRecognizerFactoryWithHandlers<
MultipleTapGestureRecognizer>(
() => MultipleTapGestureRecognizer(),
(instance) {
instance..onTap = () => onLinkTap?.call(tree.href);
},
),
},
child: StyledText(
textSpan: TextSpan(
style: newContext.style.generateTextStyle(),
children: tree.children
.map((tree) => parseTree(newContext, tree))
.toList() ??
[],
),
style: newContext.style,
),
),
child: tree.toWidget(context),
);
} else if (tree is LayoutElement) {
return WidgetSpan(
Expand Down
2 changes: 2 additions & 0 deletions lib/src/html_elements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ const STYLED_ELEMENTS = [
"p",
"pre",
"section",
"summary",
"ul",
];

const INTERACTABLE_ELEMENTS = [
"a",
"details",
];

const REPLACED_ELEMENTS = [
Expand Down
121 changes: 108 additions & 13 deletions lib/src/interactable_element.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_html/html_parser.dart';
import 'package:flutter_html/src/html_elements.dart';
import 'package:flutter_html/src/utils.dart';
import 'package:flutter_html/style.dart';
import 'package:html/dom.dart' as dom;

/// An [InteractableElement] is a [StyledElement] that takes user gestures (e.g. tap).
class InteractableElement extends StyledElement {
abstract class InteractableElement extends StyledElement {
String href;

InteractableElement({
Expand All @@ -14,30 +16,123 @@ class InteractableElement extends StyledElement {
this.href,
dom.Node node,
}) : super(name: name, children: children, style: style, node: node);

Widget toWidget(RenderContext context);
}

/// A [Gesture] indicates the type of interaction by a user.
enum Gesture {
TAP,
}

class LinkedContentElement extends InteractableElement {
String href;
Style style;

LinkedContentElement({
dom.Node node,
String name,
List<StyledElement> children,
this.href,
this.style,
}) : super(name: name, node: node, children: children);

@override
Widget toWidget(RenderContext context) {
return RawGestureDetector(
gestures: {
MultipleTapGestureRecognizer: GestureRecognizerFactoryWithHandlers<
MultipleTapGestureRecognizer>(
() => MultipleTapGestureRecognizer(),
(instance) {
instance..onTap = () => context.parser.onLinkTap?.call(href);
},
),
},
child: StyledText(
textSpan: TextSpan(
style: style.generateTextStyle(),
children: children
.map((tree) => context.parser.parseTree(context, tree))
.toList() ??
[],
),
style: style,
),
);
}
}

class DetailsContentElement extends InteractableElement {
List<dom.Element> title;

DetailsContentElement({
dom.Node node,
String name,
List<StyledElement> children,
this.title,
}) : super(name: name, node: node, children: children);

@override
Widget toWidget(RenderContext context) {
return ExpansionTile(
title: title.first.localName == "summary" ? StyledText(
textSpan: TextSpan(
style: style.generateTextStyle(),
children: [children
.map((tree) => context.parser.parseTree(context, tree))
.toList().first] ??
[],
),
style: style,
) : Text("Details"),
children: [
StyledText(
textSpan: TextSpan(
style: style.generateTextStyle(),
children: children
.map((tree) => context.parser.parseTree(context, tree))
.toList() ??
[],
),
style: style,
),
]
);
}

}

class EmptyInteractableElement extends InteractableElement {
EmptyInteractableElement({String name = "empty"}) : super(name: name);

@override
Widget toWidget(_) => null;
}

InteractableElement parseInteractableElement(
dom.Element element, List<StyledElement> children) {
InteractableElement interactableElement = InteractableElement(
name: element.localName,
children: children,
node: element,
);

switch (element.localName) {
case "a":
interactableElement.href = element.attributes['href'];
interactableElement.style = Style(
color: Colors.blue,
textDecoration: TextDecoration.underline,
return LinkedContentElement(
node: element,
name: element.localName,
children: children,
href: element.attributes['href'],
style: Style(
color: Colors.blue,
textDecoration: TextDecoration.underline,
)
);
case "details":
return DetailsContentElement(
node: element,
name: element.localName,
children: element.children.first.localName == "summary" ? children : children,
title: element.children
);
break;
default:
return EmptyInteractableElement(name: element.localName);
}

return interactableElement;
}