add refreshWidget

null_safety
小赖 4 years ago
parent ee90d3356b
commit fa574ae3dc

@ -0,0 +1,28 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleRefresh extends StatefulWidget {
ExampleRefresh({Key key}) : super(key: key);
@override
_ExampleRefreshState createState() => _ExampleRefreshState();
}
class _ExampleRefreshState extends State<ExampleRefresh> {
@override
Widget build(BuildContext context) {
return ASScaffold(
title: '刷新',
body: ASRefresh(
child: ListView.builder(
itemBuilder: (context, index) {
return Text('test');
},
itemCount: 50,
),
onRefresh: () async {},
onLoad: () async {},
),
);
}
}

@ -3,6 +3,7 @@ import 'package:example/example_bottom_button.dart';
import 'package:example/example_dialog.dart';
import 'package:example/example_drawer.dart';
import 'package:example/example_listtile.dart';
import 'package:example/example_refresh.dart';
import 'package:example/example_tag.dart';
import 'package:example/example_text_field.dart';
import 'package:flutter/material.dart';
@ -117,6 +118,10 @@ class _MyHomePageState extends State<MyHomePage> {
title: '文本框 TextField',
onPressed: () => Get.to(ExampleTextFiled()),
),
ASButton.info(
title: '刷新组件 Refresh',
onPressed: () => Get.to(ExampleRefresh()),
),
],
),
);

@ -69,6 +69,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_easyrefresh:
dependency: transitive
description:
name: flutter_easyrefresh
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.6"
flutter_localizations:
dependency: "direct main"
description: flutter
@ -184,4 +191,4 @@ packages:
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.10.0 <2.11.0"
flutter: ">=1.17.0"
flutter: ">=1.17.0 <2.0.0"

@ -23,6 +23,8 @@ export 'list_tile/as_edit_tile.dart';
export 'list_tile/as_option_tile_item.dart';
export 'list_tile/as_vertical_tile_item.dart';
export 'refresh/as_refresh.dart';
export 'tag/as_tag.dart';
export 'divider/as_divider.dart';
export 'text_field/as_search_text_field.dart';

@ -0,0 +1,39 @@
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class ASRefresh extends StatefulWidget {
final Widget child;
final Future Function() onLoad;
final Future Function() onRefresh;
final EasyRefreshController controller;
ASRefresh({
Key key,
@required this.child,
this.onLoad,
this.onRefresh,
this.controller,
}) : super(key: key);
@override
_ASRefreshState createState() => _ASRefreshState();
}
class _ASRefreshState extends State<ASRefresh> {
@override
Widget build(BuildContext context) {
return EasyRefresh(
child: widget.child,
onRefresh: widget.onRefresh,
onLoad: widget.onLoad,
controller: widget.controller,
header: MaterialHeader(
valueColor: AlwaysStoppedAnimation(kPrimaryColor),
),
footer: MaterialFooter(
enableInfiniteLoad: false,
valueColor: AlwaysStoppedAnimation(kPrimaryColor),
),
);
}
}

@ -55,6 +55,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_easyrefresh:
dependency: "direct main"
description:
name: flutter_easyrefresh
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.6"
flutter_screenutil:
dependency: "direct main"
description:
@ -151,4 +158,4 @@ packages:
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.17.0"
flutter: ">=1.17.0 <2.0.0"

@ -11,6 +11,7 @@ dependencies:
flutter:
sdk: flutter
flutter_screenutil: ^3.2.0
flutter_easyrefresh: ^2.1.6
dev_dependencies:
flutter_test:

Loading…
Cancel
Save