Zero Scroll

Zero Scroll Banner

A luxurious, high-performance smooth scrolling library for Flutter, inspired by the popular Lenis web library.

Note: For a live demo of the scrolling physics, please run the example app or add your own screen recording here!

zero_scroll brings the "heavy", momentum-rich feel of premium web experiences to your Flutter apps. It unifies the scrolling feel across touch (mobile) and mouse wheel (desktop/web) inputs.

Features

  • ZeroScrollPhysics: A custom physics simulation that adds weight and momentum to touch drags and flings.
  • ZeroScrollWrapper: A widget that intercepts "steppy" mouse wheel events and interpolates them into smooth, continuous glides.
  • Lightweight: No heavy dependencies, built on top of Flutter's native physics engine.

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  zero_scroll: ^0.0.1

Usage

1. Basic Setup

To get the full experience, use both the Physics (for touch) and the Wrapper (for mouse wheel).

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

class MyPage extends StatefulWidget {
  @override
  _MyPageState createState() => _MyPageState();
}

class _MyPageState extends State<MyPage> {
  // 1. Create a ScrollController
  final ScrollController _controller = ScrollController();

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // 2. Wrap your scroll view in ZeroScrollWrapper
    return ZeroScrollWrapper(
      scrollController: _controller,
      scrollSpeed: 1.2, // Adjusts mouse wheel sensitivity
      child: ListView.builder(
        controller: _controller, // MUST use the same controller
        physics: const ZeroScrollPhysics(), // 3. Use ZeroScrollPhysics
        itemCount: 50,
        itemBuilder: (context, index) => ListTile(title: Text('Item $index')),
      ),
    );
  }
}

2. Customizing Physics

If you want to tweak the "weight" of the scroll, you can modify the physics (feature coming in next version, currently uses optimized defaults: Mass 50, Stiffness 100).

Platform Support

Platform Touch (Physics) Mouse Wheel (Wrapper)
iOS ✅ N/A
Android ✅ N/A
Web ✅ ✅
Windows ✅ ✅
macOS ✅ ✅
Linux ✅ ✅

Libraries

zero_scroll