@@ -3,6 +3,7 @@ import 'dart:math';
3
3
4
4
import 'package:csslib/parser.dart' as cssparser;
5
5
import 'package:csslib/visitor.dart' as css;
6
+ import 'package:flutter/gestures.dart' ;
6
7
import 'package:flutter/material.dart' ;
7
8
import 'package:flutter_html/flutter_html.dart' ;
8
9
import 'package:flutter_html/src/css_parser.dart' ;
@@ -335,28 +336,39 @@ class HtmlParser extends StatelessWidget {
335
336
);
336
337
}
337
338
} else if (tree is InteractableElement ) {
338
- return WidgetSpan (
339
- child: RawGestureDetector (
340
- gestures: {
341
- MultipleTapGestureRecognizer : GestureRecognizerFactoryWithHandlers <
342
- MultipleTapGestureRecognizer >(
343
- () => MultipleTapGestureRecognizer (),
344
- (instance) {
345
- instance..onTap = () => onLinkTap? .call (tree.href);
346
- },
347
- ),
348
- },
349
- child: StyledText (
350
- textSpan: TextSpan (
351
- style: newContext.style.generateTextStyle (),
352
- children: tree.children
353
- .map ((tree) => parseTree (newContext, tree))
354
- .toList () ??
355
- [],
356
- ),
357
- style: newContext.style,
358
- ),
359
- ),
339
+ return TextSpan (
340
+ children: tree.children
341
+ .map ((tree) => parseTree (newContext, tree))
342
+ .map ((childSpan) {
343
+ if (childSpan is TextSpan ) {
344
+ return TextSpan (
345
+ text: childSpan.text,
346
+ children: childSpan.children,
347
+ style: (childSpan.style ?? TextStyle ())
348
+ .merge (newContext.style.generateTextStyle ()),
349
+ semanticsLabel: childSpan.semanticsLabel,
350
+ recognizer: TapGestureRecognizer ()
351
+ ..onTap = () => onLinkTap? .call (tree.href),
352
+ );
353
+ } else {
354
+ return WidgetSpan (
355
+ child: RawGestureDetector (
356
+ gestures: {
357
+ MultipleTapGestureRecognizer :
358
+ GestureRecognizerFactoryWithHandlers <
359
+ MultipleTapGestureRecognizer >(
360
+ () => MultipleTapGestureRecognizer (),
361
+ (instance) {
362
+ instance..onTap = () => onLinkTap? .call (tree.href);
363
+ },
364
+ ),
365
+ },
366
+ child: (childSpan as WidgetSpan ).child,
367
+ ),
368
+ );
369
+ }
370
+ }).toList () ??
371
+ [],
360
372
);
361
373
} else if (tree is LayoutElement ) {
362
374
return WidgetSpan (
0 commit comments