TextSpan关键属性recognizer。

    示例如下:

    1. Text.rich(
    2. TextSpan(
    3. style: TextStyle(fontSize: setFont(20)),
    4. children: [
    5. TextSpan(
    6. text: '为保障您的个人隐私权益,请在登录前仔细阅读',
    7. style: TextStyle(color: Color(0xff999999))
    8. ),
    9. TextSpan(
    10. text: ' xxx隐私政策 ',
    11. recognizer: new TapGestureRecognizer()..onTap = () => {
    12. Navigator.of(context).push(MaterialPageRoute(builder: (context) {
    13. return WebViewBox(url: 'https://xxx.com/html/agreement/privacy.html');
    14. }))
    15. },
    16. style: TextStyle(color: Color(0xff586FA2))
    17. ),
    18. TextSpan(
    19. text: '以及',
    20. style: TextStyle(color: Color(0xff999999))
    21. ),
    22. TextSpan(
    23. text: 'xxx用户服务协议',
    24. recognizer: new TapGestureRecognizer()..onTap = () => {
    25. Navigator.of(context).push(MaterialPageRoute(builder: (context) {
    26. return WebViewBox(url: 'https://xxx.com/html/agreement/eula.html');
    27. }))
    28. },
    29. style: TextStyle(color: Color(0xff586FA2))
    30. ),
    31. ]
    32. ),
    33. textAlign: TextAlign.center,
    34. )