Skip to content

Instantly share code, notes, and snippets.

@Devlonoah
Created September 13, 2023 11:35
Show Gist options
  • Save Devlonoah/bca97e052b91e5f91fd8d67d4b3271e7 to your computer and use it in GitHub Desktop.
Save Devlonoah/bca97e052b91e5f91fd8d67d4b3271e7 to your computer and use it in GitHub Desktop.
Gesture on Richtext Flutter
RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Single tap',
style: TextStyle(color: Colors.red[300]),
recognizer: TapGestureRecognizer()..onTap = () {
// Single tapped.
},
),
TextSpan(
text: ' Double tap',
style: TextStyle(color: Colors.green[300]),
recognizer: DoubleTapGestureRecognizer()..onDoubleTap = () {
// Double tapped.
}
),
TextSpan(
text: ' Long press',
style: TextStyle(color: Colors.blue[300]),
recognizer: LongPressGestureRecognizer()..onLongPress = () {
// Long Pressed.
},
),
],
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment