パッケージ、リポジトリ、アプリカテゴリを検索

selector_wheel のカバー
パッケージ詳細v1.1.2

selector_wheel

カスタマイズ可能な値選択ホイールを作成するためのFlutterパッケージ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
174
いいね数
30
Pub ポイント
130

パッケージをインストール

flutter pub add selector_wheel

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterパッケージで、ユーザー入力用のカスタマイズ可能なインタラクティブな値選択ホイールの作成を可能にします。回転するホイールから値を選択する視覚的に魅力的な方法を提供し、設定やタイマー、または直感的な数値またはカテゴリ選択が必要なあらゆるシナリオに適しています。ホイールはスムーズなアニメーション、カスタムスタイル、および複数プラットフォーム間での応答性をサポートしています。従来のテキストフィールドやドロップダウンの代替として、より優れたユーザーエクスペリエンスを求める開発者向けに設計されています。

用途

  • 視覚フィードバック付きのフォーム入力
  • 時間または数量セレクタ
  • ゲーム化されたユーザーインターフェース
  • 調整可能なパラメータを備えた設定
  • インタラクティブな教育ツール

主な機能

  • カスタマイズ可能なホイールの外観
  • スムーズな回転アニメーション
  • 応答性のあるタッチおよびドラッグサポート
  • 離散値および連続値のサポート
  • クロスプラットフォーム互換性

適している対象

  • インタラクティブなUIを構築する開発者
  • 直感的な値選択が必要なアプリ
  • 独自のフォーム要素を求めるデザイナー
  • 複数のプラットフォームをターゲットにするプロジェクト

注意事項

  • 低スペックデバイスではパフォーマンスチューニングが必要になる場合があります
  • 制限された組み込み検証
  • 非常に大きな値の範囲には最適化されていない
  • アクセシビリティを考慮した注意深い設計が必要です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Selector Wheel

pub package codecov

A Flutter package for creating customizable selector wheel widgets.

Table of Contents

Features

  • Customizable selector wheel widget
  • Supports variable wheel size, item width, item height, and more
  • Built with Flutter's best practices for optimal performance
  • Supports haptic feedback, fade-out effect, and more
  • Can be used with any data type

Usage example regular Usage example with bottom sheet

Getting started

Add selector_wheel to your pubspec.yaml by running the following command:

flutter pub add selector_wheel

Usage

Import the package:

import 'package:selector_wheel/selector_wheel.dart';
Basic usage

Use the SelectorWheel widget in your app:

SizedBox(
  width: 200,
  height: 200,
  child: SelectorWheel(
    childCount: 10,
    // convertIndexToValue is a function that converts the index of the
    // child to a value that is displayed on the selector wheel. In this
    // case, we are converting the index to a string. I.e we'll have
    // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 on the selector wheel.
    convertIndexToValue: (int index) {
      return SelectorWheelValue(
        label: index.toString(),
        value: index,
        index: index,
      );
    },
    onValueChanged: (SelectorWheelValue<int> value) {
      // print the value that was selected
      print(value);
    },
  ),
)
Customizing the selector wheel

Keep in mind, that the convertIndexToValue function can be used to convert the index to any value. In the example below, we are converting the index to a double value to represent quarter lbs.

SizedBox(
  width: 200,
  height: 200,
  child: SelectorWheel(
    childCount: 10,
    convertIndexToValue: (int index) {
      // This is just to illustrate, that the index can be converted
      // to any value. In this case, we are converting the index to
      // a quarter of a pound.
      final quarter = index / 4;

      return SelectorWheelValue(
        // The label is what is displayed on the selector wheel
        label: '${quarter.toString()} lb',
        value: quarter,
        index: index,
      );
    },
    onValueChanged: (SelectorWheelValue<double> value) {
      // print the value that was selected
      print(value);
    },
  ),
)

The colors of the selector wheel can be customized by overriding the ThemeData in the following way:

// Overriding the colors of the selector wheel
Theme(
  data: ThemeData(
    textTheme: Theme.of(context).textTheme.copyWith(
      titleLarge: Theme.of(context).textTheme.titleLarge?.copyWith(
        fontSize: 24.0,
        fontWeight: FontWeight.w600,
      ),
    ),
    colorScheme: Theme.of(context).colorScheme.copyWith(
      surface: Colors.black,
      onSurface: Colors.white,
      secondaryContainer: Colors.amber,
    ),
  ),
  child: SizedBox(
    width: 200,
    height: 200,
    child: SelectorWheel(
      childCount: 10,
      highlightBorderRadius: 16.0,
      highlightHeight: 40.0,
      highlightWidth: 100.0,
      convertIndexToValue: (int index) {
        return SelectorWheelValue(
          label: index.toString(),
          value: index,
          index: index,
        );
      },
      onValueChanged: (value) {
        // print the value that was selected
        print(value);
      },
    ),
  ),
)

Notice, that we're also customizing the "highlighted" item's border radius, height, and width. To see all the customizable properties, check out the SelectorWheel class.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue on the GitHub repository.

License

This package is licensed under the MIT License. For more details, please refer to the LICENSE file included in the repository.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。