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

184 lines
7.2 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_base_widget/pages/team_page/model/team_data_model.dart';
  3. import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart';
  4. import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart';
  5. import 'package:zhiying_comm/zhiying_comm.dart';
  6. import 'dart:ui' as ui show PlaceholderAlignment;
  7. import 'package:cached_network_image/cached_network_image.dart';
  8. ///
  9. /// 我的团队 - 数据widget
  10. ///
  11. class TeamDataWidget extends StatelessWidget {
  12. TeamStyleModel styleModel;
  13. TeamDataModel dataModel;
  14. TeamDataWidget(this.styleModel, this.dataModel);
  15. @override
  16. Widget build(BuildContext context) {
  17. return Material(
  18. child: _getMainWidget(),
  19. );
  20. }
  21. /// 主视图
  22. Widget _getMainWidget() {
  23. return Container(
  24. width: double.infinity,
  25. margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8),
  26. padding: const EdgeInsets.only(left: 10.5, right: 9.5, top: 8, bottom: 8),
  27. decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor.fromHex('#FFFFFF')),
  28. child: Column(
  29. mainAxisAlignment: MainAxisAlignment.center,
  30. crossAxisAlignment: CrossAxisAlignment.center,
  31. children: <Widget>[
  32. /// 直推人数 & 间推人数
  33. Row(
  34. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  35. crossAxisAlignment: CrossAxisAlignment.end,
  36. children: <Widget>[
  37. /// 直推人数
  38. _getCustomWidget(
  39. text: styleModel?.dashbordRowFirst[0]?.name ?? '直推人数',
  40. textColor: styleModel?.dashbordRowFirst[0]?.nameColor ?? '#999999',
  41. textSize: 12,
  42. number: dataModel?.direct_fans_count ?? '0',
  43. numberColor: styleModel?.dashbordRowFirst[0]?.valueColor ?? '#333333',
  44. numberSize: 30,
  45. icon: styleModel?.dashbordRowFirst[0]?.upIcon ?? '',
  46. ),
  47. /// 分割线
  48. // VerticalDivider(width: 0.5, thickness: 40, color: HexColor.fromHex('#F0F0F0')),
  49. SizedBox(
  50. height: 40,
  51. child: VerticalDivider(
  52. thickness: 0.5,
  53. color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0'),
  54. width: 0.5,
  55. )),
  56. /// 间推人数
  57. _getCustomWidget(
  58. text: styleModel?.dashbordRowFirst[1]?.name ?? '间推人数',
  59. textColor: styleModel?.dashbordRowFirst[1]?.nameColor ?? '#999999',
  60. textSize: 12,
  61. number: dataModel?.indirect_fans_count ?? '0',
  62. numberColor: styleModel?.dashbordRowFirst[1]?.valueColor ?? '#333333',
  63. numberSize: 30,
  64. icon: styleModel?.dashbordRowFirst[1].upIcon,
  65. ),
  66. ],
  67. ),
  68. /// 分割线
  69. Divider(thickness: 0.5, height: 20, color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0')),
  70. /// 全部粉丝 & 今日新增 & 昨日新增
  71. Row(
  72. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  73. children: <Widget>[
  74. /// 全部粉丝
  75. _getCustomWidget(
  76. text: styleModel?.dashbordRowSecond[0]?.name ?? '全部粉丝',
  77. textColor: styleModel?.dashbordRowSecond[0].name_color ?? '#999999',
  78. textSize: 11,
  79. number: dataModel?.all_fans ?? '0',
  80. numberColor: styleModel?.dashbordRowSecond[0]?.value_color ?? '#333333',
  81. numberSize: 15,
  82. ),
  83. /// 分割线
  84. // VerticalDivider(thickness: 0.5, width: 1, color: HexColor.fromHex('#F0F0F0')),
  85. SizedBox(
  86. height: 35,
  87. child: VerticalDivider(
  88. thickness: 0.5,
  89. color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0'),
  90. width: 0.5,
  91. )),
  92. /// 今日新增
  93. _getCustomWidget(
  94. text: styleModel?.dashbordRowSecond[1]?.name ?? '今日新增',
  95. textColor: styleModel?.dashbordRowSecond[1].name_color ?? '#999999',
  96. textSize: 11,
  97. number: dataModel?.today_add ?? '0',
  98. numberColor: styleModel?.dashbordRowSecond[1]?.value_color ?? '#333333',
  99. numberSize: 15,
  100. ),
  101. /// 分割线
  102. // VerticalDivider(thickness: 0.5, width: 1, color: HexColor.fromHex('#F0F0F0')),
  103. SizedBox(
  104. height: 35,
  105. child: VerticalDivider(
  106. thickness: 0.5,
  107. color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0'),
  108. width: 0.5,
  109. )),
  110. /// 昨日新增
  111. _getCustomWidget(
  112. text: styleModel?.dashbordRowSecond[2]?.name ?? '昨日新增',
  113. textColor: styleModel?.dashbordRowSecond[2].name_color ?? '#999999',
  114. textSize: 11,
  115. number: dataModel?.yesterday_add ?? '0',
  116. numberColor: styleModel?.dashbordRowSecond[2]?.value_color ?? '#333333',
  117. numberSize: 15,
  118. ),
  119. ],
  120. )
  121. ],
  122. ),
  123. );
  124. }
  125. /// 自定义Widget
  126. Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) {
  127. return Column(
  128. mainAxisAlignment: MainAxisAlignment.center,
  129. crossAxisAlignment: CrossAxisAlignment.center,
  130. children: <Widget>[
  131. /// Number
  132. Row(
  133. crossAxisAlignment: CrossAxisAlignment.center,
  134. mainAxisAlignment: MainAxisAlignment.center,
  135. children: <Widget>[
  136. /// nummber\
  137. Text(number,
  138. style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_base_widget')),
  139. /// icon
  140. Visibility(
  141. visible: !EmptyUtil.isEmpty(icon),
  142. child: Align(alignment: Alignment.topLeft, child: Container(width: 5, child: CachedNetworkImage(imageUrl: icon ?? ''), margin: const EdgeInsets.only(left: 3))))
  143. ],
  144. ),
  145. // RichText(
  146. // textAlign: TextAlign.center,
  147. // text: TextSpan(
  148. // children: [
  149. // TextSpan(
  150. // text: number,
  151. // style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_base_widget'),
  152. // ),
  153. // WidgetSpan(
  154. // alignment: ui.PlaceholderAlignment.top,
  155. // child: Visibility(
  156. // visible: !EmptyUtil.isEmpty(icon), child: Align(alignment: Alignment.topLeft, child: Container(height: 7, width: 5, color: Colors.red, margin: const EdgeInsets.only(left: 3)))
  157. // )
  158. // )
  159. // ]
  160. // ),
  161. // ),
  162. /// Text
  163. Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize))
  164. ],
  165. );
  166. }
  167. }