文本可滑动,用singleChildScrollView包裹一个Text即可,下面是可滑动,并且有点击事件的文本示例。scrollDirection是滑动方向

SingleChildScrollView(
                    scrollDirection: Axis.vertical,
                    child: Text.rich(
                      TextSpan(
                        children: [
                          TextSpan(
                            text: '欢迎使用这个软件,我们将通过',
                            style: TextStyle(
                              fontSize: 14,
                              color: ColorUtil.text_normal,
                            ),
                          ),
                          TextSpan(
                            text: '《用户协议》',
                            style: TextStyle(
                              fontSize: 14,
                              color: Colors.blue,
                            ),
                            recognizer: TapGestureRecognizer()
                              ..onTap = () =>
                                  {Fluttertoast.showToast(msg: '点击了隐私协议。。')},
                          ),
                          TextSpan(
                            text: '及',
                            style: TextStyle(
                              fontSize: 14,
                              color: ColorUtil.text_normal,
                            ),
                          ),
                          TextSpan(
                            text: '《隐私政策》',
                            style: TextStyle(
                              fontSize: 14,
                              color: Colors.blue,
                            ),
                            recognizer: TapGestureRecognizer()
                              ..onTap = () =>
                                  {Fluttertoast.showToast(msg: '点击了用户。。')},
                          ),
                          TextSpan(
                            text:
                                '本网站及相应客户端、自媒体平台、其他主运营网站等(以下统称“CSDN”)是中国知名的IT技术社区,面向IT专业技术人员,提供专业化、集成化的服务。',
                            style: TextStyle(
                              fontSize: 14,
                              color: ColorUtil.text_normal,
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐