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

套件詳情v1.0.8

smooth_scroll_multiplatform

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

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1320
喜歡數
30
Pub 分數
130

安裝套件

flutter pub add smooth_scroll_multiplatform

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個增強可捲動組件的 Flutter 套件,可在所有平台上實現平滑、鼠標驅動的捲動。它包裝現有的可捲動元件——如 ListView 或 ScrollViewController——在使用滑鼠時提供流暢、連續的捲動體驗,進而提升桌面與網頁應用的易用性。此套件確保無論目標平台為何,行為皆一致,非常適合需要精確導航的應用程式。它利用原生輸入處理,提供快速回應且自然的捲動動作。

適用情境

  • 桌面應用程式導航
  • Web 應用平滑捲動
  • 跨平台 UI 一致性
  • 增強鼠標輸入的使用者體驗
  • 資料密集型介面中的滾動

主要特色

  • 跨平台的平滑捲動
  • 以滑鼠為中心的滾動優化
  • 與現有可捲動元件的無縫整合
  • 支援所有主要平台
  • 最小設定需求

適合對象

  • 針對多個平台的開發者
  • 包含大量可滾動內容的應用
  • 專注於桌面與網路的 Flutter 項目
  • 以使用者體驗為導向的介面設計
  • 需要精細滾動行為的專案

使用建議

  • 可能不會影響基於觸控的捲動
  • 需要鼠標輸入才能充分發揮效果
  • 對移動平台的影響有限
  • 最適合非行動裝置的使用案例
  • 大型列表上的潛在效能開銷

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案