zoukankan      html  css  js  c++  java
  • flutter richText富文本

    flutter中富文本使用

    RichText(
                  text: TextSpan(
                    text: '登陆即同意',
                    style: TextStyle(fontSize: 14, color: Colors.black),
                    children: [
                      TextSpan(
                        text: '"服务条款"',
                        style: TextStyle(fontSize: 14, color: Colors.blue),
                        recognizer: TapGestureRecognizer()
                          ..onTap = () {
                            print('点击了服务条款');
                          },
                      ),
                      TextSpan(
                        text: '和',
                        style: TextStyle(fontSize: 14, color: Colors.black),
                      ),
                      TextSpan(
                        text: '"隐私政策"',
                        style: TextStyle(fontSize: 14, color: Colors.blue),
                        recognizer: TapGestureRecognizer()
                          ..onTap = () {
                            print('点击了隐私政策');
                          },
                      ),
                      WidgetSpan(
                        alignment: PlaceholderAlignment.middle,
                        child: Image.asset(
                          'assets/noavatar.png',
                           20,
                          height: 20,
                        ),
                      ),
                    ],
                  ),
                ),
    

    TextSpan可以用来显示文字类型,设置文字颜色,点击事件等

       TextSpan(
                        text: '"隐私政策"',
                        style: TextStyle(fontSize: 14, color: Colors.blue),
                        recognizer: TapGestureRecognizer()
                          ..onTap = () {
                            print('点击了隐私政策');
                          },
                      ),
    

    WidgetSpan 可以用来显示任意widget,图片按钮等等

                      WidgetSpan(
                        alignment: PlaceholderAlignment.middle,
                        child: Image.asset(
                          'assets/noavatar.png',
                           20,
                          height: 20,
                        ),
                      ),
    
  • 相关阅读:
    机器学习算法
    消息队列
    net core 静态文件
    Startup 和 Middleware(中间件)
    HLS 协议
    Web APIs 基于令牌TOKEN验证的实现
    cyq.data开源
    FluentConsole是一个托管在github的C#开源组件
    数据层全栈式编程架构
    Java NIO 完全学习笔记(转)
  • 原文地址:https://www.cnblogs.com/qqcc1388/p/11757117.html
Copyright © 2011-2022 走看看