패키지, 저장소 및 앱 카테고리 검색

selector_wheel 표지
패키지 상세v1.1.2

selector_wheel

사용자 정의 가능한 값 선택 휠을 생성하기 위한 Flutter 패키지입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
174
좋아요
30
Pub 점수
130

패키지 설치

flutter pub add selector_wheel

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

사용자 입력을 위한 사용자 정의가 가능한 상호작용식 값 선택 휠을 생성할 수 있는 플러터 패키지입니다. 회전하는 휠을 통해 값을 선택하는 시각적으로 매력적인 방식을 제공하며, 설정, 타이머 또는 직관적인 숫자 또는 범주 선택이 필요한 모든 상황에 적합합니다. 휠은 부드러운 애니메이션, 사용자 지정 스타일 및 다중 플랫폼에서의 반응형 동작을 지원합니다. 전통적인 텍스트 필드나 드롭다운의 대안으로 사용자 경험을 향상시키고자 하는 개발자를 위해 설계되었습니다.

사용 사례

  • 시각적 피드백이 있는 폼 입력
  • 시간 또는 수량 선택기
  • 게임화된 사용자 인터페이스
  • 조정 가능한 매개변수를 가진 설정
  • 상호작용형 교육 도구

주요 기능

  • 사용자 지정 가능한 휠 표시
  • 부드러운 회전 애니메이션
  • 반응형 터치 및 드래그 지원
  • 이산 및 연속 값에 대한 지원
  • 크로스 플랫폼 호환성

적합한 대상

  • 인터랙티브 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.