Skip to content

A Flutter ListView for Wear OS devices

License

Notifications You must be signed in to change notification settings

sebastianloose/rotary-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rotary_list

A Flutter plugin that offers a ListView which can be scrolled with the rotary input of Wear OS devices.

ListView Demo

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!

Requirements

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.

Installation

  1. 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
  2. Run flutter pub get in your terminal

Usage

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

RotaryList(
    children: [
        // widgets ...
    ],
),
RotaryList(
    scrollFactor: 120,
    scrollAnimationDuration: const Duration(milliseconds: 500),
    scrollCurve: Curves.fastLinearToSlowEaseIn,
    reverseScroll: true,
    children: [
        // widgets ...
    ],
),

RotaryList.builder

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,
),

About

A Flutter ListView for Wear OS devices

Topics

Resources

License

Stars

Watchers

Forks