搜索插件、代码仓与 APP 分类

插件详情v1.0.5

scrollable

一组功能强大的可滚动小部件,包括触觉反馈、键盘隐藏等更多功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1220
喜欢数
24
Pub 分数
160

安装插件

flutter pub add scrollable

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

scrollable 包通过一系列可定制的滚动控件增强了 Flutter 的滚动功能。它包含内置的触觉反馈、自动键盘关闭以及跨平台改进的滚动行为。专为寻求精细滚动交互的开发者设计,支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。该包扩展了 Flutter 核心 ScrollView 组件,增加了额外功能,在不牺牲性能或灵活性的前提下提升了用户体验。

适合场景

  • 增强表单中的滚动交互
  • 创建带有触觉反馈的响应式列表
  • 构建可滚动的界面以关闭键盘
  • 改进可访问性滚动内容
  • 在多个平台上实现平滑滚动

主要特点

  • 滚动时的触觉反馈
  • 自动键盘收起
  • 跨平台滚动行为
  • 可自定义的滚动物理效果
  • 内置滚动指示器
  • 可扩展的部件架构

适合对象

  • 开发交互式可滚动 UI 的开发者
  • 需要触觉反馈的应用程序
  • 表单密集型应用
  • 跨平台 Flutter 项目
  • 以可访问性为重点的设计

使用建议

  • 需要了解 Flutter 的滚动系统
  • 可能会略微增加包大小
  • 除了基本用法外,文档有限
  • 不适用于简单的列表显示
  • 最好与自定义滚动控制器一起使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

🔥 A powerful set of scrollable widgets: haptics, keyboard dismissing, and more 🔥

  • Submit an issue here.
  • Create a pull request here.
  • Contact me via email [here](mailto:me@matthewtrent.me).

3 Widgets in this package 📚

💥 ScrollHaptics
  • Applies haptic feedback when its child is scrolled (during scroll & reaching edge of scroll view).
💥 KeyboardDismiss
  • Dismisses the soft-keyboard when its child is scrolled, tapped, or swiped.
💥 ScrollableView
  • The above 2 widgets combined into 1 widget for ease-of-use.

Example Gif 📸

It's hard to display haptics in a gif, but they're there.

Installing 🧑‍🏫

  • Install the package from the pub.
    • flutter pub add scrollable
  • Import the package.
    • import 'package:scrollable/exports.dart';

Quick Start 💨

Simply wrap whatever you want inside the ScrollHaptics, KeyboardDismiss, or ScrollableView widgets, then edit whatever of their properties you want!

Short Examples of the 3 Widgets 📜

For a full example with context, view the examples tab. It shows just the ScrollableView, but it's the same layout for all 3 widgets.

Scroll Haptics

ScrollHaptics

ScrollHaptics(
        // <Assorted Properties Here>
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(height: 100, width: 100, color: Colors.redAccent),
              Container(height: 100, width: 100, color: Colors.blue),
              Container(height: 100, width: 100, color: Colors.purple),
            ],
          ),
        ),
      );
Keyboard Dismiss

KeyboardDismiss

KeyboardDismiss(
          // <Assorted Properties Here>
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(height: 100, width: 100, color: Colors.redAccent),
              Container(height: 100, width: 100, color: Colors.blue),
              Container(height: 100, width: 100, color: Colors.purple),
            ],
          ),
        ),
      );
Scrollable View

ScrollableView

ScrollableView(
          // <Assorted Properties Here>
        controller: ScrollController(),
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(height: 100, width: 100, color: Colors.redAccent),
              Container(height: 100, width: 100, color: Colors.blue),
              Container(height: 100, width: 100, color: Colors.purple),
            ],
          ),
        ),
      );

Properties of the 3 Widgets 📜

Scroll Haptics

ScrollHaptics

Highly reccomended to use ClampingScrollPhysics for the physics of whatever scrollable you're wrapping, as it works best with haptics.

  • child (required): This widget's child.
  • bubbleUpScrollNotifications: Whether the widget should bubble up scroll notifications, or block them.
  • heavyHapticsAtEdgeEnabled: When a scroll reaches the edge, if there should be a haptic effect emitted.
  • hapticEffectAtEdge: Which kind of haptic effect should be emitted when the scroll edge is reached?
  • hapticEffectDuringScroll: Which kind of haptic effect should be emitted during the scroll.
  • distancebetweenHapticEffectsDuringScroll: The distance, in pixels, that should be scrolled before emitting a new haptic scroll effect.
Keyboard Dismiss

KeyboardDismiss

  • child (required): This widget's child.
  • bubbleUpScrollNotifications: Whether the widget should bubble up scroll notifications, or block them.
  • closeKeyboardOnTap: If the keyboard should also be closed just on the widget being tapped.
  • closeKeyboardOnVerticalSwipe: If the keyboard should be closed when a vertical swipe occurs.
  • onKeyboardDismissed: Callback triggered when a dismiss occurs.
Scrollable View

ScrollableView

  • child (required): This widget's child.
  • controller (required): A ScrollController to manage the scrolling of the widget.
  • bubbleUpScrollNotifications: Whether the widget should bubble up scroll notifications, or block them.
  • closeKeyboardOnScroll: Whether the keyboard should be automatically closed on the widget being scrolled.
  • closeKeyboardOnTap: If the keyboard should also be closed just on the widget being tapped.
  • physics: Physics of the scroll view. Highly reccomended to use ClampingScrollPhysics as it works best with haptics.
  • scrollDirection: Direction of the scroll.
  • inlineBottomOrRightPadding: Inline padding of the scroll view. This is a clean substitute to having to add SizedBox widgets inside your scroll view. For the bottom (if vertical) or right (if horizontal) of the scroll view.
  • inlineTopOrLeftPadding: Inline padding of the scroll view. This is a clean substitute to having to add SizedBox widgets inside your scroll view. For the top (if vertical) or left (if horizontal) of the scroll view.
  • padding: Outer padding of the widget.
  • hapticsEnabled: If haptics should be enabled.
  • distancebetweenHapticEffectsDuringScroll: The distance, in pixels, that should be scrolled before emitting a new haptic scroll effect.
  • heavyHapticsAtEdgeEnabled: If the haptics when the edge of the scroll is reached should be enabled or not.
  • hapticEffectAtEdge: Which kind of haptic effect should be emitted when the scroll edge is reached?
  • hapticEffectDuringScroll: Which kind of haptic effect should be emitted during the scroll.
  • primary: Whether this is the primary scroll view associated with the parent PrimaryScrollController.
  • dragStartBehavior: Determines the way that drag start behavior is handled.
  • restorationId: Restoration ID to save and restore the scroll offset of the scrollable.
  • reverse: Whether the scroll view scrolls in the reading direction.
  • closeKeyboardOnVerticalSwipe: If the keyboard should be closed when a vertical swipe occurs.

Additional Info 📣

analytics

所属分类

源码仓库

使用此插件的项目

暂无相关数据。