flutter_pull_to_refresh 1.0.1

FlutterPullToRefreshView #

Flutter版的下拉刷新控件,且支持上滑至底部自动加载更多

Screenshot #

Add package dependency #

在pubspec.yaml文件中添加依赖

flutter_pull_to_refresh: ^1.0.0

然后执行获取依赖包的命令

flutter packages get

Import #

在需要使用时,导入依赖

import 'package:flutter_pull_to_refresh/pull_to_refresh.dart'

Usage #

控件基本用法的关键代码如下:

  @override
  Widget build(BuildContext context) {
    print('_PullToRefreshDemoState.build');
    return PullToRefreshView(
        key: _keyPullToRefresh,
        child: _buildWidget(),
        onRefresh: _onRefresh,
        onLoadMore: _onLoadMore,
    );
  }

  Widget _buildWidget() {
    return LoadMoreListView<String>(_list,
        (index, itemData) {
          //print("item = $index");
          return new Card(
            color: colors[index % colors.length],
            child: ListTile(title: Text(itemData, style: _bigFont))
          );
        },
        key: _keyLoadMore,
        // 自定义加载更多item的样式
        //loadMoreItem: Center(child: Text('Loading...')),
    );
  }

详细使用示例请阅读main.dart

Exist Problem #

1、下拉刷新动效暂不支持修改,也不支持使用自定义的动效

About me #

微博:@萧雾宇

License #

MIT License,详细内容请查看LICENSE文件

[1.0.0] - [2019/05/23]

  • 支持下拉刷新
  • 支持加载更多,且可使用自定义的Widget作为加载更多的Item
  • 支持无数据时显示提示空视图(EmptyView)

[1.0.1] - [2019/05/30]

  • 优化添加Item的动画

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_pull_to_refresh: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_pull_to_refresh/flutter_pull_to_refresh.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
38
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

We analyzed this package on Jul 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_pull_to_refresh.dart.

Run flutter format to format lib/flutter_pull_to_refresh.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_pull_to_refresh.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin