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

swipe_refresh 封面
插件详情v1.1.2

swipe_refresh

一组小部件通过下拉手势提供刷新功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
4240
喜欢数
98
Pub 分数
150

安装插件

flutter pub add swipe_refresh

插件介绍

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

SwipeRefresh 是一个 Flutter 包,提供小部件以在可滚动列表和其他内容中启用下拉刷新功能。它通过允许用户使用自然手势刷新内容来提升用户体验,常用于具有动态数据的 feeds 或列表类应用。该包支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台,确保在不同设备上行为一致。它可无缝集成到现有的滚动视图中,并提供可自定义的指示器和刷新触发器。

适合场景

  • 刷新列表数据
  • 更新源内容
  • 下拉加载新项目
  • 增强可滚动视图中的用户体验
  • 在仪表板中实现下拉刷新

主要特点

  • 下拉手势支持
  • 可自定义的刷新指示器
  • 跨平台兼容性
  • 与 ScrollViews 的轻松集成
  • 可配置的刷新触发时机
  • 刷新时的平滑动画

适合对象

  • 开发动态列表的开发者
  • 需要实时数据更新的应用程序
  • 以用户体验为中心的移动和Web应用
  • 需要在跨平台环境中保持一致刷新模式的项目
  • 注重直观用户交互的团队

使用建议

  • 可能需要额外的状态管理
  • 使用复杂的刷新逻辑带来的性能影响
  • 复杂刷新动画的自定义功能有限
  • 不适合非滚动内容
  • 依赖于在可滚动容器内的正确使用

原始 README

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

Swipe Refresh

Build Status Coverage Status Pub Version Pub Likes Pub popularity Flutter Platform

Overview

Widget for refresh by swipe.

  • :1234: Enabled on every platform - the package is fully written on Flutter side and enabled on every platform.
  • :recycle: Fully covered by tests - guaranteeing the result and expectations from this package.
  • :notebook_with_decorative_cover: End-to-end documentation - every aspect of implementation is documented, so there is full understanding.
  • :cow2: Support from the best Flutter experts - we are open to any enhancement ideas and contributions.

material cupertino

Main classes:

  1. Refresh state
  2. Widget for indicate swipe refresh
  3. Widget for indicate swipe refresh Material style
  4. Widget for indicate swipe refresh Cupertino style

Example

Material

Refresh indicator widget with Material Design style.

SwipeRefresh.material(
  stateStream: Stream<SwipeRefreshState>(),
  onRefresh: _refresh,
  padding: const EdgeInsets.symmetric(vertical: 10),
  children: <Widget>[ ... ],
);

Future<void> _refresh() async {
  // When all needed is done change state.
  _controller.sink.add(SwipeRefreshState.hidden);
}
Cupertino

Refresh indicator widget with Cupertino Design style.

SwipeRefresh.cupertino(
  stateStream: Stream<SwipeRefreshState>(),
  onRefresh: _refresh,
  padding: const EdgeInsets.symmetric(vertical: 10),
  children: <Widget>[ ... ],
);

Future<void> _refresh() async {
  // When all needed is done change state.
  _controller.sink.add(SwipeRefreshState.hidden);
}
Adaptive

Refresh indicator widget with adaptive to platform style.

SwipeRefresh.adaptive(
  stateStream: Stream<SwipeRefreshState>(),
  onRefresh: _refresh,
  padding: const EdgeInsets.symmetric(vertical: 10),
  children: <Widget>[ ... ],
);

Future<void> _refresh() async {
  // When all needed is done change state.
  _controller.sink.add(SwipeRefreshState.hidden);
}
Builder

Refresh indicator widget with adaptive to platform style, and with SliverChildBuilderDelegate in childDelegate(so as not to create more child elements than are visible through Viewport).

SwipeRefresh.builder(
  stateStream:  Stream<SwipeRefreshState>(),
  onRefresh: _refresh,
  padding: const EdgeInsets.symmetric(vertical: 10),
  itemCount: Colors.primaries.length,
  itemBuilder: (context, index) {
return Container(
 ...
   );
 },
),

Future<void> _refresh() async {
  // When all needed is done change state.
  _controller.sink.add(SwipeRefreshState.hidden);
}

Installation

Add swipe_refresh to your pubspec.yaml file:

dependencies:
  swipe_refresh: $currentVersion$

At this moment, the current version of swipe_refresh is swipe_refresh version.

Changelog

All notable changes to this project will be documented in this file.

Issues

To report your issues, submit them directly in the Issues section.

Contribute

If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.

Your PRs are always welcome.

How to reach us

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.

Telegram

License

Apache License, Version 2.0

所属分类

源码仓库

使用此插件的项目

暂无相关数据。