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

///
/// 我的团队 - 数据widget
///
class TeamDataWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Material(
      child: _getMainWidget(),
    );
  }


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

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

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

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

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

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

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

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

              /// 昨日新增
              _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(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        /// Number
        Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          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))
      ],
    );
  }
}

