File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class Html extends StatelessWidget {
52
52
GlobalKey ? anchorKey,
53
53
required this .data,
54
54
this .onLinkTap,
55
+ this .onAnchorTap,
55
56
this .customRender = const {},
56
57
this .customImageRenders = const {},
57
58
this .onCssParseError,
@@ -72,6 +73,7 @@ class Html extends StatelessWidget {
72
73
GlobalKey ? anchorKey,
73
74
@required this .document,
74
75
this .onLinkTap,
76
+ this .onAnchorTap,
75
77
this .customRender = const {},
76
78
this .customImageRenders = const {},
77
79
this .onCssParseError,
@@ -99,6 +101,10 @@ class Html extends StatelessWidget {
99
101
/// A function that defines what to do when a link is tapped
100
102
final OnTap ? onLinkTap;
101
103
104
+ /// A function that defines what to do when an anchor link is tapped. When this value is set,
105
+ /// the default anchor behaviour is overwritten.
106
+ final OnTap ? onAnchorTap;
107
+
102
108
/// An API that allows you to customize the entire process of image rendering.
103
109
/// See the README for more details.
104
110
final Map <ImageSourceMatcher , ImageRender > customImageRenders;
@@ -154,6 +160,7 @@ class Html extends StatelessWidget {
154
160
key: _anchorKey,
155
161
htmlData: doc,
156
162
onLinkTap: onLinkTap,
163
+ onAnchorTap: onAnchorTap,
157
164
onImageTap: onImageTap,
158
165
onCssParseError: onCssParseError,
159
166
onImageError: onImageError,
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ class HtmlParser extends StatelessWidget {
44
44
final Key ? key;
45
45
final dom.Document htmlData;
46
46
final OnTap ? onLinkTap;
47
+ final OnTap ? onAnchorTap;
47
48
final OnTap ? onImageTap;
48
49
final OnCssParseError ? onCssParseError;
49
50
final ImageErrorListener ? onImageError;
@@ -62,6 +63,7 @@ class HtmlParser extends StatelessWidget {
62
63
required this .key,
63
64
required this .htmlData,
64
65
required this .onLinkTap,
66
+ required this .onAnchorTap,
65
67
required this .onImageTap,
66
68
required this .onCssParseError,
67
69
required this .onImageError,
@@ -73,7 +75,12 @@ class HtmlParser extends StatelessWidget {
73
75
required this .imageRenders,
74
76
required this .tagsList,
75
77
required this .navigationDelegateForIframe,
76
- }): this ._onAnchorTap = key != null ? _handleAnchorTap (key, onLinkTap): null , super (key: key);
78
+ }) : this ._onAnchorTap = onAnchorTap != null
79
+ ? onAnchorTap
80
+ : key != null
81
+ ? _handleAnchorTap (key, onLinkTap)
82
+ : null ,
83
+ super (key: key);
77
84
78
85
@override
79
86
Widget build (BuildContext context) {
You can’t perform that action at this time.
0 commit comments