lavie_rich_text 0.0.3 copy "lavie_rich_text: ^0.0.3" to clipboard
lavie_rich_text: ^0.0.3 copied to clipboard

outdated

CHANGELOG最新版本放在最上面;完善README文档;编写部分示例代码

富文本展示组件,支持各种文字富文本,不支持图片。

使用LVRichText,你不需要去手动拆分字符串。一开始你就可以输入完整字符串,然后哪些子字符串需要设置成富文本就单独设置这些子字符串即可。

LVRichTextConfig类定义了你想格式化的字符串以及配置信息

一定要注意,LVRichTextConfig类中的targetString既可以是单个字符串String,也可以是一个字符串数组List

该组件内部集成了第三方插件【url_launcher】

Features #

TODO: List what your package can do. Maybe include images, gifs, or videos.

Getting started #

TODO: List prerequisites and provide or point to information on how to start using the package.

Usage #

       LVRichText(
          "啦啦啦蓝色加粗italic上标下标蓝色红色1红色12红色123红色红色green哈啊哈Green邮箱1145599720@qq.com电话+86 18868876045网址http://www.baidu.com",
          // 设置文本的默认展示样式
          defaultTextStyle: TextStyle(
            color: Colors.orange,
          ),
          // 不区分大小写
          caseSensitive: false,
          // 可以长按选中
          selectable: true,
          configList: [
            LVRichTextConfig(
              targetString: "蓝色",
              // 设置目标字符串的前后字符串,以限制匹配到指定的字符串
              stringBeforeTarget: "啦啦啦",
              stringAfterTarget: "加粗",
              style: const TextStyle(
                color: Colors.blue,
              ),
            ),
            LVRichTextConfig(
              targetString: "加粗",
              style: const TextStyle(
                fontWeight: FontWeight.bold,
              ),
            ),
            LVRichTextConfig(
              targetString: "italic",
              style: const TextStyle(
                fontStyle: FontStyle.italic,
              ),
            ),
            LVRichTextConfig(
              targetString: "上标",
              superScript: true,
            ),
            LVRichTextConfig(
              targetString: "下标",
              subScript: true,
            ),
            LVRichTextConfig(
              targetString: "红色",
              // 只修改匹配到的指定位置的字符串
              matchOption: LVRichTextMatchOption.specifiedIndexs,
              matchSpecifiedIndexs: [3, 4],
              style: const TextStyle(
                color: Colors.red,
              ),
            ),
            LVRichTextConfig(
              targetString: "green",
              style: const TextStyle(
                color: Colors.green,
              ),
            ),
            LVRichTextConfig(
              // 根据正则表达式去匹配字符串
              targetString: "[0-9]*",
              style: const TextStyle(
                fontWeight: FontWeight.bold,
                fontSize: 30,
              ),
            ),
            LVRichTextConfig(
              targetString: "1145599720@qq.com",
              urlType: LVRichTextUrlType.email,
              style: const TextStyle(
                decoration: TextDecoration.underline,
              ),
            ),
            // LVRichTextConfig(
            //   targetString: "+86 18868876045",
            //   urlType: LVRichTextUrlType.telephone,
            //   style: const TextStyle(
            //     decoration: TextDecoration.underline,
            //   ),
            // ),
            LVRichTextConfig(
              targetString: "http://www.baidu.com",
              urlType: LVRichTextUrlType.website,
              style: const TextStyle(
                decoration: TextDecoration.underline,
                decorationColor: Colors.black,
              ),
            ),
          ],
        )

Additional information #

TODO: Tell users more about the package: where to find more information, how to contribute to the package, how to file issues, what response they can expect from the package authors, and more.

1
likes
0
pub points
33%
popularity

Publisher

unverified uploader

CHANGELOG最新版本放在最上面;完善README文档;编写部分示例代码

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, url_launcher

More

Packages that depend on lavie_rich_text