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

wheel_picker 표지
패키지 상세v0.4.0

wheel_picker

입력 휠을 사용한 값/시간 선택 위젯. 사용자 정의 가능하고 가볍습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.2만
좋아요
83
Pub 점수
160

패키지 설치

flutter pub add wheel_picker

패키지 개요

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

값이나 시간을 선택하기 위한 휠 기반의 픽커를 구현하는 가볍고 사용자 정의 가능한 Flutter 위젯입니다. 네이티브 스피너에서 영감을 받았으며, 다양한 플랫폼에서 부드러운 스크롤링과 직관적인 상호작용을 제공합니다. 날짜, 시간 또는 이산 값 선택이 필요한 양식에 이상적입니다. 패키지는 효율적이며 쉽게 통합할 수 있도록 설계되었으며, Android, iOS, Web, macOS, Windows 및 Linux를 지원합니다. 외관과 동작을 사용자 정의하기 위한 깔끔한 API를 제공하며, 의미 있는 오버헤드 없이도 가능합니다.

사용 사례

  • 이산 옵션을 가진 폼 입력
  • 시간 선택 인터페이스
  • 사용자 정의 숫자 또는 드롭다운 피커
  • 시각적 피드백이 있는 데이터 입력
  • 다중 휠 값 선택

주요 기능

  • 스무스 스크롤 애니메이션
  • 크로스 플랫폼 호환성
  • 사용자 정의 가능한 외관
  • 경량 성능
  • 폼 필드와의 간편한 통합
  • 사용자 정의 가능한 항목 간격 및 크기

적합한 대상

  • 양식 중심 앱을 개발하는 개발자
  • 원시적인 스타일의 피커가 필요한 UI 디자이너
  • 시간 또는 값 선택이 필요한 앱
  • 최소 번들 크기를 우선시하는 프로젝트
  • 다중 플랫폼을 대상으로 하는 팀

고려 사항

  • 제한된 내장 검증
  • 자동 키보드 통합 없음
  • 선택 이벤트를 수동으로 처리해야 합니다
  • 매우 큰 데이터 세트에 최적화되지 않음
  • 다크 모드를 위해 추가적인 스타일링이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Wheel Picker

A superset version of original ListWheelScrollView for easily creating wheel scroll input.

Flutter Pub

Left Gif Right Gif

Key Features

  • Item Selection: Retrieve the selected item index effortlessly.
  • Highlight Selection: Highlight selected items with a color shader.
  • Tap Navigation: Enable tap scrolls.
  • Horizontal Scroll Direction: Horizontal wheel scroll view.
  • Styling Flexibility: Customize wheel appearance with WheelPickerStyle.
  • Precise Control: Manage and synchronize WheelPicker widgets with a WheelPickerController.
  • Mounting Controllers: Easily integrate and shift multiple controllers.

Installing

Add it to your pubspec.yaml file:

dependencies:
  wheel_picker: ^0.3.0

Install packages from the command line:

flutter packages get

Usage

To use package, just import package import 'package:wheel_picker/wheel_picker.dart';

Example

Here's a quick example to get you started:

const daysOfWeek = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
return WheelPicker(
  itemCount: 7,
  builder: (context, index) => Text(daysOfWeek[index]),
  selectedIndexColor: Colors.orange,
  looping: false,
);
Basic (Left Gif)

For more control, you can attach a controller and adjust it to your liking:

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:wheel_picker/wheel_picker.dart';

class WheelPickerExample extends StatelessWidget {
  const WheelPickerExample({super.key});

  @override
  Widget build(BuildContext context) {
    final secondsWheel = WheelPickerController(itemCount: 10);
    const textStyle = TextStyle(fontSize: 32.0, height: 1.5);

    Timer.periodic(const Duration(seconds: 1), (_) => secondsWheel.shiftDown());

    return WheelPicker(
      builder: (context, index) => Text("$index", style: textStyle),
      controller: secondsWheel,
      selectedIndexColor: Colors.blue,
      onIndexChanged: (index, interactionType) => print("On index $index"),
      style: WheelPickerStyle(
        itemExtent: textStyle.fontSize! * textStyle.height!, // Text height
        squeeze: 1.25,
        diameterRatio: .8,
        surroundingOpacity: .25,
        magnification: 1.2,
      ),
    );
  }
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Example',
      home: Scaffold(
        body: Center(
          child: WheelPickerExample(),
        ),
      ),
    );
  }
}

void main() => runApp(const MyApp());

Note: This works for this short example but don't forget to manually dispose controllers you initialize youself.

Advanced (Right Gif)

For more advanced usage, you can also mount controllers, making them shift each other. See example.

Example: Listening for the scroll end event
const daysOfWeek = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];

return NotificationListener(
  onNotification: (notification) {
    if (notification is ScrollEndNotification) {
      print('User has ended scrolling');
    }
    return false;
  },
  child: WheelPicker(
    itemCount: 7,
    builder: (context, index) => Text(daysOfWeek[index]),
    selectedIndexColor: Colors.orange,
    looping: false,
  ),
);


Feel free to share your feedback, suggestions, or contribute to this package :handshake:.

If you like this package, consider supporting it by giving it a star on GitHub and a like on pub.dev :heart:.

카테고리

소스 저장소

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

아직 데이터가 없습니다.