基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

124 lines
4.7 KiB

  1. import 'dart:convert';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:zhiying_base_widget/widgets/wallet/wallet_data/model/wallet_header_model.dart';
  5. import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data_sk.dart';
  6. import 'package:cached_network_image/cached_network_image.dart';
  7. import 'package:zhiying_comm/zhiying_comm.dart';
  8. class WalletData extends StatelessWidget {
  9. final Map<String, dynamic> data;
  10. const WalletData(this.data, {Key key}) : super(key: key);
  11. @override
  12. Widget build(BuildContext context) {
  13. print(data);
  14. Map<String, dynamic> temp = json.decode(data['data']);
  15. var model = WalletHeaderModel.fromJson(temp);
  16. return Container(
  17. width: double.infinity,
  18. child: data == null
  19. ? WalletDataSkeleton()
  20. : Container(
  21. margin: EdgeInsets.only(left: 12.5, right: 12.5,top: 10),
  22. padding: EdgeInsets.only(left: 36.w, right: 26.w),
  23. decoration: BoxDecoration(
  24. image: DecorationImage(
  25. image: CachedNetworkImageProvider(model.headerImg),fit: BoxFit.fill)),
  26. height: 290.h,
  27. child: Column(
  28. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  29. children: <Widget>[
  30. Row(
  31. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  32. children: <Widget>[
  33. Row(
  34. children: <Widget>[
  35. CachedNetworkImage(
  36. imageUrl: model.headerAvatar,
  37. height: 66.h,
  38. width: 52.w,
  39. ),
  40. Padding(
  41. padding: const EdgeInsets.all(8.0),
  42. child: Column(
  43. crossAxisAlignment: CrossAxisAlignment.start,
  44. children: <Widget>[
  45. Text(
  46. model.headerCashOutText,
  47. style: TextStyle(
  48. fontSize: 25.sp,
  49. color: HexColor.fromHex(
  50. model.headerCashOutTextColor)),
  51. ),
  52. Text(
  53. "没数据",
  54. style: TextStyle(
  55. fontSize: 25.sp,
  56. color: HexColor.fromHex(
  57. model.headerCashOutTextColor)),
  58. ),
  59. ],
  60. ),
  61. )
  62. ],
  63. ),
  64. GestureDetector(
  65. child: Container(
  66. decoration: BoxDecoration(
  67. color: Colors.red,
  68. borderRadius: BorderRadius.circular(10),
  69. image: DecorationImage(
  70. image: CachedNetworkImageProvider(""),
  71. fit: BoxFit.fill)),
  72. child: Padding(
  73. padding: EdgeInsets.only(
  74. left: 29.w,
  75. right: 29.w,
  76. top: 20.w,
  77. bottom: 20.w),
  78. child: Text(
  79. "提现",
  80. style: TextStyle(color: Colors.white),
  81. ),
  82. ),
  83. ),
  84. )
  85. ],
  86. ),
  87. Divider(
  88. height: 1,
  89. ),
  90. Row(
  91. mainAxisAlignment: MainAxisAlignment.spaceAround,
  92. children: _buildTopListItem(model?.headerBottomList))
  93. ],
  94. ),
  95. ),
  96. );
  97. }
  98. ///构建顶部Item
  99. _buildTopListItem(List<HeaderBottomList> list) {
  100. List<Widget> listWidget = List();
  101. for (var item in list) {
  102. listWidget.add(Column(
  103. mainAxisSize: MainAxisSize.min,
  104. children: <Widget>[
  105. Text(
  106. "9999",
  107. style: TextStyle(color: Colors.red, fontSize: 30.sp),
  108. ),
  109. Text(
  110. "累计到账(元)",
  111. style: TextStyle(color: Colors.grey, fontSize: 22.sp),
  112. ),
  113. ],
  114. ));
  115. }
  116. return listWidget;
  117. }
  118. }