我们可以设置一个可以在颤动中使用的SpanText吗?

问题描述 投票:0回答:1

      RichText(
        text: TextSpan(
          text: 'NEW USER ?',
          style: TextStyle(color: Colors.grey),
          children: <TextSpan>[
            TextSpan(
              text: '  SIGN UP',
              style: TextStyle(color: Colors.blue),
            )
          ],
        ),
      ),

在这里,我想在点击“注册”时做点什么。

flutter
1个回答
0
投票

TextSpanrecognizer属性来点击给定的小部件。

TextSpan(
         text: '  SIGN UP',
         style: TextStyle(color: Colors.blue),
         )    
recognizer: TapGestureRecognizer()
            ..onTap = () {
            // do something here
    }),
)
© www.soinside.com 2019 - 2024. All rights reserved.