import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sport/bean/rank_game_info.dart';
import 'package:sport/widgets/appbar.dart';
import 'package:sport/widgets/space.dart';

class RankIntroduce extends StatefulWidget {
  RankGameInfoData data;
  RankIntroduce(this.data);
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _RankIntroduceState();
  }
}

class _RankIntroduceState extends State<RankIntroduce> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
        body: CustomScrollView(slivers: <Widget>[
          buildSliverAppBar(context, "榜单说明",),
          SliverToBoxAdapter(
              child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 20),
                child: Column(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 4.0),
                      child: Row(
                        children: <Widget>[
                          Text("榜单名称：",style: Theme.of(context).textTheme.subtitle1),
                          Expanded(
                            child: Text("${widget.data.rank.name}",style: Theme.of(context).textTheme.bodyText2.copyWith(color: Color(0xff666666))
                            ),
                          )
                        ],
                      ),
                    ),
                    Divider(),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("榜单说明：",style: Theme.of(context).textTheme.subtitle1),
                          Expanded(child: Text("${widget.data.rank.introduceDetail}",style: Theme.of(context).textTheme.bodyText2))
                        ],
                      ),
                    ),
                    Divider(),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("标语：",style: Theme.of(context).textTheme.subtitle1),
                          Expanded(
                            child: Text("${widget.data.rank.slogan}",style: Theme.of(context).textTheme.bodyText2),
                          )
                        ],
                      ),
                    ),
                    Divider(),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("评定规则：",style: Theme.of(context).textTheme.subtitle1),
                          Expanded(
                            child: Text("${widget.data.rank.rule}",style: Theme.of(context).textTheme.bodyText2),
                          )
                        ],
                      ),
                    ),
                    Divider(),
                    Padding(
                        padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
                        child: Row(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Text("奖励明细：",style: Theme.of(context).textTheme.subtitle1),
                            Expanded(
                              child: Column(
                                children: widget.data.rank.reward.map((e) =>   Column(children: <Widget>[Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: <Widget>[
                                  Text("第${e.begin}-${e.end}名",style: Theme.of(context).textTheme.bodyText2),
                                  Text("+${e.score} 积分",style: Theme.of(context).textTheme.subtitle1
                                      .copyWith(color: Theme.of(context).accentColor))
                                ],), Space(height: 3.0,),],)).toList(),
                              ),
                            )
                          ],
                        )
                    ),
                    Divider(),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
                      child:  Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("奖励发放：",style: Theme.of(context).textTheme.subtitle1),
                          Expanded(
                            child: Text("${widget.data.rank.distribute}",style: Theme.of(context).textTheme.bodyText2),
                          )
                        ],
                      ),
                    ),
                  ],
                ),
              )
          )
        ]));
  }
}

