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

expand_widget 封面
套件詳情v3.1.1

expand_widget

輕鬆展開和收起小部件集合或文字的能力

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5670
喜歡數
147
Pub 分數
150

安裝套件

flutter pub add expand_widget

套件介紹

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

expand_widget 套件提供了一種簡單直覺的方式來動畫化小部件或文字內容的展開與收縮。它能實現摺疊與展開狀態之間的平滑過渡,非常適合建立互動式 UI 元件,例如摺疊式面板或可摺疊區塊。此套件以易用性為設計核心,可無縫整合至跨多個平台的 Flutter 應用程式中。該套件支援自訂動畫、持續時間控制以及彈性內容佈局,適用於小型元件與複雜的 UI 結構。

適用情境

  • 建立可摺疊的折疊面板
  • 建構互動式常見問題區塊
  • 列表中動畫顯示內容
  • 設計響應式卡片介面
  • 實現動態表單部分

主要特色

  • 流暢的展開/收起動畫
  • 可自訂的動畫持續時間
  • 支援任何小工具作為內容
  • 與現有佈局的輕鬆整合
  • 靈活的觸發機制

適合對象

  • 尋求簡單擴展控制項的開發者
  • UI 設計師建構互動式卡片
  • 需要動態內容切換的應用程式
  • 跨平台 Flutter 應用
  • 具有摺疊式介面的專案

使用建議

  • 可能影響大型組件樹的效能
  • 需要仔細處理狀態管理
  • 動畫行為取決於父佈局約束
  • 未針對極高頻率的切換進行優化
  • 與輕量級內容搭配使用,以獲得最佳回應速度

原始 README

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

Expand Widget

Package style: very good analysis Build Patreon License

This Dart package offers developers a streamlined library of Flutter widgets, useful for expanding widgets and text views, when users interact with them.

There are two main 'expand' widgets:

  • Expand Child: Useful to show more widgets related to the content already visible by the user.
  • Expand Text: Useful when texts can be quite big for a certain screen. It adds the ability to show the full content when the user wants to.

Features

  • The ExpandIndicatorStyle parameter allows you to select various render options, related to the expand arrow itself.

  • Hide the arrow widget when the view is being expanded, using the hideIndicatorOnExpand parameter.

  • Custimze the arrow widget itself: color, size, padding, icon...

  • You can also provide your own widget for the expand indicator, using the indicatorBuilder for both expaning widgets.

  • Use custom expanding hint strings! By default, it will use the ones provided by MaterialLocalizations.

  • Expand text view with swipe-down gestures, using the expandOnGesture, which by default is set to false.

  • You can also customize expand animation duration and curve easilly.

  • The collapsedVisibilityFactor (exclusive to the ExpandChild widget), allows the reveal of a section of the hidden content.

Example

Here is an example of a simple use of this package, featuring the ExpandChild & ExpandText widgets.

If you want to take a deeper look at the example, take a look at the example folder provided with the project.

  • ExpandChild
ExpandChild(
  child: Column(
    children: [
      OutlineButton(
        child: Text('Button1'),
        onPressed: () => print('Pressed button1'),
      ),
      OutlineButton(
        child: Text('Button2'),
        onPressed: () => print('Pressed button2'),
      ),
      OutlineButton(
        child: Text('Button3'),
        onPressed: () => print('Pressed button3'),
      ),
    ],
  ),
),
  • ExpandText
ExpandText(
  'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
  textAlign: TextAlign.justify,
),

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Built with

Authors

License

This project is licensed under the GNU GPL v3 License - see the LICENSE file for details.

所屬分類

原始碼儲存庫

使用此套件的專案