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

onImageTap change to use String source param #93

Merged
merged 3 commits into from
Jun 20, 2019
Merged
Changes from 1 commit
Commits
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
35 changes: 14 additions & 21 deletions lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef CustomTextStyle = TextStyle Function(
);
typedef CustomEdgeInsets = EdgeInsets Function(dom.Node node);
typedef OnLinkTap = void Function(String url);
typedef OnImageTap = void Function();
typedef OnImageTap = void Function(String source);

const OFFSET_TAGS_FONT_SIZE_FACTOR =
0.7; //The ratio of the parent font for each of the offset tags: sup or sub
Expand Down Expand Up @@ -733,23 +733,20 @@ class HtmlRichTextParser extends StatelessWidget {
? double.parse(node.attributes['height'])
: null),
scale: imageProperties?.scale ?? 1.0,
matchTextDirection:
Sub6Resources marked this conversation as resolved.
Show resolved Hide resolved
imageProperties?.matchTextDirection ?? false,
matchTextDirection: imageProperties?.matchTextDirection ?? false,
centerSlice: imageProperties?.centerSlice,
filterQuality:
imageProperties?.filterQuality ?? FilterQuality.low,
filterQuality: imageProperties?.filterQuality ?? FilterQuality.low,
alignment: imageProperties?.alignment ?? Alignment.center,
colorBlendMode: imageProperties?.colorBlendMode,
fit: imageProperties?.fit,
color: imageProperties?.color,
repeat: imageProperties?.repeat ?? ImageRepeat.noRepeat,
semanticLabel: imageProperties?.semanticLabel,
excludeFromSemantics:
(imageProperties?.semanticLabel == null)
? true
: false,
excludeFromSemantics: (imageProperties?.semanticLabel == null) ? true : false,
),
onTap: onImageTap,
onTap: () {
onImageTap(node.attributes['src']);
},
));
} else {
precacheImage(
Expand All @@ -769,29 +766,25 @@ class HtmlRichTextParser extends StatelessWidget {
? double.parse(node.attributes['height'])
: null),
scale: imageProperties?.scale ?? 1.0,
matchTextDirection:
imageProperties?.matchTextDirection ?? false,
matchTextDirection: imageProperties?.matchTextDirection ?? false,
centerSlice: imageProperties?.centerSlice,
filterQuality:
imageProperties?.filterQuality ?? FilterQuality.low,
filterQuality: imageProperties?.filterQuality ?? FilterQuality.low,
alignment: imageProperties?.alignment ?? Alignment.center,
colorBlendMode: imageProperties?.colorBlendMode,
fit: imageProperties?.fit,
color: imageProperties?.color,
repeat: imageProperties?.repeat ?? ImageRepeat.noRepeat,
semanticLabel: imageProperties?.semanticLabel,
excludeFromSemantics:
(imageProperties?.semanticLabel == null)
? true
: false,
excludeFromSemantics: (imageProperties?.semanticLabel == null) ? true : false,
),
onTap: onImageTap,
onTap: () {
onImageTap(node.attributes['src']);
},
));
}
if (node.attributes['alt'] != null) {
parseContext.rootWidgetList.add(BlockText(
margin:
EdgeInsets.symmetric(horizontal: 0.0, vertical: 10.0),
margin: EdgeInsets.symmetric(horizontal: 0.0, vertical: 10.0),
padding: EdgeInsets.all(0.0),
child: RichText(
textAlign: TextAlign.center,
Expand Down