fix: reenable token clicking after adding linkify spans (#1711)

pull/1593/head
ggurdin 9 months ago committed by GitHub
parent 0cce17d27b
commit 76a465f14f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,3 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
@ -222,11 +221,15 @@ class MessageTextWidget extends StatelessWidget {
), ),
); );
} }
return LinkifySpan( return WidgetSpan(
mouseCursor: SystemMouseCursors.click, child: MouseRegion(
recognizer: TapGestureRecognizer() cursor: SystemMouseCursors.click,
..onTap = child: GestureDetector(
onClick != null ? () => onClick?.call(tokenPosition) : null, onTap: onClick != null
? () => onClick?.call(tokenPosition)
: null,
child: RichText(
text: LinkifySpan(
text: substring, text: substring,
style: style.merge( style: style.merge(
TextStyle( TextStyle(
@ -237,7 +240,12 @@ class MessageTextWidget extends StatelessWidget {
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(), onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),
),
),
),
); );
} else { } else {
if ((i > 0 || i < tokenPositions.length - 1) && if ((i > 0 || i < tokenPositions.length - 1) &&

Loading…
Cancel
Save