基础组件库
 
 
 
 
 

205 line
5.4 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/zhiying_comm.dart';
  3. ///
  4. /// 我的团队 - 我的推荐人
  5. ///
  6. class TeamRecommendWidget extends StatefulWidget {
  7. final Map<String, dynamic> data;
  8. const TeamRecommendWidget(this.data);
  9. @override
  10. _TeamRecommendWidgetState createState() => _TeamRecommendWidgetState();
  11. }
  12. class _TeamRecommendWidgetState extends State<TeamRecommendWidget> {
  13. @override
  14. Widget build(BuildContext context) {
  15. return Container();
  16. }
  17. /// 按钮点击事件
  18. void _onClickListener() {}
  19. /// 主体Widget
  20. Widget _getMainWidget() {
  21. return Container(
  22. decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white),
  23. child: Column(
  24. children: <Widget>[
  25. /// 左上角的Icon
  26. /// 数据视图
  27. ],
  28. ),
  29. );
  30. }
  31. /// 我的推荐人IconWidget(左上角的ICON)
  32. Widget _getLeftTopWidget() {
  33. return Container(width: 73.5, height: 23.5, color: Colors.red);
  34. }
  35. /// 输入框
  36. Widget _getInputWidget() {
  37. return Container(
  38. decoration: BoxDecoration(
  39. borderRadius: BorderRadius.circular(30),
  40. color: HexColor.fromHex('#F7F7F7'),
  41. ),
  42. child: Column(
  43. children: <Widget>[
  44. /// 输入框
  45. Row(
  46. children: <Widget>[
  47. /// 输入框
  48. Expanded(
  49. child: TextField(
  50. decoration: InputDecoration(
  51. border: InputBorder.none,
  52. focusedBorder: InputBorder.none,
  53. focusedErrorBorder: InputBorder.none,
  54. errorBorder: InputBorder.none,
  55. disabledBorder: InputBorder.none,
  56. enabledBorder: InputBorder.none,
  57. filled: true,
  58. fillColor: Colors.transparent),
  59. ),
  60. ),
  61. /// 按钮
  62. _getAddButtomWidget(),
  63. ],
  64. ),
  65. const SizedBox(height: 10.5),
  66. /// 文字提示
  67. Text('还没有填写邀请人ID,填写后双方都可以获得奖励', style: TextStyle(color: HexColor.fromHex('#909090'), fontSize: 11)),
  68. ],
  69. ),
  70. );
  71. }
  72. /// 添加的按钮
  73. Widget _getAddButtomWidget() {
  74. return Material(
  75. child: Container(
  76. height: 24,
  77. width: double.infinity,
  78. color: Colors.white,
  79. child: RaisedButton(
  80. child: Text('添加', style: TextStyle(fontSize: 13)),
  81. textColor: HexColor.fromHex('#FFFFFF'),
  82. color: HexColor.fromHex('#F94B47'),
  83. disabledColor: HexColor.fromHex('#F94B47'),
  84. disabledTextColor: HexColor.fromHex('#FFFFFF'),
  85. elevation: 5,
  86. shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24 / 2)),
  87. onPressed: () => _onClickListener(),
  88. ),
  89. ),
  90. );
  91. }
  92. /// 数据视图
  93. Widget _getDataWidget() {
  94. return Row(
  95. children: <Widget>[
  96. /// 头像widget
  97. _getAvatarWidget(),
  98. const SizedBox(width: 12),
  99. /// 数据
  100. _getDataRightWidget(),
  101. ],
  102. );
  103. }
  104. /// 头像widget
  105. Widget _getAvatarWidget() {
  106. return Container(
  107. width: 55,
  108. height: 55,
  109. color: Colors.red,
  110. );
  111. }
  112. /// 数据右边视图,头像右边的widget
  113. Widget _getDataRightWidget() {
  114. return Column(
  115. children: <Widget>[
  116. /// 昵称
  117. _getNickNameWidget(),
  118. /// 手机号
  119. _getPhoneNumberWidget(),
  120. /// 微信号
  121. _getWXWidget()
  122. ],
  123. );
  124. }
  125. /// 昵称
  126. Widget _getNickNameWidget() {
  127. return Row(
  128. children: <Widget>[
  129. /// 昵称
  130. Text('毛毛虫', style: TextStyle(fontSize: 14, color: HexColor.fromHex('#000000'), fontWeight: FontWeight.bold)),
  131. const SizedBox(width: 6),
  132. Text('邀请码:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'))),
  133. Text('123456', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'))),
  134. ],
  135. );
  136. }
  137. /// 手机号
  138. Widget _getPhoneNumberWidget() {
  139. return Row(
  140. children: <Widget>[
  141. Text('手机号:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))),
  142. Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))),
  143. const SizedBox(width: 6),
  144. /// 拷贝按钮
  145. _getCustomCopyWidget(),
  146. ],
  147. );
  148. }
  149. /// 微信号
  150. Widget _getWXWidget() {
  151. return Row(
  152. children: <Widget>[
  153. Text('微信号:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))),
  154. Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))),
  155. const SizedBox(width: 6),
  156. /// 拷贝按钮
  157. _getCustomCopyWidget(),
  158. ],
  159. );
  160. }
  161. /// 自定义复制按钮的Widget
  162. Widget _getCustomCopyWidget() {
  163. return Container(
  164. padding: const EdgeInsets.only(left: 4, bottom: 2, top: 2, right: 6),
  165. decoration: BoxDecoration(
  166. color: HexColor.fromHex('#FFF2F2'),
  167. borderRadius: BorderRadius.circular(30),
  168. ),
  169. child: Row(
  170. crossAxisAlignment: CrossAxisAlignment.center,
  171. children: <Widget>[
  172. Container(width: 11, height: 11, color: Colors.red),
  173. const SizedBox(width: 4.5),
  174. Text('复制', style: TextStyle(fontSize: 8, color: HexColor.fromHex('#F94B47')))
  175. ],
  176. ),
  177. );
  178. }
  179. }