forked from lxm_flutter/FlutterUnit
初步优化项目结构
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
/// create by 张风捷特烈 on 2020/4/30
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明:
|
||||
// {
|
||||
// "widgetId": 49,
|
||||
// "name": 'RefreshIndicator基本使用',
|
||||
// "priority": 1,
|
||||
// "subtitle":
|
||||
// "【child】 : 孩子(可滑动) 【Widget】\n"
|
||||
// "【displacement】 : 指示器悬浮高度 【double】\n"
|
||||
// "【color】 : 指示器颜色 【Color】\n",
|
||||
// "【backgroundColor】 : 指示器背景色 【Color】\n"
|
||||
// "【onRefresh】 : 异步函数 【Future<void> Function()】"
|
||||
// }
|
||||
class CustomRefreshIndicator extends StatefulWidget {
|
||||
@override
|
||||
_CustomRefreshIndicatorState createState() => _CustomRefreshIndicatorState();
|
||||
}
|
||||
|
||||
class _CustomRefreshIndicatorState extends State<CustomRefreshIndicator> {
|
||||
int _count = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Container(
|
||||
height: 200,
|
||||
width: 200,
|
||||
child: RefreshIndicator(
|
||||
onRefresh: _increment,
|
||||
displacement: 20,
|
||||
color: Colors.orange,
|
||||
backgroundColor: Colors.white,
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 200,
|
||||
height: 300,
|
||||
color: Colors.blue,
|
||||
child: Text('$_count',style: TextStyle(color: Colors.white,fontSize: 40)),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _increment() async {
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
setState(() {
|
||||
_count++;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user