https://github.com/surfstudio/flutter-swipe-refresh
Made by Surf 🏄
https://github.com/surfstudio/flutter-swipe-refresh
Last synced: about 1 year ago
JSON representation
Made by Surf 🏄
- Host: GitHub
- URL: https://github.com/surfstudio/flutter-swipe-refresh
- Owner: surfstudio
- License: apache-2.0
- Created: 2021-07-09T05:44:10.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T15:02:39.000Z (about 2 years ago)
- Last Synced: 2025-04-13T07:13:09.757Z (about 1 year ago)
- Language: Dart
- Homepage:
- Size: 351 KB
- Stars: 12
- Watchers: 10
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Swipe Refresh

[](https://github.com/surfstudio/flutter-swipe-refresh)
[](https://app.codecov.io/gh/surfstudio/flutter-swipe-refresh)
[](https://pub.dev/packages/swipe_refresh)
[](https://pub.dev/packages/swipe_refresh)
[](https://pub.dev/packages/swipe_refresh/score)

## 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.


Main classes:
1. [Refresh state](lib/src/swipe_refresh_state.dart)
2. [Widget for indicate swipe refresh](lib/src/swipe_refresh.dart)
3. [Widget for indicate swipe refresh Material style](lib/src/material_swipe_refresh.dart)
4. [Widget for indicate swipe refresh Cupertino style](lib/src/cupertino_swipe_refresh.dart)
## Example
### Material
Refresh indicator widget with Material Design style.
```dart
SwipeRefresh.material(
stateStream: Stream(),
onRefresh: _refresh,
padding: const EdgeInsets.symmetric(vertical: 10),
children: [ ... ],
);
Future _refresh() async {
// When all needed is done change state.
_controller.sink.add(SwipeRefreshState.hidden);
}
```
### Cupertino
Refresh indicator widget with Cupertino Design style.
```dart
SwipeRefresh.cupertino(
stateStream: Stream(),
onRefresh: _refresh,
padding: const EdgeInsets.symmetric(vertical: 10),
children: [ ... ],
);
Future _refresh() async {
// When all needed is done change state.
_controller.sink.add(SwipeRefreshState.hidden);
}
```
### Adaptive
Refresh indicator widget with adaptive to platform style.
```dart
SwipeRefresh.adaptive(
stateStream: Stream(),
onRefresh: _refresh,
padding: const EdgeInsets.symmetric(vertical: 10),
children: [ ... ],
);
Future _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).
```dart
SwipeRefresh.builder(
stateStream: Stream(),
onRefresh: _refresh,
padding: const EdgeInsets.symmetric(vertical: 10),
itemCount: Colors.primaries.length,
itemBuilder: (context, index) {
return Container(
...
);
},
),
Future _refresh() async {
// When all needed is done change state.
_controller.sink.add(SwipeRefreshState.hidden);
}
```
## Installation
Add `swipe_refresh` to your `pubspec.yaml` file:
```yaml
dependencies:
swipe_refresh: $currentVersion$
```
At this moment, the current version of swipe_refresh is
.
## Changelog
All notable changes to this project will be documented in [this file](./CHANGELOG.md).
## Issues
To report your issues, submit them directly in the [Issues](https://github.com/surfstudio/flutter-swipe-refresh/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](./CONTRIBUTING.md) 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.
[](https://t.me/SurfGear)
## License
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)