utils_rinch_text 套件提供了一個實用方法,可使用 TextSpan 格式化長文字,支援自訂標籤以實現豐富文字呈現。它能以內嵌格式顯示結構化文字,非常適合動態內容,例如聊天訊息或格式化說明。此套件相容於所有主要平台,並簡化複雜文字版面的建立,無需手動管理 Span。它利用乾淨的 API 有效解析與渲染標籤文字。
適用情境
聊天訊息格式化
動態內容渲染
UI 元件中的富文字
格式化描述
使用者產生的文本處理
主要特色
支援自定義文字標籤
產生 TextSpan 列表
跨平台相容性
簡單的 API 結合
高效的文字解析
適合對象
需要豐富文字的應用程式
聊天或訊息介面
內容密集型UI
文字格式化工具
尋求簡潔的 Flutter 開發人員
使用建議
需要正確的標籤語法
僅限文字格式化
無內建樣式選項
依賴於正確的輸入結構
不適合複雜的版面
原始 README
以下為關聯原始碼儲存庫的 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
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.
""";