A Flutter plugin that offers a ListView which can be scrolled with the rotary input of Wear OS devices.
The delay between rotating the rotary input and the list movement, as can be seen in the gif above, is only noticeable on emulators. Not on real devices!
To use this plugin, the minSdkVersion
of your android project has to be at least 18
. The minSdkVersion
can be found in ./android/app/build.gradle
in the root directory of your Flutter project.
- To install this plugin depend on it in your
pubspec.yaml
dependencies: flutter: sdk: flutter # other dependencies ... rotary_list: git: url: https://github.com/sebastianloose/rotary-list.git ref: main
- Run
flutter pub get
in your terminal
Since the RotaryList widgets are subclasses of their corresponding ListView widgets, RotaryList accepts the same arguments as ListView. In addition to these, there are the following arguments to adjust the scrolling behavior of the rotary input:
Attribute | Type | Default |
---|---|---|
scrollFactor | int | 100 |
scrollAnimationDuration | Duration | Duration(milliseconds: 200) |
scrollCurve | Curve | Curves.fastOutSlowIn |
reverseScroll | bool | false |
RotaryList(
children: [
// widgets ...
],
),
RotaryList(
scrollFactor: 120,
scrollAnimationDuration: const Duration(milliseconds: 500),
scrollCurve: Curves.fastLinearToSlowEaseIn,
reverseScroll: true,
children: [
// widgets ...
],
),
RotaryList.builder(
itemBuilder: (_, int i) => Text(i.toString()),
itemCount: 100,
),
RotaryList.builder(
scrollFactor: 120,
scrollAnimationDuration: const Duration(milliseconds: 500),
scrollCurve: Curves.fastLinearToSlowEaseIn,
reverseScroll: true,
itemBuilder: (_, int i) => Text(i.toString()),
itemCount: 100,
),