搜尋套件、儲存庫與 APP 分類

utils_rinch_text 封面
套件詳情v1.0.3

utils_rinch_text

此方法會返回一個適合格式化長文本的 TextSpan 列表。此實作支援下列標籤,請參見範例。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
19
喜歡數
9
Pub 分數
160

安裝套件

flutter pub add utils_rinch_text

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

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

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,
         ),
       },
     ),
   ),
 ), 

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。