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

Handled relative path in image URLs: #146

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d560278
Handled relative path in image urls:
Aug 23, 2019
2039240
Implement li leading char as TextSpan rather than separate widget
amake Jul 19, 2019
4ee8640
Add shrinkToFit option to shrink Html to its natural content width
amake Jul 19, 2019
ac97ee9
Update test image URL
amake Jul 19, 2019
431a08f
Organize imports
amake Jul 19, 2019
a671d94
Create CONTRIBUTING.md
Sub6Resources Sep 6, 2019
c5278bb
change parse to tryParse in image width. Fixes #118
Sub6Resources Sep 6, 2019
247a8f3
Allow negative numbers to fix #97
Sub6Resources Sep 6, 2019
f1fe495
Fix image alt attribute (fixes #96)
Sub6Resources Sep 9, 2019
f38b56f
Add partial support for sub and remove unused functions
Sub6Resources Sep 10, 2019
059bfe0
Merge branch '0.11.0' into shrink-to-fit
Sub6Resources Sep 10, 2019
52c8927
Merge pull request #148 from amake/shrink-to-fit
Sub6Resources Sep 10, 2019
18950af
Update readme for latest merged pr to show that it fixes #75
Sub6Resources Sep 10, 2019
2e4d2ab
Prepare for release
Sub6Resources Sep 10, 2019
a7aa1fd
Merge pull request #152 from Sub6Resources/0.11.0
Sub6Resources Sep 10, 2019
846ae21
Add golden tests for all supported html elements
Sub6Resources Sep 10, 2019
c28db9f
Add check for flutter version in tests
Sub6Resources Sep 10, 2019
b8644ec
Add screenshot to readme
Sub6Resources Sep 10, 2019
d55aa45
Add check for null onLinkTap callback
Sub6Resources Sep 11, 2019
9892279
Try to fix golden tests
Sub6Resources Sep 13, 2019
213efa0
Check that files are loaded correctly in circleci
Sub6Resources Sep 13, 2019
6854229
Update golden files
Sub6Resources Sep 16, 2019
573705e
- Refactored prefixNetworkImageRelativePath -> prefixImagePath
Sep 18, 2019
fe51711
Handled relative path in image urls:
Aug 23, 2019
2d0bb5e
- Refactored prefixNetworkImageRelativePath -> prefixImagePath
Sep 18, 2019
5ea2907
Merge branch 'master' of https://github.com/arnold-parge/flutter_html
Sep 18, 2019
b0df4a3
fixed space in imageUrl
Sep 18, 2019
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
2 changes: 2 additions & 0 deletions lib/image_properties.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ImageProperties {
final bool matchTextDirection;
final FilterQuality filterQuality;
final double scale;
final String prefixNetworkImageRelativePath;
arnold-parge marked this conversation as resolved.
Show resolved Hide resolved

const ImageProperties({
this.scale = 1,
Expand All @@ -30,5 +31,6 @@ class ImageProperties {
this.centerSlice,
this.matchTextDirection = false,
this.filterQuality = FilterQuality.low,
this.prefixNetworkImageRelativePath = ''
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add an assert to the constructor that ensures that this is never null?

Copy link
Author

Choose a reason for hiding this comment

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

constructor ImageProperties is const, so it cannot have a body.

});
}
8 changes: 8 additions & 0 deletions lib/rich_text_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,14 @@ class HtmlRichTextParser extends StatelessWidget {
},
));
} else {
String imageUrl = '';
if (!node.attributes['src'].contains('http')) {
imageUrl = imageProperties.prefixNetworkImageRelativePath +
arnold-parge marked this conversation as resolved.
Show resolved Hide resolved
node.attributes['src'];
}
else {
imageUrl = node.attributes['src'];
}
precacheImage(
NetworkImage(node.attributes['src']),
buildContext,
Expand Down