@@ -3,6 +3,7 @@ import 'dart:math';
33
44import 'package:csslib/parser.dart' as cssparser;
55import 'package:csslib/visitor.dart' as css;
6+ import 'package:flutter/gestures.dart' ;
67import 'package:flutter/material.dart' ;
78import 'package:flutter_html/flutter_html.dart' ;
89import 'package:flutter_html/src/css_parser.dart' ;
@@ -329,28 +330,42 @@ class HtmlParser extends StatelessWidget {
329330 );
330331 }
331332 } else if (tree is InteractableElement ) {
332- return WidgetSpan (
333- child: RawGestureDetector (
334- gestures: {
335- MultipleTapGestureRecognizer : GestureRecognizerFactoryWithHandlers <
336- MultipleTapGestureRecognizer >(
337- () => MultipleTapGestureRecognizer (),
338- (instance) {
339- instance..onTap = () => onLinkTap? .call (tree.href);
340- },
341- ),
342- },
343- child: StyledText (
344- textSpan: TextSpan (
345- style: newContext.style.generateTextStyle (),
346- children: tree.children
347- .map ((tree) => parseTree (newContext, tree))
348- .toList () ??
349- [],
350- ),
351- style: newContext.style,
352- ),
353- ),
333+ return TextSpan (
334+ style: newContext.style.generateTextStyle (),
335+ children: tree.children
336+ .map ((tree) => parseTree (newContext, tree))
337+ .map ((childSpan) {
338+ if (childSpan is TextSpan ) {
339+ return TextSpan (
340+ text: childSpan.text,
341+ children: childSpan.children,
342+ style: childSpan.style,
343+ semanticsLabel: childSpan.semanticsLabel,
344+ recognizer: TapGestureRecognizer ()
345+ ..onTap = () => onLinkTap? .call (tree.href),
346+ );
347+ } else {
348+ return WidgetSpan (
349+ child: RawGestureDetector (
350+ gestures: {
351+ MultipleTapGestureRecognizer :
352+ GestureRecognizerFactoryWithHandlers <
353+ MultipleTapGestureRecognizer >(
354+ () => MultipleTapGestureRecognizer (),
355+ (instance) {
356+ instance..onTap = () => onLinkTap? .call (tree.href);
357+ },
358+ ),
359+ },
360+ child: StyledText (
361+ style: newContext.style,
362+ textSpan: childSpan,
363+ ),
364+ ),
365+ );
366+ }
367+ }).toList () ??
368+ [],
354369 );
355370 } else if (tree is LayoutElement ) {
356371 return WidgetSpan (
0 commit comments