Flutter package. A wrapper for scrollable widgets that enables smooth scrolling with a mouse on all platforms.

Overview

Dynamic Mouse Scroll

A wrapper for scrollable widgets that enables smooth scrolling with a mouse on all platforms.

First gif: Scrolling slowly.
Second gif: Scrolling quickly (flick scroll).
Third gif: Mobile drag scroll detected, physics change.

Features

  • Animate smooth scroll based on speed of user's scroll.
  • Uses universal_io to detect if platform is mobile or desktop.
  • Automatically detect if the wrong ScrollPhysics is being used and update using provider.
  • If you are using multiple scrolling widgets, wrap one ParentListener around your app to ensure all are using the same physics.
  • Fully adjust the distance and duration of your scroll events.

Basic Usage

DynMouseScroll(
  builder: (context, controller, physics) => ListView(
    controller: controller,
    physics: physics,
    children: ...
    )
)
  • To link the ScrollPhysics of multiple DynMouseScroll Widgets, wrap them in a SINGLE ParentListener and set hasParentListener to true.
ParentListener(
  child: Row(children: [
    DynMouseScroll(hasParentListener: true, children: ...),
    DynMouseScroll(hasParentListener: true, children: ...),
  ]))

Problem:

Flutter does not animate smooth scrolls for pointers, causing choppy experiences for the end user. One package, web_smooth_scroll, attempts to fix this problem by disabling default scrolling entirely (mobile can't drag now) and listening for pointer events to animate the scroll controller that can only move at one speed.

Solution:

To allow mobile default scrolling to still be accessible I detect the user's platform and automatically update if the detection was wrong. To animate the scroll at the users scroll speed I first calculate SPS (scrolls per second) and pass that value into an equation. As the user scrolls faster, each scroll animation's distance increaes and duration decreases.

When the user is scrolling very quickly (60+ SPS), a flick scroll event will be triggered. The distance and duration of this animation will be much larger than the non-flick animations. While a flick animation is active scroll events in the same direction are ignored, opposite direction cancels (stops) the scroll animation.

Tuning

Normal and flick scroll events each have their own distance and duration equation values. Each equation has min/max SPS values. By default these values are:

  • Normal scroll event: 1 -> 60
  • Flick scroll event: 60 -> 200

Upper and lower bounds of distance/duration

Each equation also has lower and upper Y values than can be either distance or duration. The 'lower' value corresponds to the minSPS X value (left side), make this greater than 'upper' for negative slope. For example, because I want duration to decrease as speed increases, I will make lowerValue > upperValue.

  • SPS 1 (lower) = Distance:80, Duration:120
  • SPS 59 (normal upper bound) = Distance:200, Duration:80
  • SPS 60 (flick lower bound) = Distance:400, Duraton:500
  • SPS 60+ (incr dist, decr dur) = Distance:400+, Duration: 500-

Additional information

How distance and duration values are calulated:

spsRange = maxSPS - minSPS;
tween = Tween<double>(begin: lowerValue, end: upperValue);
double val(double sps) => tween.transform(applyCurve(sps / spsRange));
double applyCurve(double x) => curve.transform(x);
You might also like...

Api Call Check flutter - A new Flutter project that demonstrates api calling and displays them in a scrollable list

Api Call Check flutter - A new Flutter project that demonstrates api calling and displays them in a scrollable list

api_fetch A new Flutter project that demonstrates api calling and displays them

Jan 2, 2022

A Flutter plugin providing signature pad for drawing smooth signatures.

A Flutter plugin providing signature pad for drawing smooth signatures.

A Flutter plugin providing Signature Pad for drawing smooth signatures. Library is written in pure Dart/Flutter environment to provide support for all

Dec 21, 2022

A Smooth rating bar

A Smooth rating bar

A Star rating with touch and swipe rate enabled Supports replacing default star icons with desired IconData Supports half rate and full rate (1.0 or 0

Sep 15, 2022

Clock loader - Highly versatile Widget display the smooth and creative loader named as clock loader

Clock loader - Highly versatile Widget display the smooth and creative loader named as clock loader

Clock Loader Highly versatile Widget display the smooth and creative loader name

Dec 30, 2022

User onboarding library with smooth animation of objects and background colors

User onboarding library with smooth animation of objects and background colors

SlidingTutorial Cleveroad introduces Sliding Tutorial Library for Flutter Hey guys, hope you haven’t started developing a tutorial for your Flutter ap

Dec 31, 2022

Simple and beautiful smooth animated charts.

Simple and beautiful smooth animated charts.

Charts Flutter Simple and beautiful smooth animated charts. Supported charts Bar Group bar Candle Line Pie Example Check /example folder for more deta

Jan 3, 2023

FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts

FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts

中文文档 中文介绍 Release Note v3.0-preview.17 PS: Before updating the beta version, please read the CHANGELOG to see if there are any BREAKING CHANGE Flutter

Dec 30, 2022

Open source Flutter-based GUI application that enables you to interact with Amphitheatre

Open source Flutter-based GUI application that enables you to interact with Amphitheatre

Amphitheatre Desktop Amphitheatre Desktop is an open source Flutter-based application that enables you to interact with Amphitheatre using a GUI inste

Dec 16, 2022
Comments
Owner
null
A customizable carousel slider widget in Flutter which supports inifinte scrolling, auto scrolling, custom child widget, custom animations and built-in indicators.

flutter_carousel_widget A customizable carousel slider widget in Flutter. Features Infinite Scroll Custom Child Widget Auto Play Horizontal and Vertic

NIKHIL RAJPUT 7 Nov 26, 2022
A wrapper for a Flutter ScrollView which enables lazy loading

Lazy load scrollview A wrapper for a ScrollView that will enable lazy loading Usage Add lazy_load_scrollview dependency to your pubspec.yaml: dependen

Quirijn Groot Bluemink 104 Nov 7, 2022
An application used to manage all your tabs in a clean, scrollable, categorized format.

Tabmanager Created by Sami-ul You can contact me here: [email protected] Recent updates Made the app run faster by using the backend to serve t

Sami 7 Nov 2, 2022
APP desenvolvido em flutter que se comunica com uma API desenvolvida em python para controlar o mouse e teclado da maquina onde a API roda.

INSTRUÇÕES PARA EXECUÇÃO DA API Para executar a api em python, é necessario instalar as bibliotecas pynput, uvicorn e starlette e pyqrcode. Basta exec

João Paulo Prata 66 Mar 2, 2022
Drag and Drop for Dart web apps with mouse and touch support.

Dart Drag and Drop Drag and Drop for Dart web apps with mouse and touch support. GitHub | Pub | Demos and Examples Features Use any HTML Element as Dr

Marco Jakob 136 Nov 18, 2022
Flutter Scrollable Widgets like ListView,GridView or powerful CustomScrollView can't nest inner scrollview

Introduction Flutter Scrollable Widgets like ListView,GridView or powerful CustomScrollView can't nest inner scrollview. If Nested, inner scrollview w

jaysonss 5 Aug 28, 2022
A recipe app, in which you will learn about different Scrollable widgets.

Scrollable-Widgets : A recipe app, in which you will learn about different Scrollable widgets. Concepts Included : ListView & Nested ListView GridView

Ashirbad Swain 6 Apr 26, 2022
A Simple Password Manager based on Flutter for all platforms

JADLOC. A beautiful, encrypted password manager, built using Flutter and Dart. Features Fully encrypted using XSalsa20-Poly1305 (including the databas

Japan Gor 4 Jul 12, 2022
Youtubeclone - Youtube Clone UI Built With Flutter supports all platforms

Youtube Clone Flutter Youtube Clone UI supports all platforms. UI youtube.clone.

Aderoju Israel 1 Jun 23, 2022