
import 'package:flutter/material.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import 'package:zhiying_base_widget/widgets/team_details/month_data/team_details_month_data_widget.dart';
import 'package:zhiying_base_widget/widgets/team_details/referrer/team_details_referrer_widget.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_base_widget/widgets/team/fans_list/team_fans_item.dart';

///
/// 我的团队 - 用户详情
///
class TeamDetailsPage extends StatefulWidget {
  @override
  _TeamDetailsPageState createState() => _TeamDetailsPageState();
}

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

  TabController controller = TabController(length: 2, vsync: ScrollableState());

  /// 主视图
  Widget _getMainWidget(){
    return Scaffold(
      backgroundColor: HexColor.fromHex('#F9F9F9'),
      body: CustomScrollView(
        slivers: <Widget>[


          /// 头部Bar
          SliverAppBar(
            // expandedHeight: 200.0,
            leading: IconButton(
              icon: Icon(
                Icons.arrow_back_ios,
                size: 22,
                color: HexColor.fromHex('#333333'),
              ),
              onPressed: () => Navigator.maybePop(context),
            ),
            backgroundColor: Colors.white,
            floating: true,
            pinned: true,
            title: Text(
              '用户详情',
              style: TextStyle(color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold, fontSize: 18),
            ),
            centerTitle: true,
            elevation: 0,
          ),

          /// TA的推荐人
          SliverToBoxAdapter(
            child: TeamDetailsReferrerWidget(),
          ),

          /// 推荐人的信息
          SliverToBoxAdapter(
            child: TeamFansItem(null, null),
          ),

          /// 本月数据 & 上个月数据
          SliverToBoxAdapter(
            child: Container(
              height: 30,
              width: double.infinity,
              margin: const EdgeInsets.only(left: 50, right: 50, top: 10),
              child: TabBar(
                labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
                indicatorColor: HexColor.fromHex('#F94B47'),
                indicator: MaterialIndicator(
                  height: 2,
                  bottomRightRadius: 2,
                  bottomLeftRadius: 2,
                  topRightRadius: 2,
                  topLeftRadius: 2,
                  color: HexColor.fromHex('#F94B47'),
                  horizontalPadding: 17
                ),
                unselectedLabelStyle: TextStyle(fontSize: 15 ),
                indicatorSize: TabBarIndicatorSize.label,
                labelColor: HexColor.fromHex('#000000'),
                unselectedLabelColor: HexColor.fromHex('#999999'),
                controller: controller,
                tabs: <Widget>[
                  Text('本月数据'),
                  Text('上月数据'),
                ],
              ),
            ),
          ),

          /// 邀请贡献
          SliverToBoxAdapter(
            child: TeamDetailsMonthDataWidget(),
          ),

          SliverToBoxAdapter(
            child: TeamDetailsMonthDataWidget(),
          ),

          SliverToBoxAdapter(
            child: TeamDetailsMonthDataWidget(),
          ),

          SliverPadding(padding: const EdgeInsets.only(bottom: 28))

        ],
      ),
    );
  }

  /// 推荐人


  /// 推荐人的信息


  /// 本月数据 & 上个月数据

}
