refactor:按规范修改代码、注释等

This commit is contained in:
yifeng.yl
2019-02-19 11:56:49 +08:00
parent c2da46a7df
commit 9270581af6
5 changed files with 22 additions and 38 deletions

View File

@ -41,9 +41,7 @@ class _ListRefreshState extends State<ListRefresh> {
}); });
} }
/* // 回弹效果
* 回弹效果
* */
backElasticEffect() { backElasticEffect() {
// double edge = 50.0; // double edge = 50.0;
// double offsetFromBottom = _scrollController.position.maxScrollExtent - _scrollController.position.pixels; // double offsetFromBottom = _scrollController.position.maxScrollExtent - _scrollController.position.pixels;
@ -55,9 +53,7 @@ class _ListRefreshState extends State<ListRefresh> {
// } // }
} }
/* // list探底执行的具体事件
* list探底执行的具体事件
* */
Future _getMoreData() async { Future _getMoreData() async {
if (!isLoading && _hasMore) { if (!isLoading && _hasMore) {
// 如果上一次异步请求数据完成 同时有数据可以加载 // 如果上一次异步请求数据完成 同时有数据可以加载
@ -82,9 +78,7 @@ class _ListRefreshState extends State<ListRefresh> {
} }
} }
/* // 伪装吐出新数据
* 伪装吐出新数据
* */
Future<List> mokeHttpRequest() async { Future<List> mokeHttpRequest() async {
if (widget.requestApi is Function) { if (widget.requestApi is Function) {
final listObj = await widget.requestApi({'pageIndex': _pageIndex}); final listObj = await widget.requestApi({'pageIndex': _pageIndex});
@ -97,11 +91,8 @@ class _ListRefreshState extends State<ListRefresh> {
}); });
} }
} }
// 下拉加载的事件清空之前list内容取前X个
/* // 其实就是列表重置
* 下拉加载的事件清空之前list内容取前X个
* 其实就是列表重置
* */
Future<Null> _handleRefresh() async { Future<Null> _handleRefresh() async {
List newEntries = await mokeHttpRequest(); List newEntries = await mokeHttpRequest();
if (this.mounted) { if (this.mounted) {
@ -115,9 +106,7 @@ class _ListRefreshState extends State<ListRefresh> {
} }
} }
/* // 加载中的提示
* 加载中的提示
* */
Widget _buildLoadText() { Widget _buildLoadText() {
return Container( return Container(
child: Padding( child: Padding(
@ -128,9 +117,7 @@ class _ListRefreshState extends State<ListRefresh> {
)); ));
} }
/* // 上提加载loading的widget,如果数据到达极限,显示没有更多
* 上提加载loading的widget,如果数据到达极限,显示没有更多
* */
Widget _buildProgressIndicator() { Widget _buildProgressIndicator() {
if (_hasMore) { if (_hasMore) {
return new Padding( return new Padding(

View File

@ -409,9 +409,7 @@ class History extends StatefulWidget {
_History createState() => _History(); _History createState() => _History();
} }
/* // AppBar 默认的实例,有状态
* AppBar 默认的实例,有状态
* */
class _History extends State<History> { class _History extends State<History> {

View File

@ -62,11 +62,11 @@ class CardLessDefault extends StatelessWidget {
children: <Widget>[ children: <Widget>[
FlatButton( FlatButton(
child: const Text('BUY TICKETS',style: TextStyle(color: Colors.black, fontSize: 14.0)), child: const Text('BUY TICKETS',style: TextStyle(color: Colors.black, fontSize: 14.0)),
onPressed: () { /* ... */ }, onPressed: () { },
), ),
FlatButton( FlatButton(
child: const Text('LISTEN',style: TextStyle(color: Colors.black, fontSize: 14.0)), child: const Text('LISTEN',style: TextStyle(color: Colors.black, fontSize: 14.0)),
onPressed: () { /* ... */ }, onPressed: () { },
), ),
], ],
), ),

View File

@ -1,13 +1,13 @@
/** /// Created with Android Studio.
* Created with Android Studio. /// User: 三帆
* User: 三帆 /// Date: 07/01/2019
* Date: 07/01/2019 /// Time: 10:26
* Time: 10:26 /// email: sanfan.hx@alibaba-inc.com
* email: sanfan.hx@alibaba-inc.com /// target: xxx
* target: xxx
*/
import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
import 'demo.dart'; import 'demo.dart';
const String _Text0 = """ const String _Text0 = """

View File

@ -7,10 +7,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
/* // DropdownButton 默认按钮的实例
* DropdownButton 默认按钮的实例 // isDisabled:是否是禁用isDisabled 默认为true
* isDisabled:是否是禁用isDisabled 默认为true
* */
var selectItValue; var selectItValue;
var selectItemValue; var selectItemValue;