{"id":25995724,"url":"https://github.com/KeepAscent/auto_scrolling","last_synced_at":"2025-03-05T16:01:56.624Z","repository":{"id":277584596,"uuid":"932917234","full_name":"KeepAscent/auto_scrolling","owner":"KeepAscent","description":"Enables auto scrolling in a scrollable (ListView, GridView, etc.) by using tertiary mouse button (mouse wheel click).","archived":false,"fork":false,"pushed_at":"2025-02-22T22:24:31.000Z","size":316,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T23:22:49.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KeepAscent.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-14T19:02:17.000Z","updated_at":"2025-02-22T22:24:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"204bce31-1246-407b-b209-8a383be777b0","html_url":"https://github.com/KeepAscent/auto_scrolling","commit_stats":null,"previous_names":["keepascent/auto_scrolling"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeepAscent%2Fauto_scrolling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeepAscent%2Fauto_scrolling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeepAscent%2Fauto_scrolling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeepAscent%2Fauto_scrolling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KeepAscent","download_url":"https://codeload.github.com/KeepAscent/auto_scrolling/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242058129,"owners_count":20065063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-05T16:00:59.096Z","updated_at":"2025-03-05T16:01:56.618Z","avatar_url":"https://github.com/KeepAscent.png","language":"Dart","readme":"# Auto Scrolling\n\n[![Pub](https://img.shields.io/pub/v/auto_scrolling.svg)](https://pub.dev/packages/auto_scrolling) [![codecov](https://codecov.io/gh/KeepAscent/auto_scrolling/graph/badge.svg?token=TZZMYDU9Y7)](https://codecov.io/gh/KeepAscent/auto_scrolling) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/license/mit) ![Continuous integration](https://github.com/KeepAscent/auto_scrolling/actions/workflows/ci.yml/badge.svg)\n\nThis package provides widgets that enhances scrollable widgets by enabling auto-scrolling, a common feature in desktop and web applications.\n\n## Features\n\n- Two ways to engage auto scroll\n- Supports custom anchor (similar to Firefox)\n- Supports custom cursor for directional cursor\n- Pre-built anchors and cursors to get you up and auto scrolling quickly\n- Support for both single and multi directional scrolling\n\nThis package supports two built-in methods to activate auto-scrolling:\n\n**Middle Mouse Click (Press \u0026 Release)**\n\n- Click the middle mouse button (scroll wheel) once to activate auto-scrolling.\n- Move the cursor in the desired direction to scroll.\n- Click any mouse button to exit auto-scrolling mode.\n\n**Middle Mouse Click \u0026 Drag**\n\n- Press and hold the middle mouse button (scroll wheel) to activate auto-scrolling.\n- Drag the cursor in the desired direction to scroll.\n- Release the middle mouse button to exit auto-scrolling mode.\n\n## Platform Support\n\nThis package supports all platforms, but does require mouse events to trigger the auto scroll feature.\n\n## Getting started\n\n### Install\n\nAdd the package to your dependencies, see how under [`Installing`](https://pub.dev/packages/auto_scrolling/install).\n\n### Usage\n\nSimply wrap your scrollable such as ListView, SingleChildScrollView, etc. With the AutoScroll widget as such:\n\n```dart\nAutoScroll(\n  controller: controller,\n  child: ListView.builder(\n    controller: controller,\n    itemCount: ...,\n    itemBuilder: ...,\n  ),\n),\n```\n\n_Notice that the `AutoScroll` widget requires the same `ScrollController` as your scrollable._\n\nThe `AutoScroll` widget only supports single direction scrolling, to enable auto scroll on a view with both horizontal and vertical scrollables, use the `MultiAxisAutoScroll` widget like this:\n\n```dart\nMultiAxisAutoScroll(\n  verticalController: verticalController,\n  horizontalController: horizontalController,\n  child: ...,\n),\n```\n\n_Notice again, that the vertical and horizontal controller should be the same as those attached to your scrollables._\n\nTo add autoscroll to every scrollables, add the following line to MaterialApp:\n\n```dart\nMaterialApp(\n  scrollBehavior: MaterialAutoScrollBehavior(),\n  ...,\n)\n```\n\nThere is also `CupertinoAutoScrollBehavior` for Cupertino widget set.\n\n## Customization\n\nBoth `AutoScroll` and `MultiAxisAutoScroll` support custom anchor and cursor widgets.\n\nAn anchor is a widget that stays at the start offset when engaging auto scroll, similar to on FireFox. The anchor builder can be used simply like this:\n\n```dart\nAutoScroll(\n  anchorBuilder: (context) =\u003e SingleDirectionAnchor(\n    direction: Axis.horizontal,\n  ),\n  ...,\n),\n```\n\nThe above will ensure that an anchor with an arrow left and right, stays on the starting position when engaging auto scroll. For an anchor with arrows in all directions, use `MultiDirectionAnchor()`.\n\nIn some applications, example Google Chrome, the cursor turns into an anchor instead when auto scroll is engaged but there is no movement. This happens when the cursor is too close to the anchor position (start offset).\n\nThis can be achieved by leveraging `CursorBuilder`. To do so, simply provide a `CursorBuilder` method as such:\n\n```dart\nAutoScroll(\n  willUseCustomCursor: (direction) =\u003e switch (direction) {\n    AutoScrollDirection.none =\u003e true,\n    _ =\u003e false,\n  },\n  cursorBuilder: (bool isMoving, AutoScrollDirection direction) {\n    if (direction == AutoScrollDirection.none) {\n      // No scroll currently active\n      return SingleDirectionAnchor();\n    }\n\n    // Show default cursor\n    return null;\n  },\n  ...,\n),\n```\n\nIt is important to notice the `willUseCustomCursor` callback, in the above case we want to show a custom cursor only when there is no scroll direction. If we change it to an example in which we show an arrow up or down depending on the scroll direction, we should add it to the callback:\n\n```dart\nAutoScroll(\n  willUseCustomCursor: (direction) =\u003e switch (direction) {\n    AutoScrollDirection.none ||\n     AutoScrollDirection.up ||\n     AutoScrollDirection.down =\u003e true,\n    _ =\u003e false,\n  },\n  cursorBuilder: (bool isMoving, AutoScrollDirection direction) {\n    if (direction == AutoScrollDirection.none) {\n      // No scroll currently active\n      return SingleDirectionAnchor();\n    }\n\n    // If we are moving up or down, turn the cursor into an arrow\n    // turned in the corresponding scroll direction.\n    return switch (direction) {\n      AutoScrollDirection.none =\u003e const SingleDirectionAnchor(),\n      AutoScrollDirection.up || AutoScrollDirection.down =\u003e DirectionArrow(direction: direction),\n      _ =\u003e null,\n    };\n  },\n  ...,\n),\n```\n\nWhen using `AutoScroll` or `MultiAxisAutoScroll` the default dead zone radius is set to 10 pixels, and can be modified by providing a different value for `deadZoneRadius`, like this:\n\n```dart\nAutoScroll(\n  deadZoneRadius: 15,\n  ...,\n),\n```\n","funding_links":[],"categories":["Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKeepAscent%2Fauto_scrolling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKeepAscent%2Fauto_scrolling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKeepAscent%2Fauto_scrolling/lists"}