import 'package:flutter/material.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

///
/// 我的团队 - 数据widget
///
class TeamDataWidget extends StatefulWidget {
  @override
  _TeamDataWidgetState createState() => _TeamDataWidgetState();
}

class _TeamDataWidgetState extends State<TeamDataWidget> {
  @override
  Widget build(BuildContext context) {
    return _getMainWidget();
  }

  /// 主视图
  Widget _getMainWidget() {
    return Container(
      margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8),
      padding: const EdgeInsets.only(left: 10.5, right: 9.5),
      decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor.fromHex('#FFFFFF')),
      child: Column(
        children: <Widget>[
          /// 直推人数 & 间推人数
          Row(
            children: <Widget>[
              /// 直推人数
              _getCustomWidget(text: '直推人数', textColor: '#999999', textSize: 12, number: '2258', numberColor: '#333333', numberSize: 30, icon: 'sss'),

              /// 分割线
              VerticalDivider(width: 40, thickness: 0.5, color: HexColor.fromHex('#F0F0F0')),

              /// 间推人数
              _getCustomWidget(text: '间推人数', textColor: '#999999', textSize: 12, number: '469', numberColor: '#333333', numberSize: 30, icon: 'sss'),
            ],
          ),

          /// 分割线
          Divider(thickness: 0.5, height: double.infinity, color: HexColor.fromHex('#F0F0F0')),

          /// 全部粉丝 & 今日新增 & 昨日新增
          Row(
            children: <Widget>[
              /// 全部粉丝
              _getCustomWidget(
                text: '全部粉丝',
                textColor: '#999999',
                textSize: 11,
                number: '2258',
                numberColor: '#333333',
                numberSize: 15,
              ),

              /// 分割线
              VerticalDivider(thickness: 0.5, width: 35, color: HexColor.fromHex('#F0F0F0')),

              /// 今日新增
              _getCustomWidget(
                text: '今日新增',
                textColor: '#999999',
                textSize: 11,
                number: '4',
                numberColor: '#333333',
                numberSize: 15,
              ),

              /// 分割线
              VerticalDivider(thickness: 0.5, width: 35, color: HexColor.fromHex('#F0F0F0')),

              /// 昨日新增
              _getCustomWidget(
                text: '昨日新增',
                textColor: '#999999',
                textSize: 11,
                number: '12',
                numberColor: '#333333',
                numberSize: 15,
              ),
            ],
          )
        ],
      ),
    );
  }

  /// 自定义Widget
  Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) {
    return Column(
      children: <Widget>[
        /// Number
        Row(
          children: <Widget>[
            /// nummber\
            Text(number,
                style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_base_widget')),
            const SizedBox(width: 3),

            /// icon
            Visibility(visible: !EmptyUtil.isEmpty(icon), child: Container(height: 7, width: 5, color: Colors.red))
          ],
        ),

        /// Text
        Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize))
      ],
    );
  }
}