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

color_picker_field 封面
套件詳情v2.1.0

color_picker_field

適用於 Material 和 Cupertino 的顏色選擇器欄位,包含基於色相的圓形顏色選擇器

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
199
喜歡數
16
Pub 分數
150

安裝套件

flutter pub add color_picker_field

套件介紹

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

一個 Flutter 套件,為 Material 和 Cupertino 設計提供可自訂的顏色選擇欄位,具備基於色相的圓形顏色選擇器,方便直覺地選取顏色。支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。此組件可無縫整合至表單中,並讓使用者透過圓形色相輪與飽和度/亮度滑桿精確選取顏色。非常適合需要在 UI 自訂或設計工具中動態輸入顏色的應用程式。

適用情境

  • 表單輸入項需要顏色選擇
  • UI 主題自定義
  • 設計工具介面
  • 配色方案建立
  • 行動和網頁應用樣式
  • 儀表板中的互動式顏色選擇器

主要特色

  • 徑向色相色彩選擇器
  • 材料和Cupertino相容性
  • 跨平台支援
  • 可自定義的 UI 組件
  • 與表單欄位的整合
  • 即時顏色預覽

適合對象

  • 應用開發者建構設計工具
  • UI/UX 設計師實現顏色選擇器
  • 需要動態主題選項的應用程式
  • 表單密集型應用中的顏色輸入
  • 跨平台移動和網頁應用

使用建議

  • 可能需要為複雜主題添加額外的樣式
  • 大量實例帶來的效能影響
  • 僅限基本顏色選擇(不支援進階顏色模型)
  • 不適合高精度色彩工作流程
  • 依賴外部依賴管理

原始 README

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

Color Picker Field

Pub

Color Picker field for Material and Cupertino, including a Radial Color picker(Hue based)

Material

Material Fields Color wheel Remove colors Saturation and Lightness

Cupertino

Cupertino Fields Color wheel Remove colors Saturation and Lightness

Usage

Just the ColorPickerField without a Form with a controller set
final ColorPickerFieldController controller = ColorPickerFieldController();
ColorPickerField(
  colors: [],
  defaultColor: Colors.blue,
  onChanged: (Color value) {},
  controller: controller,
  decoration: InputDecoration(
    labelText: 'Colors',
  ),
),
ColorPickerFieldFor with a validator, decoration and an onChange callback
ColorPickerFormField(
  initialValue: [],
  defaultColor: Colors.blue,
  autovalidateMode: AutovalidateMode.onUserInteraction,
  maxColors: 3,
  decoration: InputDecoration(
    labelText: 'Colors',
    helperText: 'test',
  ),
  validator: (List<Color>? value) {
    if (value!.isEmpty) {
      return 'a minimum of 1 color is required';
    }
    return null;
  },
  onChanged: (Color value) {},
),
Just a CupertinoColorPickerField without a Form
CupertinoColorPickerField(
  placeholder: 'CupertinoColorPickerField',
  colors: [],
  defaultColor: Colors.blue,
  onChanged: (Color value) {},
  clearButtonMode: ClearButtonVisibilityMode.always,
),
A CupertinoColorPickerField inside a CupertinoFormSection using CupertinoColorPickerFormFieldRow
CupertinoFormSection.insetGrouped(
  header: const Text('Section 1'),
  children: [
    // A field with an always showing clear button
    CupertinoColorPickerFormFieldRow(
      prefix: const Text('Enter Color'),
      defaultColor: defaultColor,
      clearButtonMode: ClearButtonVisibilityMode.always,
      placeholder: 'Enter Color',
      onChanged: _onChanged,
      validator: (List<Color>? value) {
        if (value == null || value.isEmpty) {
          return 'Please enter at least one color';
        }
        return null;
      },
    ),
    
    // A field with a reversed position and order of the chosen colors list
    CupertinoColorPickerFormFieldRow(
      prefix: const Text('Enter Color'),
      defaultColor: defaultColor,
      placeholder: 'Enter Color',
      onChanged: (Color value) {},
      colorListReversed: true,
      validator: (List<Color>? value) {
        if (value == null || value.isEmpty) {
          return 'Please enter at least one color';
        }
        return null;
      },
    ),

    // Forcing Text Direction using Directionality widget, 
    // by default the TextDirection will be read from the Localization
    Directionality(
      textDirection: TextDirection.rtl,
      child: CupertinoColorPickerFormFieldRow(
        prefix: const Text('Enter Color rtl'),
        defaultColor: defaultColor,
        placeholder: 'Enter Color rtl',
        onChanged: (Color value) {},
        validator: (List<Color>? value) {
          if (value == null || value.isEmpty) {
            return 'Please enter at least one color';
          }
          return null;
        },
      ),
    ),
  ],
),

API reference

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。