| | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | | import 'package:pull_to_refresh/pull_to_refresh.dart'; |
| | | |
| | | typedef OnRefresh = void Function(); |
| | |
| | | required this.content, |
| | | this.emptyView, |
| | | this.refresh, |
| | | this.loadTextColor=const Color(0xFFB8AFB5), |
| | | this.loadTextColor = const Color(0xFFB8AFB5), |
| | | this.loadMore, |
| | | this.enablePullDown = true, |
| | | this.enablePullUp = true}); |
| | |
| | | : SmartRefresher( |
| | | enablePullDown: widget.enablePullDown!, |
| | | enablePullUp: widget.enablePullUp!, |
| | | header: const WaterDropHeader( |
| | | complete: Text( |
| | | "刷新完成", |
| | | style: TextStyle(color: Color(0xFFB8AFB5)), |
| | | ), |
| | | ), |
| | | header: |
| | | MaterialClassicHeader(), |
| | | |
| | | // const WaterDropHeader( |
| | | // complete: Text( |
| | | // "刷新完成", |
| | | // style: TextStyle(color: Color(0xFFB8AFB5)), |
| | | // ), |
| | | // ), |
| | | footer: CustomFooter( |
| | | builder: (BuildContext context, LoadStatus? mode) { |
| | | Widget body; |
| | |
| | | body = const Text("松手,加载更多!", |
| | | style: TextStyle(color: Color(0xFFB8AFB5))); |
| | | } else { |
| | | body = Text("~到底了~", |
| | | body = Text("~到底了~", |
| | | style: TextStyle(color: widget.loadTextColor)); |
| | | } |
| | | return SizedBox( |
| | |
| | | "assets/imgs/common/ic_empty.png", |
| | | ), |
| | | const Text( |
| | | "暂无数据 ", |
| | | style: TextStyle(color: Color(0xFFF698C9), fontSize: 18), |
| | | "~空空如也~", |
| | | style: TextStyle(color: Color(0xFF999999), fontSize: 18), |
| | | ) |
| | | ], |
| | | ), |
| | |
| | | } |
| | | |
| | | Widget errorView() { |
| | | return InkWell( |
| | | onTap: () { |
| | | _onRefresh(); |
| | | }, |
| | | child: Container( |
| | | alignment: Alignment.center, |
| | | // color: Colors.yellow, |
| | | child: Stack( |
| | | alignment: Alignment.bottomCenter, |
| | | children: [ |
| | | Image.asset("assets/imgs/common/ic_network_error.png", |
| | | width: MediaQuery.of(context).size.width * 2 / 5), |
| | | const Text( |
| | | "网络异常,点击重新加载", |
| | | style: TextStyle(color: Color(0xFFF698C9), fontSize: 18), |
| | | ) |
| | | ], |
| | | ), |
| | | )); |
| | | return Container( |
| | | alignment: Alignment.center, |
| | | // color: Colors.yellow, |
| | | child: Stack( |
| | | alignment: Alignment.bottomCenter, |
| | | children: [ |
| | | Image.asset("assets/imgs/common/ic_network_error.png", |
| | | width: MediaQuery.of(context).size.width * 3 / 5), |
| | | const Positioned( |
| | | bottom: 50, |
| | | left: 0, |
| | | right: 0, |
| | | child: Text( |
| | | "网络请求出错", |
| | | textAlign: TextAlign.center, |
| | | style: TextStyle(fontSize: 15, color: Color(0xFF999999)), |
| | | )), |
| | | MyFillButton( |
| | | "点击重新加载", |
| | | 18, |
| | | width: 170, |
| | | height: 36, |
| | | fontSize: 15, |
| | | onClick: () { |
| | | _onRefresh(); |
| | | }, |
| | | ) |
| | | ], |
| | | ), |
| | | ); |
| | | } |
| | | |
| | | @override |