我试过这样做,但我需要放一个文本,比如"要执行操作,请单击此处";
TextButton(
onPressed: () {
setState(() {
isVisible = false;
});
},
child: const Text('click here'),
),
使用RichText
。
RichText(
text: TextSpan(children: [
TextSpan(
text: "to do something ",
),
TextSpan(
text: "click here",
style: TextStyle(),
recognizer: TapGestureRecognizer()
..onTap = () {
print("tapped");
}),
])),
确保import 'package:flutter/gestures.dart';