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

套件詳情v1.0.0

measured_size

一個在執行時計算其子項大小的 Flutter 小部件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1120
喜歡數
40
Pub 分數
140

安裝套件

flutter pub add measured_size

套件介紹

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

measured_size 套件是一個 Flutter 小工具,可動態計算並在執行階段公開其子小工具的大小。它包裝一個子小工具,並提供其實際渲染的尺寸,這對於根據即時測量進行佈局調整非常有用。當建立需要精確尺寸的響應式或自適應 UI 時,這特別有幫助。此套件可在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上運作。

適用情境

  • 響應式版面配置
  • 動態UI尺寸
  • 佈局除錯
  • 自適應設計
  • 執行時期維度追蹤

主要特色

  • 即時尺寸測量
  • 跨平台支援
  • 簡單 API
  • 子組件包裝
  • 尺寸回調

適合對象

  • 需要動態佈局邏輯的開發人員
  • 需要精確尺寸的UI建構工具
  • 除錯佈局問題
  • 自定義小部件創建

使用建議

  • 若過度使用,可能會影響效能
  • 需要在 widget 樹中謹慎放置
  • 不適用於靜態佈局
  • 僅限測量直接子項大小
  • 佈局重建的潛在風險

原始 README

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

measured_size

A flutter widget that calculates the size of it's child in runtime.

Getting Started

MeasuredSize Calculated the size of it's child in runtime. All you have to do is to wrap your widget with MeasuredSize and listen to size changes.

Usage

Complete example

MeasuredSize(
              onChange: (Size size) {
                setState(() {
                  print(size);
                });
              },
              child: Text(
                '$_counter',
                style: Theme.of(context).textTheme.headline4,
              ),
            );

onChange will be called when the [Size] changes.

onChange will return the value ONLY once if it didn't change, and it will NOT return a value if it's equals to Size.zero

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。