|
|
@@ -9,6 +9,7 @@ import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_b |
|
|
|
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_sk.dart'; |
|
|
|
import 'package:cached_network_image/cached_network_image.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
import 'package:provider/provider.dart'; |
|
|
|
|
|
|
|
class WalletDetail extends StatefulWidget { |
|
|
|
final Map<String, dynamic> data; |
|
|
@@ -22,7 +23,8 @@ class WalletDetail extends StatefulWidget { |
|
|
|
_WalletDetailState createState() => _WalletDetailState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMixin { |
|
|
|
class _WalletDetailState extends State<WalletDetail> |
|
|
|
with TickerProviderStateMixin { |
|
|
|
WalletDetailModel _model; |
|
|
|
|
|
|
|
TabController _tabController; |
|
|
@@ -33,13 +35,35 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
void initState() { |
|
|
|
if (widget.data != null) { |
|
|
|
_model = WalletDetailModel.fromJson(json.decode(widget.data['data'])); |
|
|
|
_tabController = TabController(length: _model.providers.length, vsync: this); |
|
|
|
_tabController = |
|
|
|
TabController(length: _model.providers.length, vsync: this); |
|
|
|
} |
|
|
|
_bloc = new WalletDetailBloc(); |
|
|
|
_bloc.loadData(_model.providers[0].type); |
|
|
|
|
|
|
|
super.initState(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
void didChangeDependencies() { |
|
|
|
RefreshListener.listen(context, (event) { |
|
|
|
if (event == "refresh") { |
|
|
|
if (_bloc.currentType == null) { |
|
|
|
_bloc.loadData(_model.providers[0].type); |
|
|
|
} else { |
|
|
|
_bloc.loadData(_bloc.currentType); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
super.didChangeDependencies(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
super.dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return StreamBuilder( |
|
|
@@ -50,8 +74,10 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
return WalletDetailSkeleton(); |
|
|
|
} |
|
|
|
return Container( |
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), |
|
|
|
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 7.5, bottom: 7.5), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.white, borderRadius: BorderRadius.circular(8)), |
|
|
|
margin: |
|
|
|
EdgeInsets.only(left: 12.5, right: 12.5, top: 7.5, bottom: 7.5), |
|
|
|
padding: const EdgeInsets.only(bottom: 13), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
@@ -70,10 +96,13 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
color: HexColor.fromHex(_model.providers[0].selectColor), |
|
|
|
), |
|
|
|
isScrollable: true, |
|
|
|
unselectedLabelColor: HexColor.fromHex(_model.providers[0].unselectColor), |
|
|
|
labelColor: HexColor.fromHex(_model.providers[0].selectColor), |
|
|
|
unselectedLabelColor: |
|
|
|
HexColor.fromHex(_model.providers[0].unselectColor), |
|
|
|
labelColor: |
|
|
|
HexColor.fromHex(_model.providers[0].selectColor), |
|
|
|
controller: _tabController, |
|
|
|
indicatorColor: HexColor.fromHex(_model.providers[0].selectColor), |
|
|
|
indicatorColor: |
|
|
|
HexColor.fromHex(_model.providers[0].selectColor), |
|
|
|
indicatorSize: TabBarIndicatorSize.label, |
|
|
|
onTap: (index) { |
|
|
|
///变更平台 |
|
|
@@ -87,7 +116,7 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
height: 50, |
|
|
|
alignment: Alignment.center, |
|
|
|
child: ListView.builder( |
|
|
|
padding: EdgeInsets.only( left: 8), |
|
|
|
padding: EdgeInsets.only(left: 8), |
|
|
|
itemCount: _model.dateList.length, |
|
|
|
scrollDirection: Axis.horizontal, |
|
|
|
itemBuilder: _buildTimeItem, |
|
|
@@ -99,7 +128,11 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
height: 63, |
|
|
|
margin: EdgeInsets.only(top: 16, left: 15, right: 15), |
|
|
|
width: double.infinity, |
|
|
|
decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(_model.providerDashbord.finish.bgImg), fit: BoxFit.fill)), |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage( |
|
|
|
image: CachedNetworkImageProvider( |
|
|
|
_model.providerDashbord.finish.bgImg), |
|
|
|
fit: BoxFit.fill)), |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: <Widget>[ |
|
|
@@ -109,7 +142,10 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
child: Text( |
|
|
|
_model.providerDashbord.finish.text, |
|
|
|
style: TextStyle(fontSize: 14, color: HexColor.fromHex(_model.providerDashbord.finish.textColor)), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14, |
|
|
|
color: HexColor.fromHex(_model |
|
|
|
.providerDashbord.finish.textColor)), |
|
|
|
), |
|
|
|
), |
|
|
|
Row( |
|
|
@@ -123,7 +159,9 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
child: Padding( |
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: _model.providerDashbord.finish.tipIcon ?? "", |
|
|
|
imageUrl: |
|
|
|
_model.providerDashbord.finish.tipIcon ?? |
|
|
|
"", |
|
|
|
width: 10, |
|
|
|
height: 10, |
|
|
|
fit: BoxFit.fill, |
|
|
@@ -131,13 +169,19 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
), |
|
|
|
onTap: () { |
|
|
|
///显示弹窗 |
|
|
|
showTipDialog(null, _model.providerDashbord.finish.tipText); |
|
|
|
showTipDialog( |
|
|
|
null, _model.providerDashbord.finish.tipText); |
|
|
|
}) |
|
|
|
], |
|
|
|
), |
|
|
|
Text( |
|
|
|
_bloc.selectDateData.finish ?? "", |
|
|
|
style: TextStyle(color: Colors.red, fontSize: 20, fontFamily: 'Din', package: 'zhiying_base_widget', fontWeight: FontWeight.bold), |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.red, |
|
|
|
fontSize: 20, |
|
|
|
fontFamily: 'Din', |
|
|
|
package: 'zhiying_base_widget', |
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
@@ -149,7 +193,8 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
shrinkWrap: true, |
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
itemBuilder: (context, index) { |
|
|
|
return _buildBottomItem(context, index, _model.providerDashbord); |
|
|
|
return _buildBottomItem( |
|
|
|
context, index, _model.providerDashbord); |
|
|
|
}), |
|
|
|
) |
|
|
|
], |
|
|
@@ -165,7 +210,9 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
for (var item in _model.providers) { |
|
|
|
listWidget.add(Text( |
|
|
|
item.name, |
|
|
|
style: TextStyle(fontSize: 14, ), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14, |
|
|
|
), |
|
|
|
)); |
|
|
|
} |
|
|
|
return listWidget; |
|
|
@@ -177,14 +224,23 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(top: 0, left: 8, right: 8), |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage(image: CachedNetworkImageProvider(item.type == _bloc.selectDateData.type ? item.btnImg ?? "" : item.btnNoColorImg ?? ""), fit: BoxFit.fitWidth), |
|
|
|
image: DecorationImage( |
|
|
|
image: CachedNetworkImageProvider( |
|
|
|
item.type == _bloc.selectDateData.type |
|
|
|
? item.btnImg ?? "" |
|
|
|
: item.btnNoColorImg ?? ""), |
|
|
|
fit: BoxFit.fitWidth), |
|
|
|
), |
|
|
|
child: Padding( |
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
item.text, |
|
|
|
style: TextStyle(fontSize: 11, color: HexColor.fromHex(item.type == _bloc.selectDateData.type ? item.textSelectColor : item.textUnselectColor)), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11, |
|
|
|
color: HexColor.fromHex(item.type == _bloc.selectDateData.type |
|
|
|
? item.textSelectColor |
|
|
|
: item.textUnselectColor)), |
|
|
|
)), |
|
|
|
), |
|
|
|
), |
|
|
@@ -201,7 +257,8 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
} |
|
|
|
|
|
|
|
///底部显示 |
|
|
|
Widget _buildBottomItem(BuildContext context, int index, ProviderDashbord dashbord) { |
|
|
|
Widget _buildBottomItem( |
|
|
|
BuildContext context, int index, ProviderDashbord dashbord) { |
|
|
|
SelfBuy item; |
|
|
|
if (index == 0) { |
|
|
|
item = dashbord.selfBuy; |
|
|
@@ -223,7 +280,8 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
? Container() |
|
|
|
: Text( |
|
|
|
item.title, |
|
|
|
style: TextStyle(color: HexColor.fromHex(item.titleColor), fontSize: 14), |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex(item.titleColor), fontSize: 14), |
|
|
|
), |
|
|
|
SizedBox( |
|
|
|
height: 7.5, |
|
|
@@ -236,7 +294,11 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
height: 61.5, |
|
|
|
margin: EdgeInsets.only(right: 8, left: 15), |
|
|
|
padding: EdgeInsets.only(left: 10), |
|
|
|
decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(item.itemList[0].bgImg ?? ""), fit: BoxFit.fill)), |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage( |
|
|
|
image: CachedNetworkImageProvider( |
|
|
|
item.itemList[0].bgImg ?? ""), |
|
|
|
fit: BoxFit.fill)), |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
@@ -245,7 +307,10 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
children: <Widget>[ |
|
|
|
Text( |
|
|
|
item.itemList[0].text ?? "", |
|
|
|
style: TextStyle(fontSize: 11, color: HexColor.fromHex(item.itemList[0].textColor)), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11, |
|
|
|
color: HexColor.fromHex( |
|
|
|
item.itemList[0].textColor)), |
|
|
|
), |
|
|
|
InkWell( |
|
|
|
child: Padding( |
|
|
@@ -270,7 +335,8 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
package: 'zhiying_base_widget', |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
fontSize: 17, |
|
|
|
color: HexColor.fromHex(item.itemList[1].valueColor), |
|
|
|
color: |
|
|
|
HexColor.fromHex(item.itemList[1].valueColor), |
|
|
|
)) |
|
|
|
], |
|
|
|
)), |
|
|
@@ -278,9 +344,16 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
height: 61.5, |
|
|
|
margin: EdgeInsets.only(left: 8, right: 15,), |
|
|
|
margin: EdgeInsets.only( |
|
|
|
left: 8, |
|
|
|
right: 15, |
|
|
|
), |
|
|
|
padding: EdgeInsets.only(left: 10), |
|
|
|
decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(item.itemList[1].bgImg ?? ""), fit: BoxFit.fill)), |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage( |
|
|
|
image: CachedNetworkImageProvider( |
|
|
|
item.itemList[1].bgImg ?? ""), |
|
|
|
fit: BoxFit.fill)), |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
@@ -289,7 +362,10 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
children: <Widget>[ |
|
|
|
Text( |
|
|
|
item.itemList[1].text ?? "", |
|
|
|
style: TextStyle(fontSize: 11, color: HexColor.fromHex(item.itemList[1].textColor)), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11, |
|
|
|
color: |
|
|
|
HexColor.fromHex(item.itemList[1].textColor)), |
|
|
|
), |
|
|
|
InkWell( |
|
|
|
child: Padding( |
|
|
@@ -311,7 +387,11 @@ class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMix |
|
|
|
Text( |
|
|
|
dataMap[item.itemList[1].vauleKey], |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 17, color: HexColor.fromHex(item.itemList[1].valueColor), fontFamily: 'Din', package: 'zhiying_base_widget', fontWeight: FontWeight.bold), |
|
|
|
fontSize: 17, |
|
|
|
color: HexColor.fromHex(item.itemList[1].valueColor), |
|
|
|
fontFamily: 'Din', |
|
|
|
package: 'zhiying_base_widget', |
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|