|
|
@@ -7,31 +7,50 @@ import 'package:zhiying_base_widget/widgets/mine/mine_data/model/mine_data_model |
|
|
|
import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_profile_model.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
import 'package:zhiying_comm/util/shared_prefe_util.dart'; |
|
|
|
class MineDataWidget extends StatelessWidget { |
|
|
|
|
|
|
|
class MineDataWidget extends StatefulWidget { |
|
|
|
final Map<String, dynamic> data; |
|
|
|
final MineProfileModel profile; |
|
|
|
// Map<String, dynamic> _json; |
|
|
|
// MineDataModel _style; |
|
|
|
|
|
|
|
MineDataWidget( |
|
|
|
this.profile, |
|
|
|
this.data, { |
|
|
|
Key key, |
|
|
|
}) : super(key: key) ; |
|
|
|
@override |
|
|
|
_MineDataWidgetState createState() => _MineDataWidgetState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _MineDataWidgetState extends State<MineDataWidget> { |
|
|
|
|
|
|
|
Map<String, dynamic> _json; |
|
|
|
MineDataModel _style; |
|
|
|
|
|
|
|
MineDataWidget( |
|
|
|
this.profile, |
|
|
|
this.data, { |
|
|
|
Key key, |
|
|
|
}) : super(key: key) { |
|
|
|
String d = data['data']; |
|
|
|
_json = convert.jsonDecode(d); |
|
|
|
_style = MineDataModel.fromJson(Map<String, dynamic>.from(_json)); |
|
|
|
} |
|
|
|
/// 是否iOS审核 |
|
|
|
bool _isiOSReview = false; |
|
|
|
|
|
|
|
void initState(){ |
|
|
|
_settingIosReview(); |
|
|
|
_settingData(); |
|
|
|
super.initState(); |
|
|
|
} |
|
|
|
void _settingIosReview() async{ |
|
|
|
String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
|
if(is_ios_review == '1' ){ |
|
|
|
_isiOSReview = true; |
|
|
|
} |
|
|
|
void _settingIosReview() async { |
|
|
|
String is_ios_review = await SharedPreferencesUtil.getStringValue( |
|
|
|
GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
|
setState(() { |
|
|
|
if (is_ios_review == '1') { |
|
|
|
_isiOSReview = true; |
|
|
|
print(_isiOSReview); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
void _settingData(){ |
|
|
|
setState(() { |
|
|
|
String d = widget.data['data']; |
|
|
|
_json = convert.jsonDecode(d); |
|
|
|
_style = MineDataModel.fromJson(Map<String, dynamic>.from(_json)); |
|
|
|
}); |
|
|
|
} |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
@@ -92,7 +111,7 @@ class MineDataWidget extends StatelessWidget { |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
'${profile?.total?? '0.00'}', |
|
|
|
'${widget.profile?.total?? '0.00'}', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18, |
|
|
|
fontWeight: FontWeight.w800, |
|
|
@@ -145,72 +164,72 @@ class MineDataWidget extends StatelessWidget { |
|
|
|
} |
|
|
|
|
|
|
|
Widget _createCenter() { |
|
|
|
List<MineProfileDataModel> datas = profile.gridViews; |
|
|
|
List<MineProfileDataModel> datas = widget.profile.gridViews; |
|
|
|
int length = datas?.length ?? 0; |
|
|
|
if (length > 0) { |
|
|
|
int maxColumn = 2; |
|
|
|
int row = (datas.length / 2).ceil(); |
|
|
|
if (row % 3 == 0) { |
|
|
|
maxColumn = 3; |
|
|
|
} |
|
|
|
List<Widget> rows = List(); |
|
|
|
List<Widget> columns = List(); |
|
|
|
int i = 0; |
|
|
|
for (; i < row; i++) { |
|
|
|
rows.add( |
|
|
|
_createrCenterItem(datas[i].name, datas[i].value), |
|
|
|
); |
|
|
|
if (i % maxColumn == maxColumn - 1 || i == row - 1) { |
|
|
|
columns.add(Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: rows, |
|
|
|
)); |
|
|
|
rows = List(); |
|
|
|
} else { |
|
|
|
rows.add(Container( |
|
|
|
height: 33, |
|
|
|
width: 0.5, |
|
|
|
color: HexColor.fromHex('#ebebeb'), |
|
|
|
)); |
|
|
|
int maxColumn = 2; |
|
|
|
int row = (datas.length / 2).ceil(); |
|
|
|
if (row % 3 == 0) { |
|
|
|
maxColumn = 3; |
|
|
|
} |
|
|
|
List<Widget> rows = List(); |
|
|
|
List<Widget> columns = List(); |
|
|
|
int i = 0; |
|
|
|
for (; i < row; i++) { |
|
|
|
rows.add( |
|
|
|
_createrCenterItem(datas[i].name, datas[i].value), |
|
|
|
); |
|
|
|
if (i % maxColumn == maxColumn - 1 || i == row - 1) { |
|
|
|
columns.add(Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: rows, |
|
|
|
)); |
|
|
|
rows = List(); |
|
|
|
} else { |
|
|
|
rows.add(Container( |
|
|
|
height: 33, |
|
|
|
width: 0.5, |
|
|
|
color: HexColor.fromHex('#ebebeb'), |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (i < datas.length) { |
|
|
|
columns.add(Container( |
|
|
|
height: 0.5, |
|
|
|
color: HexColor.fromHex('#ebebeb'), |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
for (; i < datas.length; i++) { |
|
|
|
rows.add( |
|
|
|
_createBottomItem(datas[i].name, datas[i].value), |
|
|
|
); |
|
|
|
if ((i - row) % maxColumn == maxColumn - 1 || |
|
|
|
i == row - 1 || |
|
|
|
i == datas.length - 1) { |
|
|
|
columns.add(Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: rows, |
|
|
|
)); |
|
|
|
rows = List(); |
|
|
|
} else { |
|
|
|
rows.add(Container( |
|
|
|
height: 33, |
|
|
|
width: 0.5, |
|
|
|
if (i < datas.length) { |
|
|
|
columns.add(Container( |
|
|
|
height: 0.5, |
|
|
|
color: HexColor.fromHex('#ebebeb'), |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
return Container( |
|
|
|
width: double.infinity, |
|
|
|
child: Column( |
|
|
|
children: columns, |
|
|
|
), |
|
|
|
); |
|
|
|
}else{ |
|
|
|
|
|
|
|
for (; i < datas.length; i++) { |
|
|
|
rows.add( |
|
|
|
_createBottomItem(datas[i].name, datas[i].value), |
|
|
|
); |
|
|
|
if ((i - row) % maxColumn == maxColumn - 1 || |
|
|
|
i == row - 1 || |
|
|
|
i == datas.length - 1) { |
|
|
|
columns.add(Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: rows, |
|
|
|
)); |
|
|
|
rows = List(); |
|
|
|
} else { |
|
|
|
rows.add(Container( |
|
|
|
height: 33, |
|
|
|
width: 0.5, |
|
|
|
color: HexColor.fromHex('#ebebeb'), |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
return Container( |
|
|
|
width: double.infinity, |
|
|
|
child: Column( |
|
|
|
children: columns, |
|
|
|
), |
|
|
|
); |
|
|
|
}else{ |
|
|
|
return Container(); |
|
|
|
} |
|
|
|
} |
|
|
@@ -279,3 +298,282 @@ class MineDataWidget extends StatelessWidget { |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
///***/// |
|
|
|
// class MineDataWidget extends StatelessWidget { |
|
|
|
// final Map<String, dynamic> data; |
|
|
|
// final MineProfileModel profile; |
|
|
|
// Map<String, dynamic> _json; |
|
|
|
// MineDataModel _style; |
|
|
|
// /// 是否iOS审核 |
|
|
|
// bool _isiOSReview = false; |
|
|
|
// MineDataWidget( |
|
|
|
// this.profile, |
|
|
|
// this.data, { |
|
|
|
// Key key, |
|
|
|
// }) : super(key: key) { |
|
|
|
// String d = data['data']; |
|
|
|
// _json = convert.jsonDecode(d); |
|
|
|
// _style = MineDataModel.fromJson(Map<String, dynamic>.from(_json)); |
|
|
|
// //initState(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// |
|
|
|
// |
|
|
|
// void initState(){ |
|
|
|
// _settingIosReview(); |
|
|
|
// print(_isiOSReview); |
|
|
|
// } |
|
|
|
// void _settingIosReview() async{ |
|
|
|
// String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
|
// print('${'审核状态:'+is_ios_review}'); |
|
|
|
// if(is_ios_review == '1' ){ |
|
|
|
// _isiOSReview = true; |
|
|
|
// print(_isiOSReview); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// @override |
|
|
|
// Widget build(BuildContext context) { |
|
|
|
// return Container( |
|
|
|
// margin: EdgeInsets.only(left: 12.5, right: 12.5), |
|
|
|
// decoration: BoxDecoration( |
|
|
|
// color: HexColor.fromHex(_style.gridViewBgColor), |
|
|
|
// borderRadius: BorderRadius.circular(7.5)), |
|
|
|
// child: Column( |
|
|
|
// children: <Widget>[ |
|
|
|
// _createTop(context), |
|
|
|
// _createCenter(), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// |
|
|
|
// Widget _createTop(BuildContext context) { |
|
|
|
// return Container( |
|
|
|
// width: double.infinity, |
|
|
|
// height: 62, |
|
|
|
// child: Stack( |
|
|
|
// children: <Widget>[ |
|
|
|
// Container( |
|
|
|
// width: double.infinity, |
|
|
|
// height: double.infinity, |
|
|
|
// child: ClipRRect( |
|
|
|
// borderRadius: BorderRadius.only( |
|
|
|
// topLeft: Radius.circular(7.5), |
|
|
|
// topRight: Radius.circular(7.5)), |
|
|
|
// child: CachedNetworkImage( |
|
|
|
// imageUrl: _style.accumulatedEarningsBgImg ?? '', |
|
|
|
// fit: BoxFit.cover, |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// Container( |
|
|
|
// width: double.infinity, |
|
|
|
// height: double.infinity, |
|
|
|
// child: Row( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
// children: <Widget>[ |
|
|
|
// Expanded( |
|
|
|
// child: Container( |
|
|
|
// margin: EdgeInsets.only(left: 15, right: 15), |
|
|
|
// child: Column( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
// children: <Widget>[ |
|
|
|
// Text( |
|
|
|
// _isiOSReview ? '' : '累计收益', |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 11, |
|
|
|
// fontWeight: FontWeight.w600, |
|
|
|
// color: HexColor.fromHex( |
|
|
|
// _style.accumulatedEarningsNameColor), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// Text( |
|
|
|
// '${profile?.total?? '0.00'}', |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 18, |
|
|
|
// fontWeight: FontWeight.w800, |
|
|
|
// color: HexColor.fromHex( |
|
|
|
// _style.accumulatedEarningsNameColor), |
|
|
|
// fontFamily: 'Din-Bold' |
|
|
|
// '' |
|
|
|
// '' |
|
|
|
// '' |
|
|
|
// '', |
|
|
|
// package: 'zhiying_comm', |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// GestureDetector( |
|
|
|
// child: Container( |
|
|
|
// margin: EdgeInsets.only(right: 30), |
|
|
|
// width: 64, |
|
|
|
// height: 24, |
|
|
|
// child: Stack( |
|
|
|
// children: <Widget>[ |
|
|
|
// CachedNetworkImage( |
|
|
|
// imageUrl: _style?.btnImg ?? '', |
|
|
|
// fit: BoxFit.cover, |
|
|
|
// ), |
|
|
|
// Center( |
|
|
|
// child: Text( |
|
|
|
// _style.btnText, |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 12, |
|
|
|
// color: HexColor.fromHex(_style.btnTextColor)), |
|
|
|
// ), |
|
|
|
// ) |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// onTap: () { |
|
|
|
// RouterUtil.route(_style, _style.toJson(), context); |
|
|
|
// }, |
|
|
|
// ) |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ) |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// |
|
|
|
// Widget _createCenter() { |
|
|
|
// List<MineProfileDataModel> datas = profile.gridViews; |
|
|
|
// int length = datas?.length ?? 0; |
|
|
|
// if (length > 0) { |
|
|
|
// int maxColumn = 2; |
|
|
|
// int row = (datas.length / 2).ceil(); |
|
|
|
// if (row % 3 == 0) { |
|
|
|
// maxColumn = 3; |
|
|
|
// } |
|
|
|
// List<Widget> rows = List(); |
|
|
|
// List<Widget> columns = List(); |
|
|
|
// int i = 0; |
|
|
|
// for (; i < row; i++) { |
|
|
|
// rows.add( |
|
|
|
// _createrCenterItem(datas[i].name, datas[i].value), |
|
|
|
// ); |
|
|
|
// if (i % maxColumn == maxColumn - 1 || i == row - 1) { |
|
|
|
// columns.add(Row( |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// children: rows, |
|
|
|
// )); |
|
|
|
// rows = List(); |
|
|
|
// } else { |
|
|
|
// rows.add(Container( |
|
|
|
// height: 33, |
|
|
|
// width: 0.5, |
|
|
|
// color: HexColor.fromHex('#ebebeb'), |
|
|
|
// )); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// if (i < datas.length) { |
|
|
|
// columns.add(Container( |
|
|
|
// height: 0.5, |
|
|
|
// color: HexColor.fromHex('#ebebeb'), |
|
|
|
// )); |
|
|
|
// } |
|
|
|
// |
|
|
|
// for (; i < datas.length; i++) { |
|
|
|
// rows.add( |
|
|
|
// _createBottomItem(datas[i].name, datas[i].value), |
|
|
|
// ); |
|
|
|
// if ((i - row) % maxColumn == maxColumn - 1 || |
|
|
|
// i == row - 1 || |
|
|
|
// i == datas.length - 1) { |
|
|
|
// columns.add(Row( |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// children: rows, |
|
|
|
// )); |
|
|
|
// rows = List(); |
|
|
|
// } else { |
|
|
|
// rows.add(Container( |
|
|
|
// height: 33, |
|
|
|
// width: 0.5, |
|
|
|
// color: HexColor.fromHex('#ebebeb'), |
|
|
|
// )); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// return Container( |
|
|
|
// width: double.infinity, |
|
|
|
// child: Column( |
|
|
|
// children: columns, |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// }else{ |
|
|
|
// return Container(); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// Widget _createrCenterItem(String name, String value) { |
|
|
|
// return Expanded( |
|
|
|
// child: Container( |
|
|
|
// padding: EdgeInsets.only(left: 15, right: 15), |
|
|
|
// height: 72, |
|
|
|
// child: Column( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
// children: <Widget>[ |
|
|
|
// Text( |
|
|
|
// name, |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 11, |
|
|
|
// color: HexColor.fromHex(_style.gridViewNameColor)), |
|
|
|
// ), |
|
|
|
// Padding( |
|
|
|
// padding: const EdgeInsets.only(top: 2), |
|
|
|
// child: Text( |
|
|
|
// value, |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 18, |
|
|
|
// color: HexColor.fromHex(_style.gridViewValueColor), |
|
|
|
// fontFamily: 'Din-Bold', |
|
|
|
// package: 'zhiying_comm'), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// |
|
|
|
// Widget _createBottomItem(String name, String value) { |
|
|
|
// return Expanded( |
|
|
|
// child: Container( |
|
|
|
// padding: EdgeInsets.only(left: 15, right: 15), |
|
|
|
// height: 46, |
|
|
|
// child: Row( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
// children: <Widget>[ |
|
|
|
// Text( |
|
|
|
// name, |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 12, |
|
|
|
// color: HexColor.fromHex(_style.gridViewNameColor)), |
|
|
|
// ), |
|
|
|
// Padding( |
|
|
|
// padding: const EdgeInsets.only(left: 2), |
|
|
|
// child: Text( |
|
|
|
// value, |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 12, |
|
|
|
// color: HexColor.fromHex(_style.gridViewValueColor), |
|
|
|
// fontFamily: 'Din-Bold', |
|
|
|
// package: 'zhiying_comm'), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// } |