|
|
@ -27,9 +27,9 @@ class MineWalletPage extends StatefulWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
dynamic mBalance = 0; |
|
|
|
dynamic pBalance = 0; //平台总余额 |
|
|
|
|
|
|
|
dynamic mBalance = 0; // 余额 |
|
|
|
dynamic mgreenMoney = 0; |
|
|
|
dynamic mgreenMoney = 0; |
|
|
|
dynamic tBalance = 0; |
|
|
|
|
|
|
|
dynamic activityMoney = 0; |
|
|
|
dynamic activityMoney = 0; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -48,10 +48,10 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
userInfo = |
|
|
|
userInfo = |
|
|
|
UserInfo.fromJson(jsonDecode(sharedPreferences.getString('user'))); |
|
|
|
UserInfo.fromJson(jsonDecode(sharedPreferences.getString('user'))); |
|
|
|
mBalance = double.tryParse(userInfo.money); |
|
|
|
|
|
|
|
mgreenMoney = double.tryParse(userInfo.greenMoney); |
|
|
|
mgreenMoney = double.tryParse(userInfo.greenMoney); |
|
|
|
|
|
|
|
mBalance = double.tryParse(userInfo.money); |
|
|
|
|
|
|
|
pBalance = mgreenMoney + mBalance; |
|
|
|
activityMoney = double.tryParse(userInfo.activityMoney); |
|
|
|
activityMoney = double.tryParse(userInfo.activityMoney); |
|
|
|
tBalance = mBalance - (mgreenMoney ?? 0) - (activityMoney ?? 0); |
|
|
|
|
|
|
|
if (mounted) setState(() {}); |
|
|
|
if (mounted) setState(() {}); |
|
|
|
String token = sharedPreferences.getString("token"); |
|
|
|
String token = sharedPreferences.getString("token"); |
|
|
|
apiService = ApiService(Dio(), context: context, token: token); |
|
|
|
apiService = ApiService(Dio(), context: context, token: token); |
|
|
@ -71,7 +71,7 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
mgreenMoney = double.tryParse(userInfo.greenMoney); |
|
|
|
mgreenMoney = double.tryParse(userInfo.greenMoney); |
|
|
|
activityMoney = double.tryParse(userInfo.activityMoney); |
|
|
|
activityMoney = double.tryParse(userInfo.activityMoney); |
|
|
|
mBalance = double.tryParse(userInfo.money); |
|
|
|
mBalance = double.tryParse(userInfo.money); |
|
|
|
tBalance = mBalance - (mgreenMoney ?? 0) - (activityMoney ?? 0); |
|
|
|
pBalance = mBalance + mgreenMoney; |
|
|
|
if (mounted) setState(() {}); |
|
|
|
if (mounted) setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -313,10 +313,7 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
Expanded( |
|
|
|
Expanded( |
|
|
|
flex: 7, |
|
|
|
flex: 7, |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
S.of(context).pingtaizongyue( |
|
|
|
S.of(context).pingtaizongyue(userBill.balance), |
|
|
|
userBill.balance, |
|
|
|
|
|
|
|
userBill.surplusActivityMoney, |
|
|
|
|
|
|
|
userBill.surplusGreenMoney), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFF727272), |
|
|
|
color: Color(0xFF727272), |
|
|
|
fontSize: 10.sp, |
|
|
|
fontSize: 10.sp, |
|
|
@ -379,7 +376,7 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
double surplusMoney = double.tryParse(surplusGreenMoney ?? "0"); |
|
|
|
double surplusMoney = double.tryParse(surplusGreenMoney ?? "0"); |
|
|
|
double surplusActivity = double.tryParse(surplusActivityMoney ?? "0"); |
|
|
|
double surplusActivity = double.tryParse(surplusActivityMoney ?? "0"); |
|
|
|
|
|
|
|
|
|
|
|
double balance = tbalance - (surplusMoney ?? 0) - (surplusActivity ?? 0); |
|
|
|
// double balance = tbalance - (surplusMoney ?? 0) - (surplusActivity ?? 0); |
|
|
|
String greenMoney = userBill.greenMoney; |
|
|
|
String greenMoney = userBill.greenMoney; |
|
|
|
String activityMoney = userBill.activityMoney; |
|
|
|
String activityMoney = userBill.activityMoney; |
|
|
|
|
|
|
|
|
|
|
@ -395,21 +392,21 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}$activity" |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}$activity" |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
if (balance > 0) { |
|
|
|
if (tbalance > 0) { |
|
|
|
return [S.of(context).yue, "${userBill.pm == 0 ? '-' : '+'}$balance"]; |
|
|
|
return [S.of(context).yue, "${userBill.pm == 0 ? '-' : '+'}$tbalance"]; |
|
|
|
} |
|
|
|
} |
|
|
|
return []; |
|
|
|
return []; |
|
|
|
} else if (index == 1) { |
|
|
|
} else if (index == 1) { |
|
|
|
if (activity > 0) { |
|
|
|
if (money > 0 && activity > 0) { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
S.of(context).huodongyue, |
|
|
|
S.of(context).huodongyue, |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}$activity" |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}$activity" |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
if (money > 0 && (balance - money) > 0) { |
|
|
|
if (money > 0 && (tbalance - money) > 0) { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
S.of(context).yue, |
|
|
|
S.of(context).yue, |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}${(balance - money)}" |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}${(tbalance - money)}" |
|
|
|
]; |
|
|
|
]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return []; |
|
|
|
return []; |
|
|
@ -418,7 +415,7 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
if (activity > 0 && money > 0) { |
|
|
|
if (activity > 0 && money > 0) { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
S.of(context).yue, |
|
|
|
S.of(context).yue, |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}${(balance - money - activity)}" |
|
|
|
"${userBill.pm == 0 ? '-' : '+'}${(tbalance - money - activity)}" |
|
|
|
]; |
|
|
|
]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return []; |
|
|
|
return []; |
|
|
@ -468,7 +465,7 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
width: 24, |
|
|
|
width: 24, |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"$mBalance", |
|
|
|
"$pBalance", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontSize: 50, |
|
|
|
fontSize: 50, |
|
|
@ -545,7 +542,7 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
height: 4, |
|
|
|
height: 4, |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"$tBalance", |
|
|
|
"$mBalance", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18, |
|
|
|
fontSize: 18, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
@ -627,109 +624,109 @@ class _MineWalletPage extends State<MineWalletPage> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget balance1() { |
|
|
|
// Widget balance1() { |
|
|
|
return Container( |
|
|
|
// return Container( |
|
|
|
width: double.infinity, |
|
|
|
// width: double.infinity, |
|
|
|
margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 8.h), |
|
|
|
// margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 8.h), |
|
|
|
padding: EdgeInsets.fromLTRB(24.w, 24.h, 24.w, 24.h), |
|
|
|
// padding: EdgeInsets.fromLTRB(24.w, 24.h, 24.w, 24.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
// decoration: BoxDecoration( |
|
|
|
color: Colors.white, |
|
|
|
// color: Colors.white, |
|
|
|
borderRadius: BorderRadius.circular(8), |
|
|
|
// borderRadius: BorderRadius.circular(8), |
|
|
|
boxShadow: [ |
|
|
|
// boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
// BoxShadow( |
|
|
|
color: Colors.black.withAlpha(25), |
|
|
|
// color: Colors.black.withAlpha(25), |
|
|
|
offset: Offset(0, 3), |
|
|
|
// offset: Offset(0, 3), |
|
|
|
blurRadius: 14, |
|
|
|
// blurRadius: 14, |
|
|
|
spreadRadius: 0, |
|
|
|
// spreadRadius: 0, |
|
|
|
), |
|
|
|
// ), |
|
|
|
], |
|
|
|
// ], |
|
|
|
), |
|
|
|
// ), |
|
|
|
child: Column( |
|
|
|
// child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
// children: [ |
|
|
|
Stack( |
|
|
|
// Stack( |
|
|
|
alignment: Alignment.center, |
|
|
|
// alignment: Alignment.center, |
|
|
|
children: [ |
|
|
|
// children: [ |
|
|
|
Align( |
|
|
|
// Align( |
|
|
|
alignment: Alignment.center, |
|
|
|
// alignment: Alignment.center, |
|
|
|
child: Text( |
|
|
|
// child: Text( |
|
|
|
S.of(context).zongzichan, |
|
|
|
// S.of(context).zongzichan, |
|
|
|
style: TextStyle( |
|
|
|
// style: TextStyle( |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
// fontWeight: MyFontWeight.semi_bold, |
|
|
|
color: Color(0xFF353535), |
|
|
|
// color: Color(0xFF353535), |
|
|
|
fontSize: 16.sp, |
|
|
|
// fontSize: 16.sp, |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
// GestureDetector( |
|
|
|
// // GestureDetector( |
|
|
|
// onTap: () { |
|
|
|
// // onTap: () { |
|
|
|
// queryUserBalance(); |
|
|
|
// // queryUserBalance(); |
|
|
|
// }, |
|
|
|
// // }, |
|
|
|
// child: Row( |
|
|
|
// // child: Row( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
// // mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
// children: [ |
|
|
|
// // children: [ |
|
|
|
// Icon( |
|
|
|
// // Icon( |
|
|
|
// Icons.refresh, |
|
|
|
// // Icons.refresh, |
|
|
|
// size: 20, |
|
|
|
// // size: 20, |
|
|
|
// color: Color(0xFF8A8A8A), |
|
|
|
// // color: Color(0xFF8A8A8A), |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
// Text( |
|
|
|
// // Text( |
|
|
|
// S.of(context).shuaxin, |
|
|
|
// // S.of(context).shuaxin, |
|
|
|
// style: TextStyle( |
|
|
|
// // style: TextStyle( |
|
|
|
// color: Color(0xFF353535), |
|
|
|
// // color: Color(0xFF353535), |
|
|
|
// fontSize: 12.sp, |
|
|
|
// // fontSize: 12.sp, |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
// ], |
|
|
|
// // ], |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
], |
|
|
|
// ], |
|
|
|
), |
|
|
|
// ), |
|
|
|
SizedBox( |
|
|
|
// SizedBox( |
|
|
|
height: 16.h, |
|
|
|
// height: 16.h, |
|
|
|
), |
|
|
|
// ), |
|
|
|
Text( |
|
|
|
// Text( |
|
|
|
"$mBalance", |
|
|
|
// "$mBalance", |
|
|
|
style: TextStyle( |
|
|
|
// style: TextStyle( |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
// fontWeight: MyFontWeight.medium, |
|
|
|
color: Color(0xFF353535), |
|
|
|
// color: Color(0xFF353535), |
|
|
|
fontSize: 50.sp, |
|
|
|
// fontSize: 50.sp, |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
// SizedBox( |
|
|
|
// // SizedBox( |
|
|
|
// height: 4.h, |
|
|
|
// // height: 4.h, |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
// Text( |
|
|
|
// // Text( |
|
|
|
// S.of(context).keyongyue, |
|
|
|
// // S.of(context).keyongyue, |
|
|
|
// style: TextStyle( |
|
|
|
// // style: TextStyle( |
|
|
|
// color: Color(0xFF20662A), |
|
|
|
// // color: Color(0xFF20662A), |
|
|
|
// fontSize: 16.sp, |
|
|
|
// // fontSize: 16.sp, |
|
|
|
// fontWeight: MyFontWeight.regular |
|
|
|
// // fontWeight: MyFontWeight.regular |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
// ), |
|
|
|
// // ), |
|
|
|
SizedBox( |
|
|
|
// SizedBox( |
|
|
|
height: 24.h, |
|
|
|
// height: 24.h, |
|
|
|
), |
|
|
|
// ), |
|
|
|
InkWell( |
|
|
|
// InkWell( |
|
|
|
onTap: () { |
|
|
|
// onTap: () { |
|
|
|
toRecharge(); |
|
|
|
// toRecharge(); |
|
|
|
}, |
|
|
|
// }, |
|
|
|
child: RoundButton( |
|
|
|
// child: RoundButton( |
|
|
|
width: 104.w, |
|
|
|
// width: 104.w, |
|
|
|
text: S.of(context).lijichongzhi, |
|
|
|
// text: S.of(context).lijichongzhi, |
|
|
|
textColor: Colors.white, |
|
|
|
// textColor: Colors.white, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
// fontWeight: MyFontWeight.semi_bold, |
|
|
|
radius: 15, |
|
|
|
// radius: 15, |
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
// backgroup: Color(0xFF32A060), |
|
|
|
fontSize: 14.sp, |
|
|
|
// fontSize: 14.sp, |
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
// padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
], |
|
|
|
// ], |
|
|
|
), |
|
|
|
// ), |
|
|
|
); |
|
|
|
// ); |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
toRecharge() async { |
|
|
|
toRecharge() async { |
|
|
|
await Navigator.of(context).pushNamed('/router/recharge_page'); |
|
|
|
await Navigator.of(context).pushNamed('/router/recharge_page'); |
|
|
|