基础组件库
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.

wallet_detail.dart 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import 'dart:convert';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:zhiying_base_widget/pages/withdraw_page/withdraw_page.dart';
  5. import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart';
  6. import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/model/wallet_detail_model.dart';
  7. import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_sk.dart';
  8. import 'package:flutter_screenutil/flutter_screenutil.dart';
  9. import 'package:cached_network_image/cached_network_image.dart';
  10. import 'package:zhiying_comm/zhiying_comm.dart';
  11. class WalletDetail extends StatefulWidget {
  12. final Map<String, dynamic> data;
  13. const WalletDetail(
  14. this.data, {
  15. Key key,
  16. }) : super(key: key);
  17. @override
  18. _WalletDetailState createState() => _WalletDetailState();
  19. }
  20. class _WalletDetailState extends State<WalletDetail>
  21. with TickerProviderStateMixin {
  22. WalletDetailModel _model;
  23. TabController _tabController;
  24. @override
  25. void initState() {
  26. if (widget.data != null) {
  27. _model = WalletDetailModel.fromJson(json.decode(widget.data['data']));
  28. _tabController =
  29. TabController(length: _model.providers.length, vsync: this);
  30. }
  31. super.initState();
  32. }
  33. @override
  34. Widget build(BuildContext context) {
  35. return Container(
  36. margin: EdgeInsets.only(left: 12.5, right: 12.5),
  37. child: Column(
  38. children: <Widget>[
  39. Container(
  40. child: TabBar(
  41. // isScrollable: true,
  42. controller: _tabController,
  43. tabs: _buildTabs()),
  44. ),
  45. Container(
  46. height: 75.h,
  47. child: ListView.builder(
  48. padding: EdgeInsets.only(top: 16),
  49. itemCount: _model.dateList.length,
  50. scrollDirection: Axis.horizontal,
  51. itemBuilder: _buildTimeItem),
  52. ),
  53. Container(
  54. height: 126.h,
  55. margin: EdgeInsets.only(top: 16),
  56. width: double.infinity,
  57. decoration: BoxDecoration(
  58. image: DecorationImage(
  59. image: CachedNetworkImageProvider(
  60. _model.providerDashbord.finish.bgImg),
  61. fit: BoxFit.fill)),
  62. child: Column(
  63. mainAxisAlignment: MainAxisAlignment.center,
  64. children: <Widget>[
  65. Row(
  66. mainAxisAlignment: MainAxisAlignment.center,
  67. children: <Widget>[
  68. Text(
  69. "已结算",
  70. style: TextStyle(color: Colors.black, fontSize: 22.sp),
  71. ),
  72. InkWell(
  73. child: Padding(
  74. padding: const EdgeInsets.all(8.0),
  75. child: CachedNetworkImage(
  76. imageUrl: "",
  77. width: 20.h,
  78. height: 20.h,
  79. fit: BoxFit.fill,
  80. ),
  81. ),
  82. onTap: () {
  83. ///问好
  84. })
  85. ],
  86. ),
  87. Text(
  88. "158",
  89. style: TextStyle(color: Colors.red, fontSize: 40.sp),
  90. )
  91. ],
  92. ),
  93. ),
  94. Container(
  95. child: ListView.builder(
  96. itemCount: 3,
  97. shrinkWrap: true,
  98. physics: NeverScrollableScrollPhysics(),
  99. itemBuilder: (context, index) {
  100. return _buildBottomItem(
  101. context, index, _model.providerDashbord);
  102. }),
  103. )
  104. ],
  105. ),
  106. );
  107. }
  108. _buildTabs() {
  109. List<Widget> listWidget = List();
  110. for (var item in _model.providers) {
  111. listWidget.add(Tab(
  112. child: Text(
  113. item.name,
  114. style: TextStyle(color: Colors.grey),
  115. ),
  116. ));
  117. }
  118. return listWidget;
  119. }
  120. Widget _buildTimeItem(BuildContext context, int index) {
  121. var item = _model.dateList[index];
  122. return Container(
  123. margin: EdgeInsets.only(top: 0, left: 8, right: 8),
  124. decoration: BoxDecoration(
  125. color: Colors.grey[200], borderRadius: BorderRadius.circular(50)),
  126. child: Padding(
  127. padding: const EdgeInsets.only(left: 16, right: 16),
  128. child: Center(
  129. child: Text(
  130. item.text,
  131. style: TextStyle(color: Colors.grey),
  132. )),
  133. ),
  134. );
  135. }
  136. Widget _buildBottomItem(
  137. BuildContext context, int index, ProviderDashbord dashbord) {
  138. var item = dashbord.selfBuy;
  139. return Container(
  140. child: Column(
  141. children: <Widget>[
  142. Text(
  143. item.title,
  144. style: TextStyle(color: HexColor.fromHex(item.titleColor)),
  145. ),
  146. Row(
  147. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  148. children: <Widget>[
  149. Expanded(
  150. child: Container(
  151. height: 123.h,
  152. margin: EdgeInsets.only(right: 8),
  153. decoration: BoxDecoration(
  154. image: DecorationImage(
  155. image: CachedNetworkImageProvider(item.leftBgImg),
  156. fit: BoxFit.fill)),
  157. child: Center(child: Text("ddd")),
  158. ),
  159. ),
  160. Expanded(
  161. child: Container(
  162. height: 123.h,
  163. margin: EdgeInsets.only(left: 8),
  164. decoration: BoxDecoration(
  165. image: DecorationImage(
  166. image: CachedNetworkImageProvider(item.rightBgImg))),
  167. child: Center(child: Text("dddd")),
  168. ))
  169. ],
  170. )
  171. ],
  172. ),
  173. );
  174. }
  175. }