text on click flutter
new GestureDetector(
onTap: () {
Navigator.pushNamed(context, "myRoute");
},
child: new Text("my Title"),
);
text on click flutter
new GestureDetector(
onTap: () {
Navigator.pushNamed(context, "myRoute");
},
child: new Text("my Title"),
);
flutter textspan onclick
import 'package:flutter/gestures.dart';
...
new RichText(
text: new TextSpan(text: 'Non touchable. ', children: [
new TextSpan(
text: 'Tap here.',
recognizer: new TapGestureRecognizer()..onTap = () => print('Tap Here onTap'),
)
]),
);
flutter clickable text
Use RichText with TextSpan and GestureRecognizer. With GestureRecognizer you can detect tap, double tap, long press and etc.
Widget build(BuildContext context) {
TextStyle defaultStyle = TextStyle(color: Colors.grey, fontSize: 20.0);
TextStyle linkStyle = TextStyle(color: Colors.blue);
return RichText(
text: TextSpan(
style: defaultStyle,
children: <TextSpan>[
TextSpan(text: 'By clicking Sign Up, you agree to our '),
TextSpan(
text: 'Terms of Service',
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
print('Terms of Service"');
}),
TextSpan(text: ' and that you have read our '),
TextSpan(
text: 'Privacy Policy',
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
print('Privacy Policy"');
}),
],
),
);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us