搜尋套件、儲存庫與 APP 分類

GitHub 儲存庫alesimula/dyn_mouse_scroll

dyn_mouse_scroll

Flutter 套件。用於可滾動組件的包裝器,可在所有平台實現滑鼠平滑捲動。

dyn_mouse_scroll 專案封面
星標
7
分支
10
最近推送(UTC)
2023年10月12日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

Multiplatform Smooth Scroll

A fork of the dyn_mouse_scroll package, including Wizzel1's fixes and my own fixes; Provides wrapper for scrollable widgets that enables smooth scrolling with a mouse wheel, trackpad or touch screen on all platforms; This fork fixes all issues regarding trackpad, mouse/trackpad switching and animations, fixing the slippery effect when changing scroll direction; The fork also changes the default mouse scroll animation to look smoother; Additionally, it allows to change the scroll speed, on top of the duration and animation curve.

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.
  • Automatically detect if the wrong ScrollPhysics is being used and update using provider.
  • Adjust the duration of your scroll events.
  • Choose what mobile physics you would like to use.

Basic Usage

DynMouseScroll(
  builder: (context, controller, physics) => ListView(
    controller: controller,
    physics: physics,
    children: ...
    )
)

With additional settings:

DynMouseScroll(
  durationMS: 500,
  scrollSpeed: 4.4,
  animationCurve: Curves.easeOutQuart,
  builder: (context, controller, physics) => ListView(
    controller: controller,
    physics: physics,
    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. When the user scrolls, the 'futurePosition' variable is updated and the animation is started I set the mobile scroll physics as the default one, switching to desktop scroll physics as the mouse wheel scroll is initiated and only starting the animation after the widget is rebuilt; the desktop scroll physics then takes priority over mobile physics, switching back to mobile physics only after the last scroll animation has ended, only if no new scroll wheel action had been initiated in the meantime.

alesimula GitHub avatar
GitHub 作者

alesimula ↗

語言Dart

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項

  • flutter{"sdk":"flutter"}
  • provider^6.0.3
  • flutter_test開發依賴{"sdk":"flutter"}
  • flutter_lints開發依賴^2.0.0

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗