Skip to content

Commit

Permalink
更新至1.0.3;修复使用CustomScrollView加载报错问题,修复部分视图在非SafeArea中偏移问题,添加CustomScr…
Browse files Browse the repository at this point in the history
…ollView使用示例
  • Loading branch information
xuelongqy committed Dec 21, 2018
1 parent 427667e commit c6de284
Show file tree
Hide file tree
Showing 16 changed files with 377 additions and 243 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![License](https://img.shields.io/badge/license-MIT-green.svg)](/LICENSE)
[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://stackoverflow.com/questions/tagged/flutter?sort=votes)
[![Pub](https://img.shields.io/badge/pub-v1.0.2-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)
[![Pub](https://img.shields.io/badge/pub-v1.0.3-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)

## [English](https://github.com/xuelongqy/flutter_easyrefresh/blob/master/README_EN.md) | 中文

Expand Down Expand Up @@ -54,7 +54,7 @@
```
//pub方式
dependencies:
flutter_easyrefresh: ^1.0.2
flutter_easyrefresh: ^1.0.3
//导入方式
dependencies:
Expand Down
4 changes: 2 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![License](https://img.shields.io/badge/license-MIT-green.svg)](/LICENSE)
[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://stackoverflow.com/questions/tagged/flutter?sort=votes)
[![Pub](https://img.shields.io/badge/pub-v1.0.2-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)
[![Pub](https://img.shields.io/badge/pub-v1.0.3-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)

## English | [中文](https://github.com/xuelongqy/flutter_easyrefresh/blob/master/README.md)

Expand Down Expand Up @@ -54,7 +54,7 @@ Just like the name, EasyRefresh can easily implement pull-down refresh and uploa
```
//pub
dependencies:
flutter_easyrefresh: ^1.0.2
flutter_easyrefresh: ^1.0.3
//import
dependencies:
Expand Down
5 changes: 5 additions & 0 deletions art/md/cn/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@
>调整:上拉加载阻力系数
>修复:多次上拉有可能卡住的问题
>修复:自动触发BallPulse没有动画问题
## V 1.0.3
>修复:使用CustomScrollView加载报错问题
>修复:部分视图在非SafeArea中偏移问题
>添加:CustomScrollView使用示例
5 changes: 5 additions & 0 deletions art/md/en/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@
>Adjustment:Drag coefficient of pull-up loading
>Repair:Problem of multiple pull-ups that may get stuck
>Repair:Automatic triggering BallPulse without animation problems
## V 1.0.3
>Adjustment:Using CustomScrollView load error
>Adjustment:Partial view than SafeArea deviation
>Add:CustomScrollView usage examples
Binary file modified art/pkg/EasyRefresh.apk
Binary file not shown.
1 change: 1 addition & 0 deletions example/assets/locale/i18n_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"floatViewDescribe": "At the top or bottom view floating on the list",
"userProfile": "User Profile",
"userProfileDescribe": "User Profile with the springback effect",
"customScrollViewDescribe": "List with AppBar Folding",
"qqGroup": "QQ group",
"github": "Github",
"name": "Name",
Expand Down
1 change: 1 addition & 0 deletions example/assets/locale/i18n_zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"floatViewDescribe": "顶部或底部视图浮动在列表上",
"userProfile": "个人中心",
"userProfileDescribe": "带回弹效果的个人中心",
"customScrollViewDescribe": "带头部折叠的列表",
"qqGroup": "QQ群",
"github": "Github",
"name": "名字",
Expand Down
21 changes: 21 additions & 0 deletions example/lib/page/sample_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/generated/translations.dart';
import 'package:example/page/auto_load_page.dart';
import 'package:example/page/basic_page.dart';
import 'package:example/page/float_page.dart';
import 'package:example/page/sliver_page.dart';
import 'package:example/page/user_profile_page.dart';
import 'package:example/widget/list_item.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -96,6 +97,26 @@ class _SamplePageState extends State<SamplePage> {
color: Colors.orange,
),
),
Container(
width: double.infinity,
height: 0.5,
padding: EdgeInsets.only(left: 5.0, right: 5.0),
child: Container(
color: Colors.black12,
),
),
ListItem(
title: Translations.of(context).text("CustomScrollView"),
describe: Translations.of(context).text("customScrollViewDescribe"),
onPressed: () {
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
return SliverPage();
}));
},
icon: Icon(Icons.format_line_spacing,
color: Colors.orange,
),
),
],
),
),
Expand Down
98 changes: 98 additions & 0 deletions example/lib/page/sliver_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import 'package:example/generated/translations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

/// CustomScrollView示例页面
class SliverPage extends StatefulWidget {
@override
_SliverPageState createState() => _SliverPageState();
}

class _SliverPageState extends State<SliverPage> {

List<String> addStr=["1","2","3","4","5","6","7","8","9","0"];
List<String> str=["1","2","3","4","5","6","7","8","9","0"];
GlobalKey<EasyRefreshState> _easyRefreshKey = new GlobalKey<EasyRefreshState>();
GlobalKey<RefreshHeaderState> _headerKey = new GlobalKey<RefreshHeaderState>();
GlobalKey<RefreshFooterState> _footerKey = new GlobalKey<RefreshFooterState>();

@override
Widget build(BuildContext context) {
return Scaffold(
body: new EasyRefresh(
key: _easyRefreshKey,
refreshHeader: ClassicsHeader(
key: _headerKey,
refreshText: Translations.of(context).text("pullToRefresh"),
refreshReadyText: Translations.of(context).text("releaseToRefresh"),
refreshingText: Translations.of(context).text("refreshing") + "...",
refreshedText: Translations.of(context).text("refreshed"),
moreInfo: Translations.of(context).text("updateAt"),
bgColor: Colors.orange,
textColor: Colors.black,
),
refreshFooter: ClassicsFooter(
key: _footerKey,
loadHeight: 50.0,
loadText: Translations.of(context).text("pushToLoad"),
loadReadyText: Translations.of(context).text("releaseToLoad"),
loadingText: Translations.of(context).text("loading"),
loadedText: Translations.of(context).text("loaded"),
noMoreText: Translations.of(context).text("noMore"),
moreInfo: Translations.of(context).text("updateAt"),
bgColor: Colors.orange,
textColor: Colors.black,
),
onRefresh: () async{
await new Future.delayed(const Duration(seconds: 1), () {
setState(() {
str.clear();
str.addAll(addStr);
});
});
},
loadMore: () async {
await new Future.delayed(const Duration(seconds: 1), () {
if (str.length < 20) {
setState(() {
str.addAll(addStr);
});
}
});
},
child: CustomScrollView(
// 手动维护semanticChildCount,用于判断是否没有更多数据
semanticChildCount: str.length,
slivers: <Widget>[
SliverAppBar(
floating: false,
pinned: true,
expandedHeight: 180.0,
flexibleSpace: FlexibleSpaceBar(
title: Text("CustomScrollView"),
),
),
SliverPadding(
padding: EdgeInsets.all(0.0),
sliver: SliverFixedExtentList(
itemExtent: 70.0,
delegate: SliverChildBuilderDelegate((context, index){
return new Container(
height: 70.0,
child: Card(
child: new Center(
child: new Text(str[index],style: new TextStyle(fontSize: 18.0),),
),
)
);
},
childCount: str.length,
)
),
)
],
)
)
);
}
}
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Easy refresh example.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1
version: 1.0.3+1

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Expand Down
98 changes: 48 additions & 50 deletions lib/ball_pulse_footer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,61 +129,59 @@ class BallPulseFooterState extends RefreshFooterState<BallPulseFooter> with Tick
@override
Widget build(BuildContext context) {
return new Container(
color: widget.backgroundColor,
height: this.height,
child: ListView(
color: widget.backgroundColor,
height: this.height,
child: SingleChildScrollView(
child: Container(
height: this.height > 30.0 ? this.height : 30.0,
child: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: this.height > 30.0 ? this.height : 30.0,
child: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox (
width: 20.0,
height: 20.0,
child: Center(
child: ClipOval (
child: Container(
color: widget.color,
height: ballSize1,
width: ballSize1,
),
),
)
SizedBox (
width: 20.0,
height: 20.0,
child: Center(
child: ClipOval (
child: Container(
color: widget.color,
height: ballSize1,
width: ballSize1,
),
),
Container (width: 5.0,),
SizedBox (
width: 20.0,
height: 20.0,
child: Center(
child: ClipOval (
child: Container(
color: widget.color,
height: ballSize2,
width: ballSize2,
),
),
)
)
),
Container (width: 5.0,),
SizedBox (
width: 20.0,
height: 20.0,
child: Center(
child: ClipOval (
child: Container(
color: widget.color,
height: ballSize2,
width: ballSize2,
),
),
Container (width: 5.0,),
SizedBox (
width: 20.0,
height: 20.0,
child: Center(
child: ClipOval (
child: Container(
color: widget.color,
height: ballSize3,
width: ballSize3,
),
),
)
)
),
Container (width: 5.0,),
SizedBox (
width: 20.0,
height: 20.0,
child: Center(
child: ClipOval (
child: Container(
color: widget.color,
height: ballSize3,
width: ballSize3,
),
),
],
),
)
]
)
),
],
),
)
)
);
}
}
Loading

0 comments on commit c6de284

Please sign in to comment.