| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- import 'dart:io';
- import 'package:flutter/material.dart';
- import 'package:flutter_swiper/flutter_swiper.dart';
- import 'package:wanna_battle/model/HouseInfo.dart';
- import '../widget/LinearButton.dart';
- //竞赛须知
- class CompetitionInformation extends StatefulWidget {
- HouseInfo houseInfo;
- CompetitionInformation({this.houseInfo});
- @override
- CompetitionInformationState createState() => CompetitionInformationState();
- }
- class CompetitionInformationState extends State<CompetitionInformation> {
- int nowSwiperIndex = 0;
- SwiperController _swiperController;
- @override
- void initState() {
- super.initState();
- _swiperController = SwiperController();
- }
- @override
- Widget build(BuildContext context) {
- return WillPopScope(
- child: Scaffold(
- backgroundColor: Colors.black87,
- body: Container(
- child: Center(
- child: Swiper(
- controller: _swiperController,
- layout: SwiperLayout.DEFAULT,
- itemWidth: 270.0,
- itemHeight: 422.0,
- control: SwiperControl(color: Theme.of(context).primaryColor, disableColor: Colors.transparent),
- index: nowSwiperIndex,
- itemCount: 1,
- scrollDirection: Axis.horizontal,
- loop: false,
- itemBuilder: (context, index) {
- return InfoBox(
- killNum: widget.houseInfo.killnumber,
- typeIndex: index + 1,
- next: () {
- _swiperController.next();
- },
- end: () {
- Navigator.of(context).pop();
- });
- }))),
- ),
- onWillPop: () {
- return Future.value(false);
- },
- );
- }
- }
- typedef OnTapHomeMenu = void Function();
- class InfoBox extends StatelessWidget {
- InfoBox({Key key, this.typeIndex, this.next, this.end, this.killNum}) : super(key: key);
- final int typeIndex;
- final OnTapHomeMenu next;
- final OnTapHomeMenu end;
- final int killNum;
- @override
- Widget build(BuildContext context) {
- return UnconstrainedBox(
- child: Container(
- width: 270,
- height: 422,
- decoration: BoxDecoration(border: Border.all(width: 1, color: Theme.of(context).primaryColor), color: Colors.black),
- child: Stack(
- children: <Widget>[
- Container(
- width: 270,
- padding: EdgeInsets.only(top: 25),
- child: Column(
- children: <Widget>[
- Text('注意啦!', style: TextStyle(color: Color(0xFFD4504B), fontSize: 20, fontWeight: FontWeight.w600)),
- Container(height: 10,),
- Text(
- '本次任务:游戏中最短时间内杀戮${killNum}人',
- style: TextStyle(color: Color(0xFFFFB726), fontSize: 13, fontWeight: FontWeight.w500),
- ),
- _centerContent(typeIndex, context)
- ],
- ),
- ),
- Positioned(
- top: 0,
- left: 0,
- child: Image.asset(
- 'images/tancuang_shang.png',
- // width: 131,
- ),
- ),
- Positioned(
- top:-72,
- left: 16,
- child: Image.asset(
- 'images/img_guangmang.png',
- // width: 148,
- ),
- ),
- Positioned(
- bottom: 0,
- right: 4,
- child: Image.asset(
- 'images/tancuang_xia.png',
- // width: 148,
- ),
- ),
- Positioned(
- bottom:0,
- left: 25,
- child: Column(
- children: <Widget>[
- Container(
- width: 220,
- height: 36,
- child: LinearButton(
- btntext: typeIndex != 1 ? '下一个' : '知道了',
- onTapHomeMenu: typeIndex != 1 ? next : end,
- )
- // RaisedButton(
- // textColor: Colors.white,
- // child: Text(typeIndex != 4 ? '下一个' : '结束'),
- // onPressed: typeIndex != 4 ? next : end,
- // ),
- ),
- typeIndex != 1
- ? FlatButton(
- textColor: Color(0xFF727785),
- highlightColor: Colors.transparent,
- splashColor: Colors.transparent,
- child: Text('关闭'),
- onPressed: () {
- end();
- },
- )
- : Container(
- width: 10,
- height: 43,
- )
- ],
- ),
- )
- ],
- ),
- ));
- }
- // 第一名获得${houseInfo.houseLevel.firstRatio}%,第二名获得${houseInfo.houseLevel.secondRatio}%,第三名获得${houseInfo.houseLevel.thirdRatio}%
- Widget _centerContent(int index, BuildContext context) {
- Widget useContent = Container();
- TextStyle _text = TextStyle(color: Colors.white, fontSize: 14);
- // if (index == 1) {
- // useContent = Container(
- // margin: EdgeInsets.only(top: 20),
- // padding: EdgeInsets.symmetric(horizontal: 20),
- // child: Column(
- // crossAxisAlignment: CrossAxisAlignment.start,
- // children: <Widget>[
- // Text(
- // '吃鸡模式',
- // style: TextStyle(color: Color(0xFFFFB726)),
- // ),
- // Text('胜利条件:只要在游戏中成功吃鸡,即可获得一枚铂金奖牌,没有吃鸡即算做失败', style: TextStyle(color: Colors.white)),
- // Container(
- // height: 15,
- // ),
- // Text('评分模式', style: TextStyle(color: Color(0xFFFFB726))),
- // Text('胜利条件:不管游戏最终是否吃鸡,按游戏最终显示评分数值进行排序,评分相同用时短者优胜,前三名分别获得金银铜奖牌,其它人算做失败', style: TextStyle(color: Colors.white))
- // ],
- // ),
- // );
- // } else
- // if (index == 1) {
- // useContent = Container(
- // margin: EdgeInsets.only(top: 20),
- // padding: EdgeInsets.symmetric(horizontal: 20),
- // child: Column(
- // children: <Widget>[
- // Image.asset('images/img_xuzhi_02.png', width: 136),
- // Container(
- // height: 10,
- // ),
- // Text.rich(
- // TextSpan(children: [
- // TextSpan(
- // text: '竞赛开始前请在此耐心等待,在开始时会有上图所示弹窗,',
- // style: _text,
- // ),
- // TextSpan(
- // text: '玩家必须在10秒内点击确认',
- // style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w500),
- // ),
- // TextSpan(
- // text: ',否则视为放弃此次竞赛,已支付参赛券概不退换',
- // style: _text,
- // )
- // ]),
- // textAlign: TextAlign.center)
- // ],
- // ),
- // );
- // } else if (index == 2) {
- // useContent = Container(
- // margin: EdgeInsets.only(top: 20),
- // padding: EdgeInsets.symmetric(horizontal: 20),
- // child: Column(
- // children: <Widget>[
- // Image.asset('images/img_xuzhi_03.png', width: 176),
- // Container(
- // height: 10,
- // ),
- // Text.rich(
- // TextSpan(children: [
- // TextSpan(
- // text: '确认竞赛后会有弹窗提示授权进行录屏的操作,请一定',
- // style: _text,
- // ),
- // TextSpan(
- // text: '点击“确定”',
- // style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w500),
- // ),
- // TextSpan(
- // text: '或',
- // style: _text,
- // ),
- // TextSpan(
- // text: '“允许”',
- // style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w500),
- // ),
- // TextSpan(
- // text: '此操作,否则竞赛判定失败',
- // style: _text,
- // )
- // ]),
- // textAlign: TextAlign.center)
- // ],
- // ),
- // );
- // } else
- if (index == 1) {
- useContent = Container(
- margin: EdgeInsets.only(top: 20),
- padding: EdgeInsets.symmetric(horizontal: 20),
- child: Column(
- children: <Widget>[
- Image.asset('images/img_xuzhi_04.png', width: 216),
- Container(
- height: 10,
- ),
- Text.rich(
- TextSpan(children: [
- TextSpan(
- text: '游戏开始后,将会',
- style: _text,
- ),
- TextSpan(
- text: '自动',
- style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w600),
- ),
- TextSpan(
- text: '启动《和平精英》游戏,在任何模式中',
- style: _text,
- ),
- TextSpan(
- text: '尽快杀戮${killNum}人',
- style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w600),
- ),
- TextSpan(
- text: '后(具体人数参见房间内信息),',
- style: _text,
- ),
- TextSpan(
- text: '千万记得',
- style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w600),
- ),
- TextSpan(
- text:Platform.isIOS?'完成杀人目标后立刻回到':'完成杀人目标后立刻点击',
- style: _text,
- ),
- TextSpan(
- text: Platform.isIOS?'游戏':'悬浮窗',
- style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w600),
- ),
- TextSpan(
- text: '返回房间,取最快的',
- style: _text,
- ),
- TextSpan(
- text: '前三名',
- style: TextStyle(color: Color(0xFFFFB726), fontSize: 14, fontWeight: FontWeight.w600),
- )
- ]),)
- ],
- ),
- );
- }
- return useContent;
- }
- }
|