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

custom_radio_grouped_button 封面
套件詳情v2.3.0

custom_radio_grouped_button

自訂單選按鈕和分組複選框按鈕

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1170
喜歡數
156
Pub 分數
140

安裝套件

flutter pub add custom_radio_grouped_button

套件介紹

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

一個 Flutter 套件,提供可自訂的單選按鈕和分組複選框按鈕,支援多個平台。它允許開發者建立視覺上獨特且具互動性的選擇元件,非常適合表單和使用者偏好設定。此套件提供靈活的樣式、易於整合,並在 Android、iOS、Web、macOS、Windows 和 Linux 上具有回應式行為。它在維持實作簡單性的同時,提升了 UI 一致性。

適用情境

  • 單選表單輸入
  • 使用者偏好設定
  • 調查或測驗介面
  • 可自定義的 UI 組件
  • 多平台應用程式

主要特色

  • 可自定義的按鈕樣式
  • 分組選擇邏輯
  • 同時支援單選與複選模式
  • 跨平台的響應式設計
  • 與現有 Flutter 項目輕鬆整合

適合對象

  • 開發表單的開發者
  • 尋求自定義控制項的UI設計師
  • 跨平台應用開發者
  • 需要互動式選擇元件的專案

使用建議

  • 需要手動處理選擇狀態
  • 有限的內建驗證
  • 複雜版面可能需要額外的樣式
  • 未針對非常大的選項清單進行優化
  • 依賴外部相依性以實現進階功能

原始 README

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

custom_radio_grouped_button

Pub

Custom Radio Buttons and Grouped Check Box Button

Custom Flutter widgets that makes Checkbox and Radio Buttons much cleaner and easier

Installing

Add the following to your pubspec.yaml file:

dependencies:
  custom_radio_grouped_button: any

Creating Radio Button

CustomRadioButton(
  elevation: 0,
  absoluteZeroSpacing: true,
  unSelectedColor: Theme.of(context).canvasColor,
  buttonLables: [
    'Student',
    'Parent',
    'Teacher',
  ],
  buttonValues: [
    "STUDENT",
    "PARENT",
    "TEACHER",
  ],
  buttonTextStyle: ButtonTextStyle(
      selectedColor: Colors.white,
      unSelectedColor: Colors.black,
      textStyle: TextStyle(fontSize: 16)),
  radioButtonValue: (value) {
    print(value);
  },
  selectedColor: Theme.of(context).accentColor,
),

Creating Grouped Button

CustomCheckBoxGroup(
  buttonTextStyle: ButtonTextStyle(
    selectedColor: Colors.red,
    unSelectedColor: Colors.orange,
    textStyle: TextStyle(
      fontSize: 16,
    ),
    selectedTextStyle: TextStyle(
      fontSize: 20,
      fontWeight: FontWeight.w700,
    ),
  ),
  unSelectedColor: Theme.of(context).canvasColor,
  buttonLables: [
    "M",
    "T",
    "W",
    "T",
    "F",
    "S",
    "S",
  ],
  buttonValuesList: [
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
  ],
  checkBoxButtonValues: (values) {
    print(values);
  },
  spacing: 0,
  defaultSelected: "Monday",
  horizontal: false,
  enableButtonWrap: false,
  width: 40,
  absoluteZeroSpacing: false,
  selectedColor: Theme.of(context).accentColor,
  padding: 10, 
);

Changing values Programiically

You can acces the widget's state using Key now

Example: Create a key for the CustomRadioButton widget

final key = new GlobalKey<CustomRadioButtonState<T>>();

now to change the value of the widget pass the value to the selectButton method

key.currentState.selectButton(<value>);

Similarly for the CustomCheckBoxGroup widget

final key = new GlobalKey<CustomCheckBoxGroupState<T>>();

key.currentState.selectButton(<value>);

Screenshots

Grouped Button Grouped Button

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。