TextSpan关键属性recognizer。
示例如下:
Text.rich(
TextSpan(
style: TextStyle(fontSize: setFont(20)),
children: [
TextSpan(
text: '为保障您的个人隐私权益,请在登录前仔细阅读',
style: TextStyle(color: Color(0xff999999))
),
TextSpan(
text: ' xxx隐私政策 ',
recognizer: new TapGestureRecognizer()..onTap = () => {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return WebViewBox(url: 'https://xxx.com/html/agreement/privacy.html');
}))
},
style: TextStyle(color: Color(0xff586FA2))
),
TextSpan(
text: '以及',
style: TextStyle(color: Color(0xff999999))
),
TextSpan(
text: 'xxx用户服务协议',
recognizer: new TapGestureRecognizer()..onTap = () => {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return WebViewBox(url: 'https://xxx.com/html/agreement/eula.html');
}))
},
style: TextStyle(color: Color(0xff586FA2))
),
]
),
textAlign: TextAlign.center,
)