import 'package:flutter/material.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'dart:ui' as ui show  PlaceholderAlignment;

class TeamDetailsReferrerWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      decoration: BoxDecoration(
        color: HexColor.fromHex('#FFFFFF'),
        borderRadius: BorderRadius.circular(10),
      ),
      margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5),
      padding: const EdgeInsets.only(left: 9.5, right: 20, bottom: 10),
      child: Column(
        children: <Widget>[

          /// 推荐人图片
          _getLeftTopWidget(),

          const SizedBox(height: 15),

          /// 头像
          Padding(padding: const EdgeInsets.only(left: 11.5), child: _getFansInfoWidget()),
          const SizedBox(height: 10),

          /// 微信号码
          Padding(padding: const EdgeInsets.only(left: 11.5), child: _getWXNumberInfoWidget()),
        ],
      ),
    );
  }

  /// 推荐人左上角Icon
  Widget _getLeftTopWidget(){
    return Align(
      alignment: Alignment.topLeft,
      child: Transform.translate(
        offset: Offset(0, -5),
        child: Container(
          width: 80,
          height: 23.5,
          color: Colors.red,
        ),
      ),
    );
  }

  /// 粉丝头像信息等
  Widget _getFansInfoWidget() {
    return Row(
      children: <Widget>[
        /// 头像
        Container(width: 50, height: 50, color: Colors.red),
        const SizedBox(width: 10),

        /// 信息
        Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            /// 会员等级 关系 昵称
            RichText(
              textAlign: TextAlign.center,
              text: TextSpan(text: '', children: [
                /// 等级
                WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(width: 37, height: 13, color: Colors.red)),

                /// 会员关系
                WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(width: 13, height: 13, color: Colors.red, margin: const EdgeInsets.only(left: 3, right: 3))),

                /// 会员名称
                TextSpan(text: '温***哥', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 12, fontWeight: FontWeight.bold))
              ]),
            ),
            const SizedBox(height: 2.5),

            /// 手机号码
            RichText(
              textAlign: TextAlign.center,
              text: TextSpan(text: '', children: [
                /// 手机号码
                TextSpan(text: '手机号：', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 11)),
                TextSpan(text: '124****6124', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')),

                /// 复制按钮
                WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(width: 11, height: 11, color: Colors.red, margin: const EdgeInsets.only(left: 3)))
              ]),
            ),
          ],
        )
      ],
    );
  }

  /// 微信号码信息
  Widget _getWXNumberInfoWidget() {
    return Container(
      padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5),
      decoration: BoxDecoration(
        color: HexColor.fromHex('#F7F7F7'),
        borderRadius: BorderRadius.circular(5),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          /// 微信号码
          RichText(
            textAlign: TextAlign.center,
            text: TextSpan(text: '', children: [
              TextSpan(text: '微信号:', style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11, fontWeight: FontWeight.bold)),
              TextSpan(
                  text: '54A78',
                  style: TextStyle(fontWeight: FontWeight.bold, color: HexColor.fromHex('#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')),
              WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(margin: const EdgeInsets.only(left: 5.5), color: Colors.red, width: 11, height: 11))
            ]),
          ),

          /// 最近登陆时间
          Text('最近登陆 2019-06-28', style: TextStyle(color: HexColor.fromHex('#909090'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget'))
        ],
      ),
    );
  }
}
