use new constructor for list

master
laiiihz 4 years ago
parent a5c357e95d
commit e2e0f04def

@ -43,7 +43,6 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized();
cameras = await availableCameras();
//TODO ios settings
PackageInfo _packageInfo = await PackageInfo.fromPlatform();
AppConfig.versionNumber = _packageInfo.buildNumber;
//AMap

@ -9,7 +9,7 @@ class AfterSalesLogListModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<AfterSalesLogModel>();
data = [];
json['data'].forEach((v) {
data.add(new AfterSalesLogModel.fromJson(v));
});
@ -34,7 +34,8 @@ class AfterSalesLogModel {
String content;
String ctime;
AfterSalesLogModel({this.id, this.asId, this.title, this.content, this.ctime});
AfterSalesLogModel(
{this.id, this.asId, this.title, this.content, this.ctime});
AfterSalesLogModel.fromJson(Map<String, dynamic> json) {
id = json['id'];

@ -31,7 +31,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
balance = json['balance'];
if (json['list'] != null) {
list = new List<DataList>();
list = [];
json['list'].forEach((v) {
list.add(new DataList.fromJson(v));
});

@ -30,7 +30,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = new List<IncomeList>();
list = [];
json['list'].forEach((v) {
list.add(new IncomeList.fromJson(v));
});

@ -31,7 +31,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
brand = json['brand'] != null ? new Brand.fromJson(json['brand']) : null;
if (json['list'] != null) {
list = new List<Images>();
list = [];
json['list'].forEach((v) {
list.add(new Images.fromJson(v));
});

@ -9,7 +9,7 @@ class GoodsHotSellListModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<Data>();
data = [];
json['data'].forEach((v) {
data.add(new Data.fromJson(v));
});
@ -46,26 +46,26 @@ class Data {
int isImport;
int isFerme;
int storehouse;
Data(
{this.id,
this.goodsName,
this.description,
this.inventory,
this.salesVolume,
this.mainPhotoUrl,
this.promotionName,
this.discountPrice,
this.originalPrice,
this.commission,
this.coupon,
this.index = 0,
this.brandName,
this.brandImg,
this.brandId,
this.isFerme,
this.isImport,
this.storehouse,
});
Data({
this.id,
this.goodsName,
this.description,
this.inventory,
this.salesVolume,
this.mainPhotoUrl,
this.promotionName,
this.discountPrice,
this.originalPrice,
this.commission,
this.coupon,
this.index = 0,
this.brandName,
this.brandImg,
this.brandId,
this.isFerme,
this.isImport,
this.storehouse,
});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -82,9 +82,9 @@ class Data {
brandName = json['brandName'];
brandImg = json['brandImg'];
brandId = json['brandId'];
isImport=json['isImport'];
isFerme=json['isFerme'];
storehouse=json['storehouse'];
isImport = json['isImport'];
isFerme = json['isFerme'];
storehouse = json['storehouse'];
}
Map<String, dynamic> toJson() {
@ -100,9 +100,9 @@ class Data {
data['originalPrice'] = this.originalPrice;
data['commission'] = this.commission;
data['coupon'] = this.coupon;
data['isImport']=this.isImport;
data['isFerme']=this.isFerme;
data['storehouse']=this.storehouse;
data['isImport'] = this.isImport;
data['isFerme'] = this.isFerme;
data['storehouse'] = this.storehouse;
return data;
}
}

@ -10,7 +10,7 @@ class GoodsSimpleListModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<GoodsSimple>();
data = [];
json['data'].forEach((v) {
data.add(new GoodsSimple.fromJson(v));
});
@ -50,29 +50,29 @@ class GoodsSimple {
int isImport;
int isFerme;
int storehouse;
GoodsSimple(
{this.id,
this.goodsName,
this.description,
this.inventory,
this.salesVolume,
this.mainPhotoUrl,
this.promotionName,
this.originalPrice,
this.discountPrice,
this.commission,
this.tags,
this.percent,
this.startTime,
this.endTime,
this.coupon,
this.brandName,
this.brandImg,
this.brandId,
this.isFerme,
this.isImport,
this.storehouse,
});
GoodsSimple({
this.id,
this.goodsName,
this.description,
this.inventory,
this.salesVolume,
this.mainPhotoUrl,
this.promotionName,
this.originalPrice,
this.discountPrice,
this.commission,
this.tags,
this.percent,
this.startTime,
this.endTime,
this.coupon,
this.brandName,
this.brandImg,
this.brandId,
this.isFerme,
this.isImport,
this.storehouse,
});
GoodsSimple.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -95,9 +95,9 @@ class GoodsSimple {
brandName = json['brandName'];
brandImg = json['brandImg'];
brandId = json['brandId'];
isImport=json['isImport'];
isFerme=json['isFerme'];
storehouse=json['storehouse'];
isImport = json['isImport'];
isFerme = json['isFerme'];
storehouse = json['storehouse'];
}
Map<String, dynamic> toJson() {
@ -116,14 +116,13 @@ class GoodsSimple {
data['percent'] = this.percent;
data['startTime'] = this.startTime;
data['endTime'] = this.endTime;
data['isImport']=this.isImport;
data['isFerme']=this.isFerme;
data['storehouse']=this.storehouse;
data['isImport'] = this.isImport;
data['isFerme'] = this.isFerme;
data['storehouse'] = this.storehouse;
return data;
}
getPromotionStatus(){
getPromotionStatus() {
return PromotionTimeTool.getPromotionStatusWithGoodsSimple(this);
}
}

@ -49,7 +49,7 @@ class GuideOrderItemModel {
goodsTotalAmount = json['goodsTotalAmount'];
actualTotalAmount = json['actualTotalAmount'];
if (json['goods'] != null) {
goods = new List<Goods>();
goods = [];
json['goods'].forEach((v) {
goods.add(new Goods.fromJson(v));
});

@ -9,7 +9,7 @@ class IncomeListModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<Data>();
data = [];
json['data'].forEach((v) {
data.add(new Data.fromJson(v));
});

@ -9,7 +9,7 @@ class InviteListModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<InviteModel>();
data = [];
json['data'].forEach((v) {
data.add(new InviteModel.fromJson(v));
});

@ -30,7 +30,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = new List<PerformanceList>();
list = [];
json['list'].forEach((v) {
list.add(new PerformanceList.fromJson(v));
});
@ -58,9 +58,13 @@ class PerformanceList {
int userId;
num salesAmount;
num role;
PerformanceList({this.nickname, this.avatarPath, this.userId, this.salesAmount, this.role});
PerformanceList(
{this.nickname,
this.avatarPath,
this.userId,
this.salesAmount,
this.role});
PerformanceList.fromJson(Map<String, dynamic> json) {
nickname = json['nickname'];
@ -68,7 +72,6 @@ class PerformanceList {
userId = json['userId'];
salesAmount = json['salesAmount'];
role = json['role'];
}
Map<String, dynamic> toJson() {
@ -78,7 +81,7 @@ class PerformanceList {
data['userId'] = this.userId;
data['salesAmount'] = this.salesAmount;
data['role'] = this.role;
return data;
}
}
@ -90,7 +93,12 @@ class Statistics {
num ratio;
num actualIncome;
Statistics({this.salesAmount, this.income, this.subIncome, this.ratio,this.actualIncome });
Statistics(
{this.salesAmount,
this.income,
this.subIncome,
this.ratio,
this.actualIncome});
Statistics.fromJson(Map<String, dynamic> json) {
salesAmount = json['salesAmount'];

@ -33,7 +33,7 @@ class CoinData {
total = json['total'];
history = json['history'];
if (json['list'] != null) {
list = new List<CoinList>();
list = [];
json['list'].forEach((v) {
list.add(new CoinList.fromJson(v));
});
@ -102,14 +102,12 @@ class UserCoin {
}
}
// /*
// * ====================================================
// * package :
// * package :
// * author : Created by nansi.
// * time : 2019-08-27 11:41
// * remark :
// * time : 2019-08-27 11:41
// * remark :
// * ====================================================
// */
@ -205,7 +203,6 @@ class UserCoin {
// part 'rui_coin_list_model.g.dart';
// @JsonSerializable()
// class RuiCoinListModel extends BaseModel {
@ -219,7 +216,6 @@ class UserCoin {
// }
// @JsonSerializable()
// class RuiCoinModel extends Object {
@ -237,7 +233,6 @@ class UserCoin {
// }
// @JsonSerializable()
// class Detail extends Object {

@ -163,7 +163,7 @@ class Stand {
level = json['Level'];
basePercent = json['BasePercent'];
if (json['IncreaseNum'] != null) {
increaseNum = new List<IncreaseNum>();
increaseNum = [];
json['IncreaseNum'].forEach((v) {
increaseNum.add(new IncreaseNum.fromJson(v));
});

@ -44,7 +44,7 @@ class Data {
? new AccumulateIncome.fromJson(json['accumulateIncome'])
: null;
if (json['incomes'] != null) {
incomes = new List<Incomes>();
incomes = [];
json['incomes'].forEach((v) {
incomes.add(new Incomes.fromJson(v));
});

@ -58,13 +58,13 @@ class UpCode {
UpCode.fromJson(Map<String, dynamic> json) {
if (json['usedCode'] != null) {
usedCode = new List<UnusedCode>();
usedCode = [];
json['usedCode'].forEach((v) {
usedCode.add(new UnusedCode.fromJson(v));
});
}
if (json['unusedCode'] != null) {
unusedCode = new List<UnusedCode>();
unusedCode = [];
json['unusedCode'].forEach((v) {
unusedCode.add(new UnusedCode.fromJson(v));
});

@ -9,7 +9,7 @@ class WithdrawHistoryModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<Data>();
data = [];
json['data'].forEach((v) {
data.add(new Data.fromJson(v));
});

@ -55,7 +55,7 @@ class ActivityListModel {
goods = json['goods'] != null ? new Goods.fromJson(json['goods']) : null;
id = json['id'];
if (json['imgList'] != null) {
imgList = new List<ImgList>();
imgList = [];
json['imgList'].forEach((v) {
imgList.add(new ImgList.fromJson(v));
});

@ -33,7 +33,7 @@ class ActivityReviewListModel {
praise = json['praise'];
isPraise = json['isPraise'];
if (json['sub'] != null) {
sub = new List<Sub>();
sub = [];
json['sub'].forEach((v) {
sub.add(new Sub.fromJson(v));
});

@ -6,7 +6,7 @@ class GoodsWindowModel {
GoodsWindowModel.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = new List<GoodsList>();
list = [];
json['list'].forEach((v) {
list.add(new GoodsList.fromJson(v));
});

@ -31,7 +31,7 @@ class LiveResumeModel {
praise = json['praise'];
isFirst = json['isFirst'];
if (json['goodsLists'] != null) {
goodsLists = new List<GoodsLists>();
goodsLists = [];
json['goodsLists'].forEach((v) {
goodsLists.add(new GoodsLists.fromJson(v));
});

@ -44,7 +44,7 @@ class LiveStreamInfoModel {
praise = json['praise'];
groupId = json['groupId'];
if (json['goodsLists'] != null) {
goodsLists = new List<GoodsLists>();
goodsLists = [];
json['goodsLists'].forEach((v) {
goodsLists.add(new GoodsLists.fromJson(v));
});

@ -56,37 +56,37 @@ class LiveTimeDataModel {
count = json['count'];
duration = json['duration'];
if (json['datePrise'] != null) {
datePrise = new List<LiveTimeDataBase>();
datePrise = [];
json['datePrise'].forEach((v) {
datePrise.add(new LiveTimeDataBase.fromJson(v));
});
}
if (json['dateLook'] != null) {
dateLook = new List<LiveTimeDataBase>();
dateLook = [];
json['dateLook'].forEach((v) {
dateLook.add(new LiveTimeDataBase.fromJson(v));
});
}
if (json['dateFans'] != null) {
dateFans = new List<LiveTimeDataBase>();
dateFans = [];
json['dateFans'].forEach((v) {
dateFans.add(new LiveTimeDataBase.fromJson(v));
});
}
if (json['dateBuy'] != null) {
dateBuy = new List<LiveTimeDataBase>();
dateBuy = [];
json['dateBuy'].forEach((v) {
dateBuy.add(new LiveTimeDataBase.fromJson(v));
});
}
if (json['dateSalesVolume'] != null) {
dateSalesVolume = new List<LiveTimeDataBase>();
dateSalesVolume = [];
json['dateSalesVolume'].forEach((v) {
dateSalesVolume.add(new LiveTimeDataBase.fromJson(v));
});
}
if (json['dateAnticipatedRevenue'] != null) {
dateAnticipatedRevenue = new List<LiveTimeDataBase>();
dateAnticipatedRevenue = [];
json['dateAnticipatedRevenue'].forEach((v) {
dateAnticipatedRevenue.add(new LiveTimeDataBase.fromJson(v));
});

@ -9,7 +9,7 @@ class NoticeListModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<NoticeData>();
data = [];
json['data'].forEach((v) {
data.add(new NoticeData.fromJson(v));
});

@ -33,7 +33,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
if (json['incomes'] != null) {
incomes = new List<Incomes>();
incomes = [];
json['incomes'].forEach((v) {
incomes.add(new Incomes.fromJson(v));
});

@ -37,7 +37,7 @@ class Data {
income = json['income'];
memberCount = json['memberCount'];
if (json['members'] != null) {
members = new List<Members>();
members = [];
json['members'].forEach((v) {
members.add(new Members.fromJson(v));
});

@ -9,7 +9,7 @@ class ReturnReasonModel {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
data = new List<ReasonModel>();
data = [];
json['data'].forEach((v) {
data.add(new ReasonModel.fromJson(v));
});

@ -35,7 +35,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = new List<ListItem>();
list = [];
json['list'].forEach((v) {
list.add(new ListItem.fromJson(v));
});

@ -22,19 +22,19 @@ class UserBenefitExpectExtraModel {
json['recommend'] != null ? new Team.fromJson(json['recommend']) : null;
reward = json['reward'] != null ? new Team.fromJson(json['reward']) : null;
if (json['teamList'] != null) {
teamList = new List<TeamList>();
teamList = [];
json['teamList'].forEach((v) {
teamList.add(new TeamList.fromJson(v));
});
}
if (json['recommendList'] != null) {
recommendList = new List<TeamList>();
recommendList = [];
json['recommendList'].forEach((v) {
recommendList.add(new TeamList.fromJson(v));
});
}
if (json['rewardList'] != null) {
rewardList = new List<TeamList>();
rewardList = [];
json['rewardList'].forEach((v) {
rewardList.add(new TeamList.fromJson(v));
});

@ -42,7 +42,7 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
if (json['userIncome'] != null) {
userIncome = new List<UserIncome>();
userIncome = [];
json['userIncome'].forEach((v) {
userIncome.add(new UserIncome.fromJson(v));
});

@ -15,14 +15,14 @@ class UserBenefitMonthExpectModel {
: null;
guide = json['guide'] != null ? new Purchase.fromJson(json['guide']) : null;
if (json['purchaseList'] != null) {
purchaseList = new List<PurchaseList>();
purchaseList = [];
json['purchaseList'].forEach((v) {
purchaseList.add(new PurchaseList.fromJson(v));
});
} else
purchaseList = [];
if (json['guideList'] != null) {
guideList = new List<PurchaseList>();
guideList = [];
json['guideList'].forEach((v) {
guideList.add(new PurchaseList.fromJson(v));
});

@ -37,7 +37,7 @@ class Data {
date = json['date'];
coinNum = json['coinNum'];
if (json['list'] != null) {
list = new List<IncomeList>();
list = [];
json['list'].forEach((v) {
list.add(new IncomeList.fromJson(v));
});

@ -39,7 +39,7 @@ class Data {
? new IncomeDetail.fromJson(json['incomeDetail'])
: null;
if (json['billboard'] != null) {
billboard = new List<Billboard>();
billboard = [];
json['billboard'].forEach((v) {
billboard.add(new Billboard.fromJson(v));
});

@ -9,7 +9,7 @@ class ReviewResultModel {
? new GoodsEva.fromJson(json['goodsEva'])
: null;
if (json['goodsEvaGoods'] != null) {
goodsEvaGoods = new List<GoodsEvaGoods>();
goodsEvaGoods = [];
json['goodsEvaGoods'].forEach((v) {
goodsEvaGoods.add(new GoodsEvaGoods.fromJson(v));
});

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class BaseController {
List<ValueNotifier> _cacheList = List();
List<ValueNotifier> _cacheList = [];
addValueNotifier(ValueNotifier notify) {
_cacheList.add(notify);

@ -1,6 +1,6 @@
class SimpleDataUtils {
static List<T> createData<T>(T createFactory(int index), {size = 10}) {
List<T> lists = new List();
List<T> lists = [];
for (int i = 0; i < size; i++) {
lists.add(createFactory(i));
}

@ -1,7 +1,7 @@
import 'package:flutter/widgets.dart';
abstract class BaseAdapter<T> {
final _listData = new List();
final _listData = [];
IndexedWidgetBuilder getBuilder() {
return (context, index) {

@ -137,8 +137,8 @@ class _MvpListViewState<T> extends State<MvpListView>
GSRefreshController(initialRefresh: widget.autoRefresh);
if (widget.controller == null) {
_mvpController = MvpListViewController(
controller: gsRefreshController, data: List<T>());
_mvpController =
MvpListViewController(controller: gsRefreshController, data: []);
} else {
_mvpController = widget.controller;
if (_mvpController.refreshController == null) {

@ -58,8 +58,8 @@ class SCGridView<T> extends StatefulWidget {
this.crossAxisSpacing = 5,
this.insetPadding = const EdgeInsets.all(5),
this.margin = const EdgeInsets.all(0),
this.viewportHeight = 0, this.childAspectRatio =1
});
this.viewportHeight = 0,
this.childAspectRatio = 1});
@override
State<StatefulWidget> createState() {
@ -82,31 +82,33 @@ class _SCGridViewState extends State<SCGridView>
@override
Widget build(BuildContext context) {
super.build(context);
List<Widget> stackViews = List();
List<Widget> gridViews = List();
List<Widget> stackViews = [];
List<Widget> gridViews = [];
for (int i = 0; i < widget.sectionCount; i++) {
Widget sectionView = _buildSection(context, i);
gridViews.add(sectionView);
}
stackViews.add(ListView(physics: NeverScrollableScrollPhysics(), shrinkWrap:true, children: gridViews,));
stackViews.add(ListView(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
children: gridViews,
));
if (widget.viewportHeight > 0) {
stackViews.add(Container(height: widget.viewportHeight,));
stackViews.add(Container(
height: widget.viewportHeight,
));
}
return Container(
margin: widget.margin,
child: ListView(
controller: _controller,
physics: BouncingScrollPhysics(),
children: [
Stack(
children: stackViews
)
],
),
controller: _controller,
physics: BouncingScrollPhysics(),
children: [Stack(children: stackViews)],
),
);
}
@ -129,7 +131,7 @@ class _SCGridViewState extends State<SCGridView>
physics: NeverScrollableScrollPhysics(),
itemCount: widget.itemCount(section),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: widget.childAspectRatio,
childAspectRatio: widget.childAspectRatio,
mainAxisSpacing: widget.mainAxisSpacing,
crossAxisSpacing: widget.crossAxisSpacing,
crossAxisCount: widget.crossAxisCount),

Loading…
Cancel
Save