Viewing version 0.3.0. Open the latest package page.
wheel_picker
0.3.0A value/time picking widget using input wheels. Customizable and light weight.
Readme
Wheel Picker
A superset version of original ListWheelScrollView for easily creating wheel scroll input.
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
WheelPickerwidgets with aWheelPickerController. - 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:.
Changelog
0.0.1 — Initial Release (2023-09-11)
- Added the
Wheel Pickerpackage to the repository. - Included basic documentation in the README.
- Provided examples for using the package.
- Listed key features and installation instructions.
This release contains the WheelPicker widget with WheelPickerController and WheelPickerStyle.
0.0.2 — Documentation Update (2023-09-11)
- Updated package README documentation.
0.0.3 — Pubspec Update (2023-09-20)
- Updated package pubspec to use the repository instead of the homepage.
0.0.4 — Horizontal Scrolling Support (2023-12-25)
- Added support for horizontal scrolling.
- Breaking Change: Removed
widthandheightparameters. - New Feature: Introduced
sizeparameter for specifying wheel size for both scroll directions.
0.0.5 — Controller Improvements (2024-07-04)
- Added support for updating
itemCountand more control for moving between the wheel. - Added controller's
.shiftToand.setCurrentmethods. itemCountcan now be changed using the wheel picker controller or reactively through the wheel picker widget.
0.1.0 — Full Size Control (2024-08-09)
- Breaking Change: The
sizeproperty has been removed. - Developers now have full control over the widget's size and constraints. By default, the widget will take up as much space as possible.
- Updated the README to reflect the changes.
0.1.1 — Refactor & README Fixes (2024-08-31)
- Refactored import structure: integrated
WheelPickerControlleras part ofWheelPicker. - Updated README file to fix typos and improve clarity.
0.2.0 — Interaction Tracking (2024-12-29)
- New Feature: Added support for tracking interaction types (
tap,drag,control,mounted) duringonIndexChanged. - Improved code structure and organization.
0.2.1 — Naming & Formatting (2024-12-31)
- Refined naming for improved clarity.
- Reformatted code to align with pub's static analysis standards.
0.2.2 — SDK & Example Updates (2025-06-21)
- Lowered SDK constraints to support a wider range of Dart and Flutter versions.
- Improved README: updated the basic example’s
onIndexChangedusage and added an example showing how to listen for scroll end events.
0.3.0 — Infinite Wheels & Performance (2026-04-04)
- New Feature: Added support for infinite wheels in both directions.
- Performance Improvement: Regular wheels with a large number of items now use a builder instead of
List.generate. - Non-breaking Change:
itemCountnow allowsnullwithout breaking existing implementations. - Examples: Added a second example demonstrating switching logic with the infinite wheel and updated all examples to follow the newest Flutter SDK.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'wheel_picker:0.3.0'pubspec.yaml
name: wheel_picker
description: A value/time picking widget using input wheels. Customizable and light weight.
version: 0.3.0
repository: https://github.com/stavgafny/wheel_picker
environment:
sdk: '>=2.12.0 <4.0.0'
flutter: '>=1.17.0'
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.1 | On demand | Download | cde64b91…d7cad9 |
| 0.0.2 | On demand | Download | a53ba901…3773d4 |
| 0.0.3 | On demand | Download | 2f7324b0…29fc2f |
| 0.0.4 | On demand | Download | 532352fa…f0e8bf |
| 0.0.5 | On demand | Download | b7951361…fc2de5 |
| 0.1.0 | On demand | Download | 5261f0c4…ea03ed |
| 0.1.1 | On demand | Download | 16a1f9b2…b47c03 |
| 0.2.0 | On demand | Download | 4038e03f…bfb66b |
| 0.2.1 | On demand | Download | c116ef7e…36ed83 |
| 0.2.2 | On demand | Download | bb1d913e…4257fa |
| 0.3.0 | Cached · Upstream SHA-256 matched | Download | fd761fd8…ed3a6a |
| 0.4.0 | On demand | Download | 4d453861…97c7be |
Dependencies
flutter {
"sdk": "flutter"
}