import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/widgets/wallet/wallet_data/model/wallet_header_model.dart'; import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data_sk.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class WalletData extends StatelessWidget { final Map data; const WalletData(this.data, {Key key}) : super(key: key); @override Widget build(BuildContext context) { print(data); Map temp = json.decode(data['data']); var model = WalletHeaderModel.fromJson(temp); return Container( width: double.infinity, child: data == null ? WalletDataSkeleton() : Container( margin: EdgeInsets.only(left: 12.5, right: 12.5,top: 10), padding: EdgeInsets.only(left: 36.w, right: 26.w), decoration: BoxDecoration( image: DecorationImage( image: CachedNetworkImageProvider(model.headerImg),fit: BoxFit.fill)), height: 290.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ CachedNetworkImage( imageUrl: model.headerAvatar, height: 66.h, width: 52.w, ), Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( model.headerCashOutText, style: TextStyle( fontSize: 25.sp, color: HexColor.fromHex( model.headerCashOutTextColor)), ), Text( "没数据", style: TextStyle( fontSize: 25.sp, color: HexColor.fromHex( model.headerCashOutTextColor)), ), ], ), ) ], ), GestureDetector( child: Container( decoration: BoxDecoration( color: Colors.red, borderRadius: BorderRadius.circular(10), image: DecorationImage( image: CachedNetworkImageProvider(""), fit: BoxFit.fill)), child: Padding( padding: EdgeInsets.only( left: 29.w, right: 29.w, top: 20.w, bottom: 20.w), child: Text( "提现", style: TextStyle(color: Colors.white), ), ), ), ) ], ), Divider( height: 1, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: _buildTopListItem(model?.headerBottomList)) ], ), ), ); } ///构建顶部Item _buildTopListItem(List list) { List listWidget = List(); for (var item in list) { listWidget.add(Column( mainAxisSize: MainAxisSize.min, children: [ Text( "9999", style: TextStyle(color: Colors.red, fontSize: 30.sp), ), Text( "累计到账(元)", style: TextStyle(color: Colors.grey, fontSize: 22.sp), ), ], )); } return listWidget; } }