cristianpaulo4/utils_rinch_text
此方法返回一个适合格式化长文本的 TextSpan 列表。此实现支持以下标签,参见示例。
- Stars
- 2
- Forks
- 0
- 最近推送(UTC)
- 2023年2月4日
- 项目状态
- 未归档
语言C++CMakeDartHTMLCObjective-CJavaShellSwiftKotlin
使用的依赖
依赖清单 4 项
- flutter
{"sdk":"flutter"} - url_launcher
^6.1.8 - flutter_test开发依赖
{"sdk":"flutter"} - flutter_lints开发依赖
^2.0.0
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
展开 / 收起项目 README
This method returns a list of TextSpan ideal for formatting long text this implementation supports the following tags, see example.
<a>Link web<a>
<p> add paragraph
Captura de tela 2023-02-03 195339
Add custom tags
Text de example:
String textExample = """
<i>Flutter<i> is an open source mobile app development framework <l>created by Google.<l>
It enables the creation of native apps for <i>iOS and Android<i> with a single Dart code base.
With its flexible and performant architecture, <o>Flutter has become one of the most
popular options for building mobile apps.<o> In addition, it offers a wide range of widgets
and animated visual effects that help you create attractive and intuitive applications. <p>
For more information about Flutter, head over to the main
page at <a>https://flutter.dev/<a> and start <b>exploring the possibilities<b>
of this powerful app development tool.
""";
Implementation
RichText(
text: TextSpan(
children: UtilsRinchText.generate(
textExample,
customTags: {
"<i>": const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
),
"<l>": const TextStyle(
fontSize: 20,
color: Colors.red,
fontWeight: FontWeight.bold,
),
"<a>": const TextStyle(
color: Colors.green,
fontWeight: FontWeight.bold,
),
"<o>": const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.blue,
fontSize: 20,
),
"<b>": const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.orange,
fontSize: 20,
),
},
),
),
),