パッケージ、リポジトリ、アプリカテゴリを検索

rich_readmore のカバー
パッケージ詳細v1.1.1

rich_readmore

指定された設定に基づいて、より多くまたはより少ない表示を可能にするテキストを表示するウィジェットです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
1070
いいね数
45
Pub ポイント
160

パッケージをインストール

flutter pub add rich_readmore

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

RichReadMore は、スマートな「もっと表示」または「少なく表示」の切り替え機能を備えた Flutter ウィジェットです。豊富なテキストフォーマットをサポートし、コンテンツの長さやユーザーの好みに応じて動的に調整されます。長めのテキストスニペットを洗練されたインタラクティブな方法で表示するのに最適で、UI を圧迫せずに読みやすさを向上させます。カスタマイズ可能で、モバイル、Web、デスクトップを含むすべての主要プラットフォームで動作します。

用途

  • アプリで長文コンテンツを表示する
  • 折りたたみ可能なテキストによるユーザーエクスペリエンスの向上
  • 展開可能な詳細を含む説明を表示
  • インタラクティブなコントロールとリッチテキストの統合
  • リストアイテム内の画面の雑多さを減らす

主な機能

  • 豊富なテキスト形式をサポート
  • 動的な「もっと表示/非表示」切り替え
  • カスタマイズ可能な省略記号とボタンラベル
  • クロスプラットフォーム互換性
  • pub を通じた簡単な統合
  • 設定可能な行数制限

適している対象

  • コンテンツ重視のアプリケーション
  • 変動するテキスト長を持つユーザーインターフェース
  • 応答性のあるテキスト表示を必要とするアプリ
  • 軽量なテキスト拡張を求める開発者
  • 複数プラットフォーム間で一貫したUXを必要とするプロジェクト

注意事項

  • 複雑なレイアウトには注意深くスタイル設定が必要になる場合があります
  • 非常に大きなテキストを使用した際のパフォーマンスへの影響
  • テキストのみのコンテンツに制限(画像なし)
  • 親ウィジェットの制約に依存します
  • テキスト以外のコンテンツには適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

rich_readmore workflow codecov MIT License

rich_readmore

A widget that displays text with an option to show more or show less based on the provided settings.
The RichReadMoreText widget allows you to trim text either based on the character length or the number of lines.
When the text is longer than the specified trim length or exceeds the maximum number of lines, it provides a toggle option to show more or show less of the text.
It has two options for settings, the LineModeSettings or LengthModeSettings for trimming using the behavior that you want.
If you want to pass a string directly instead of a TextSpan, you can just be using the the RichReadMoreText.fromString(...). There are some examples for that below.

Demonstration

How to use

import:

import 'package:rich_readmore/rich_readmore.dart';

For TextSpan data:

 RichReadMoreText(
   textSpan,
   settings: LineModeSettings(
     trimLines: 3,
     trimCollapsedText: 'Expand',
     trimExpandedText: ' Collapse ',
     onPressReadMore: () {
       /// specific method to be called on press to show more
     },
     onPressReadLess: () {
       /// specific method to be called on press to show less
     },
   ),
 ),

Or for String data:

 RichReadMoreText.fromString(
   text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
   textStyle: TextStyle(color: Colors.purpleAccent),
   settings: LengthModeSettings(
     trimLength: 20,
     trimCollapsedText: 'Expand',
     trimExpandedText: ' Collapse ',
     onPressReadMore: () {
       /// specific method to be called on press to show more
     },
     onPressReadLess: () {
       /// specific method to be called on press to show less
     },
     lessStyle: TextStyle(color: Colors.blue),
     moreStyle: TextStyle(color: Colors.blue),
   ),
 ),

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。