GithubHelp home page GithubHelp logo

swipe_refresh_layout's Introduction

swipe_refresh_layout

a flutter simple swipe refresh layout,container more and load more

effect

use

return new SwipeRefreshLayout(
  onLoad: _handlerRefresh,//Futrue<Null>
  onLoadMore: _handlerRefreshMore,//Futrue<Null>
  child: new ListView(
    children: _notices.map((Notice notice) {
      return new ListTile(
        title: new Text(notice.title),
          subtitle: new Text(notice.content));
      }).toList(),
));

swipe_refresh_layout's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swipe_refresh_layout's Issues

使用时无法触发

//使用时 无法触发 两个监听 同样没显示 小圈圈 是我使用的有问题吗?
void main() {
runApp(new MyApp());
}

class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
),
home: new HomeScreen(),
debugShowCheckedModeBanner: false,
);
}
}

class HomeScreen extends StatefulWidget {
@OverRide
_HomeScreenState createState() => new _HomeScreenState();
}

class _HomeScreenState extends State {

List _notices =
[Notice("呵呵","哈哈"),
Notice("呵呵","哈哈")
,Notice("呵呵","哈哈"),
Notice("呵呵","哈哈"),
Notice("呵呵","哈哈")
,Notice("呵呵","哈哈"),
Notice("呵呵","哈哈"),
Notice("呵呵","哈哈")];

@OverRide
build(BuildContext context) {
return new Material(
child: new SwipeRefreshLayout(
onLoad: onRefresh,//Futrue
onLoadMore: onLoadMore,//Futrue
child: new ListView(
children: _notices.map((Notice notice) {
return new ListTile(
title: new Text(notice.title),
subtitle: new Text(notice.content));
}).toList(),
)),
);
}
}

class Notice{
String title;

String content;
Notice(this.title,this.content);

}

Future onRefresh() {
print("触发refresh");
final Completer completer = new Completer();
new Timer(const Duration(microseconds: 5), () {
completer.complete(null);
});
return completer.future.then((_) {
print("refresh完成");
});
}

Future onLoadMore() {
print("触发onLoadMore");

final Completer completer = new Completer();
new Timer(const Duration(microseconds: 5), () {
completer.complete(null);
});
return completer.future.then((_) {
print("onLoadMore完成");
});
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.