@@ -12,7 +12,7 @@ typedef CustomTextStyle = TextStyle Function(
12
12
);
13
13
typedef CustomEdgeInsets = EdgeInsets Function (dom.Node node);
14
14
typedef OnLinkTap = void Function (String url);
15
- typedef OnImageTap = void Function ();
15
+ typedef OnImageTap = void Function (String source );
16
16
17
17
const OFFSET_TAGS_FONT_SIZE_FACTOR =
18
18
0.7 ; //The ratio of the parent font for each of the offset tags: sup or sub
@@ -733,23 +733,20 @@ class HtmlRichTextParser extends StatelessWidget {
733
733
? double .parse (node.attributes['height' ])
734
734
: null ),
735
735
scale: imageProperties? .scale ?? 1.0 ,
736
- matchTextDirection:
737
- imageProperties? .matchTextDirection ?? false ,
736
+ matchTextDirection: imageProperties? .matchTextDirection ?? false ,
738
737
centerSlice: imageProperties? .centerSlice,
739
- filterQuality:
740
- imageProperties? .filterQuality ?? FilterQuality .low,
738
+ filterQuality: imageProperties? .filterQuality ?? FilterQuality .low,
741
739
alignment: imageProperties? .alignment ?? Alignment .center,
742
740
colorBlendMode: imageProperties? .colorBlendMode,
743
741
fit: imageProperties? .fit,
744
742
color: imageProperties? .color,
745
743
repeat: imageProperties? .repeat ?? ImageRepeat .noRepeat,
746
744
semanticLabel: imageProperties? .semanticLabel,
747
- excludeFromSemantics:
748
- (imageProperties? .semanticLabel == null )
749
- ? true
750
- : false ,
745
+ excludeFromSemantics: (imageProperties? .semanticLabel == null ) ? true : false ,
751
746
),
752
- onTap: onImageTap,
747
+ onTap: () {
748
+ onImageTap (node.attributes['src' ]);
749
+ },
753
750
));
754
751
} else {
755
752
precacheImage (
@@ -769,29 +766,25 @@ class HtmlRichTextParser extends StatelessWidget {
769
766
? double .parse (node.attributes['height' ])
770
767
: null ),
771
768
scale: imageProperties? .scale ?? 1.0 ,
772
- matchTextDirection:
773
- imageProperties? .matchTextDirection ?? false ,
769
+ matchTextDirection: imageProperties? .matchTextDirection ?? false ,
774
770
centerSlice: imageProperties? .centerSlice,
775
- filterQuality:
776
- imageProperties? .filterQuality ?? FilterQuality .low,
771
+ filterQuality: imageProperties? .filterQuality ?? FilterQuality .low,
777
772
alignment: imageProperties? .alignment ?? Alignment .center,
778
773
colorBlendMode: imageProperties? .colorBlendMode,
779
774
fit: imageProperties? .fit,
780
775
color: imageProperties? .color,
781
776
repeat: imageProperties? .repeat ?? ImageRepeat .noRepeat,
782
777
semanticLabel: imageProperties? .semanticLabel,
783
- excludeFromSemantics:
784
- (imageProperties? .semanticLabel == null )
785
- ? true
786
- : false ,
778
+ excludeFromSemantics: (imageProperties? .semanticLabel == null ) ? true : false ,
787
779
),
788
- onTap: onImageTap,
780
+ onTap: () {
781
+ onImageTap (node.attributes['src' ]);
782
+ },
789
783
));
790
784
}
791
785
if (node.attributes['alt' ] != null ) {
792
786
parseContext.rootWidgetList.add (BlockText (
793
- margin:
794
- EdgeInsets .symmetric (horizontal: 0.0 , vertical: 10.0 ),
787
+ margin: EdgeInsets .symmetric (horizontal: 0.0 , vertical: 10.0 ),
795
788
padding: EdgeInsets .all (0.0 ),
796
789
child: RichText (
797
790
textAlign: TextAlign .center,
0 commit comments