mirror of https://github.com/flutter/pinball.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
470 B
18 lines
470 B
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
bool tapTextSpan(RichText richText, String text) {
|
|
final isTapped = !richText.text.visitChildren(
|
|
(visitor) => _findTextAndTap(visitor, text),
|
|
);
|
|
return isTapped;
|
|
}
|
|
|
|
bool _findTextAndTap(InlineSpan visitor, String text) {
|
|
if (visitor is TextSpan && visitor.text == text) {
|
|
(visitor.recognizer as TapGestureRecognizer?)?.onTap?.call();
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|