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

套件詳情v1.3.0

rich_text_view

一個簡單但強大的富文本檢視,支援提及、標籤、電子郵件、網址和查看更多。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
4400
喜歡數
65
Pub 分數
140

安裝套件

flutter pub add rich_text_view

套件介紹

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

rich_text_view 是一個 Flutter 套件,提供一種靈活且直覺的方式來顯示具有互動元件的豐富文字,例如提及、標籤、電子郵件、URL 和「查看更多」功能。它透過在單一文字區塊內啟用可點擊和樣式化的元件來增強文字呈現。該套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合需要動態文字內容的跨平台應用程式。透過 pub 命令進行最少設定,開發者可以輕鬆將豐富文字功能整合到他們的應用中。

適用情境

  • 社群媒體貼文渲染
  • 聊天訊息顯示
  • 部落格或文章預覽
  • 使用者產生的內容包含連結
  • 互動評論區

主要特色

  • 支援提及與主題標籤
  • 處理 URL 和電子郵件
  • 包含「查看更多」切換按鈕
  • 可自訂樣式
  • 跨平台相容性
  • 與 Flutter 的輕鬆整合

適合對象

  • 包含使用者產生內容的應用程式
  • 訊息或社交網路應用
  • 內容豐富的使用者介面
  • 動態文字顯示
  • 尋求輕量級富文字解決方案的開發者

使用建議

  • 僅限預定義的連結類型
  • 無內建影像支援
  • 需要手動處理點擊事件
  • 不適用於複雜的富文字編輯
  • 效能可能會隨著極長的文本而有所差異

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

rich_text_view

A simple yet powerful rich text view that supports mention, hashtag, email, url and view more.

Example

RichTextView
 RichTextView(
           text:
                      '''Who else thinks it's thinks it's just cool😎 to mention 
                      @jane when #JaneMustLive is trending without even trying 
                      to send a *bold* email to janedoe@gmail.com and verify the
                       facts talkmore of visiting www.janedoe.com''',
                  maxLines: 3,
                  truncate: true,
                  viewLessText: 'less',
                  linkStyle: TextStyle(color: Colors.blue),
                  supportedTypes: [
                    EmailParser(
                        onTap: (email) => print('${email.value} clicked')),
                    PhoneParser(
                        onTap: (phone) => print('click phone ${phone.value}')),
                    MentionParser(
                        onTap: (mention) => print('${mention.value} clicked')),
                    UrlParser(onTap: (url) => print('visting ${url.value}?')),
                    BoldParser(),
                    HashTagParser(
                        onTap: (hashtag) =>
                            print('is ${hashtag.value} trending?'))
                  ]
                )
RichTextEditor

RichTextEditor is an input field that supports suggestions when mentioning or using hashtags


        RichTextEditor(
                      decoration: InputDecoration(
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(16)),
                      ),
                      suggestionController: SuggestionController(
                      mentionSymbol: '/',
                      position: SuggestionPosition.bottom,
                      mentionSuggestions: [
                        Mention(
                            imageURL: 'imageURL',
                            subtitle: 'nelly',
                            title: 'Nelly Gane'),
                        Mention(
                            imageURL: 'imageURL',
                            subtitle: 'gaus',
                            title: 'Gaus Shell')
                      ],
                      onSearchMention: (term) async {
                        return List.generate(
                            20,
                            (index) => Mention(
                                id: index.toString(),
                                imageURL: 'imageURL',
                                subtitle: term.toLowerCase(),
                                title: '$term $index'));
                      },
                      onMentionSelected: (suggestion) {
                        print(suggestion.id);
                      },
                      onSearchTags: (term) async {
                        return [
                          HashTag(
                              hashtag: '#Dart',
                              subtitle: '30 posts',
                              trending: true),
                          HashTag(
                            hashtag: '#Flutter',
                            subtitle: '56 posts',
                          )
                        ];
                      },
                    ))
Todo
  • Add styles to mentions/hashtags in RichTextEditor

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。