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

numberpicker 封面
套件詳情v2.1.2

numberpicker

NumberPicker 是一個允許使用者透過滾動旋鈕來選擇數字的組件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
14.8萬
喜歡數
688
Pub 分數
160

安裝套件

flutter pub add numberpicker

套件介紹

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

NumberPicker 是一個 Flutter 小部件,允許使用者透過可滾動的旋鈕選擇數字,提供直覺且互動性強的方式來輸入數值。它支援平滑滾動、可自訂範圍、步進增量和格式化選項。此小部件專為跨平台使用而設計,在 Android、iOS、Web、macOS、Windows 和 Linux 上皆可順暢運作。此小部件非常適合需要精確數字輸入的表單,例如年齡、數量或設定調整。

適用情境

  • 帶有數值的表單輸入
  • 調整音量或速度等設定
  • 購物車中的數量選擇
  • 年齡或出生日期輸入
  • UI 中可自定義的數字範圍

主要特色

  • 可捲動的旋轉器介面
  • 可設定的最小/最大值
  • 步驟增量控制
  • 自定格式化支援
  • 跨平台相容性
  • 滾動時的平滑動畫

適合對象

  • 開發基於表單應用程式的開發者
  • 需要互動式數字輸入的UI設計師
  • 需要精確數值選擇的應用
  • 跨平台應用程式,針對多種裝置

使用建議

  • 可能需要額外的樣式才能實現自訂外觀
  • 內建驗證功能有限,僅限於範圍邊界
  • 使用非常大的數字範圍時的性能影響
  • 不適用於非數值資料類型

原始 README

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

NumberPicker Build Status Coverage Status

NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.

ezgif com-gif-maker

Example:

(See example for more)

class _IntegerExample extends StatefulWidget {
  @override
  __IntegerExampleState createState() => __IntegerExampleState();
}

class __IntegerExampleState extends State<_IntegerExample> {
  int _currentValue = 3;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        NumberPicker(
          value: _currentValue,
          minValue: 0,
          maxValue: 100,
          onChanged: (value) => setState(() => _currentValue = value),
        ),
        Text('Current value: $_currentValue'),
      ],
    );
  }
}

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案