CompetitionInformation.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_swiper/flutter_swiper.dart';
  3. import '../model/HouseInfo.dart';
  4. //竞赛须知
  5. class CompetitionInformation extends StatefulWidget {
  6. final HouseInfo houseInfo;
  7. CompetitionInformation(this.houseInfo);
  8. @override
  9. CompetitionInformationState createState() => CompetitionInformationState();
  10. }
  11. class CompetitionInformationState extends State<CompetitionInformation> {
  12. int nowSwiperIndex = 0;
  13. SwiperController _swiperController;
  14. @override
  15. void initState() {
  16. super.initState();
  17. _swiperController = SwiperController();
  18. }
  19. @override
  20. Widget build(BuildContext context) {
  21. return WillPopScope(
  22. child: Scaffold(
  23. backgroundColor: Colors.black87,
  24. body: Container(
  25. child: Center(
  26. child: Swiper(
  27. controller: _swiperController,
  28. layout: SwiperLayout.DEFAULT,
  29. itemWidth: 270.0,
  30. itemHeight: 422.0,
  31. control: SwiperControl(color: Color(0xFFC2524D), disableColor: Colors.transparent),
  32. index: nowSwiperIndex,
  33. itemCount: 4,
  34. scrollDirection: Axis.horizontal,
  35. loop: false,
  36. itemBuilder: (context, index) {
  37. return InfoBox(
  38. houseInfo: widget.houseInfo,
  39. typeIndex: index + 1,
  40. next: () {
  41. _swiperController.next();
  42. },
  43. end: () {
  44. Navigator.of(context).pop();
  45. });
  46. }))),
  47. ),
  48. onWillPop: () {
  49. return Future.value(false);
  50. },
  51. );
  52. }
  53. }
  54. typedef OnTapHomeMenu = int Function();
  55. class InfoBox extends StatelessWidget {
  56. InfoBox({Key key, this.typeIndex, this.next, this.end, this.houseInfo}) : super(key: key);
  57. final int typeIndex;
  58. final OnTapHomeMenu next;
  59. final OnTapHomeMenu end;
  60. final HouseInfo houseInfo;
  61. @override
  62. Widget build(BuildContext context) {
  63. return UnconstrainedBox(
  64. child: Container(
  65. width: 270,
  66. height: 422,
  67. decoration: BoxDecoration(border: Border.all(width: 1, color: Color(0xFFC2524D)), color: Colors.black),
  68. child: Stack(
  69. children: <Widget>[
  70. Container(
  71. width: 270,
  72. padding: EdgeInsets.only(top: 25),
  73. child: Column(
  74. children: <Widget>[
  75. Text('竞赛须知 ' + typeIndex.toString() + '/4', style: TextStyle(color: Color(0xFFFDC372), fontSize: 20, fontWeight: FontWeight.bold)),
  76. _centerContent(typeIndex)
  77. ],
  78. ),
  79. ),
  80. Positioned(
  81. top: 0,
  82. left: 0,
  83. child: Image.asset(
  84. 'images/tancuang_shang.png',
  85. width: 131,
  86. ),
  87. ),
  88. Positioned(
  89. bottom: 0,
  90. right: 4,
  91. child: Image.asset(
  92. 'images/tancuang_xia.png',
  93. width: 148,
  94. ),
  95. ),
  96. Positioned(
  97. bottom: 15,
  98. left: 25,
  99. child: Column(
  100. children: <Widget>[
  101. Container(
  102. width: 220,
  103. height: 36,
  104. child: RaisedButton(
  105. textColor: Colors.white,
  106. child: Text(typeIndex != 4 ? '下一个' : '结束'),
  107. onPressed: typeIndex != 4 ? next : end,
  108. ),
  109. ),
  110. FlatButton(
  111. textColor: Color(0xFF727785),
  112. highlightColor: Colors.transparent,
  113. splashColor: Colors.transparent,
  114. child: Text('关闭'),
  115. onPressed: () {
  116. end();
  117. },
  118. )
  119. ],
  120. ),
  121. )
  122. ],
  123. ),
  124. ));
  125. }
  126. // 第一名获得${houseInfo.houseLevel.firstRatio}%,第二名获得${houseInfo.houseLevel.secondRatio}%,第三名获得${houseInfo.houseLevel.thirdRatio}%
  127. Widget _centerContent(int index) {
  128. Widget useContent = Container();
  129. TextStyle _text = TextStyle(color: Colors.white, fontSize: 14);
  130. if (index == 1 && houseInfo.scoreType == 0) {
  131. useContent = Container(
  132. margin: EdgeInsets.only(top: 22),
  133. padding: EdgeInsets.symmetric(horizontal: 20),
  134. child: Column(
  135. children: <Widget>[
  136. Image.asset('images/icon_jinbi_da_hong.png', width: 30),
  137. Container(
  138. height: 20,
  139. ),
  140. Text(
  141. '房间人数越多,总奖金就越多',
  142. style: _text,
  143. ),
  144. Text('同房间内玩家进行竞赛,吃上鸡的评分前三名玩家获得相应奖励', style: _text, textAlign: TextAlign.center),
  145. // Text('同房间内玩家进行竞赛', style: _text),
  146. Text.rich(TextSpan(children: [
  147. TextSpan(text: '第一名获得奖金池的', style: _text),
  148. TextSpan(
  149. text: '${houseInfo.houseLevel.firstRatio}%',
  150. style: TextStyle(color: Color(0xFFC2524D), fontSize: 13),
  151. ),
  152. ])),
  153. Text.rich(TextSpan(children: [
  154. TextSpan(text: '第二名获得奖金池的', style: _text),
  155. TextSpan(
  156. text: '${houseInfo.houseLevel.secondRatio}%',
  157. style: TextStyle(color: Color(0xFFC2524D), fontSize: 13),
  158. ),
  159. ])),
  160. Text.rich(TextSpan(children: [
  161. TextSpan(text: '第三名获得奖金池的', style: _text),
  162. TextSpan(
  163. text: '${houseInfo.houseLevel.thirdRatio}%',
  164. style: TextStyle(color: Color(0xFFC2524D), fontSize: 13),
  165. ),
  166. ])),
  167. Container(
  168. margin: EdgeInsets.only(top: 10),
  169. width: double.infinity,
  170. child: Column(
  171. mainAxisAlignment: MainAxisAlignment.start,
  172. crossAxisAlignment: CrossAxisAlignment.start,
  173. children: <Widget>[
  174. Text(
  175. '注:奖金池的${houseInfo.houseLevel.feeRatio}%为平台方运营服务费',
  176. style: TextStyle(fontSize: 11, color: Color.fromARGB(50, 255, 255, 255)),
  177. ),
  178. Padding(
  179. padding: EdgeInsets.only(left: 20),
  180. child: Text(' 奖金池的${houseInfo.houseLevel.poolRatio}%流入赛季总奖金', style: TextStyle(fontSize: 11, color: Color.fromARGB(50, 255, 255, 255))))
  181. ],
  182. ),
  183. )
  184. ],
  185. ),
  186. );
  187. } else if (index == 1 && houseInfo.scoreType == 1) {
  188. useContent = Container(
  189. margin: EdgeInsets.only(top: 22),
  190. padding: EdgeInsets.symmetric(horizontal: 20),
  191. child: Column(
  192. children: <Widget>[
  193. Image.asset('images/icon_jinbi_da_hong.png', width: 30),
  194. Container(
  195. height: 20,
  196. ),
  197. Text(
  198. '房间人数越多,总奖金就越多',
  199. style: _text,
  200. ),
  201. Text('同房间内的玩家进行竞赛,所有吃上鸡的玩家均可获得奖金', style: _text, textAlign: TextAlign.center),
  202. Text.rich(TextSpan(children: [
  203. TextSpan(text: '即平分总奖金池的', style: _text),
  204. TextSpan(
  205. text: '${houseInfo.houseLevel.avgRatio}%',
  206. style: TextStyle(color: Color(0xFFC2524D), fontSize: 13),
  207. ),
  208. ])),
  209. Container(
  210. margin: EdgeInsets.only(top: 44),
  211. width: double.infinity,
  212. child: Column(
  213. mainAxisAlignment: MainAxisAlignment.start,
  214. crossAxisAlignment: CrossAxisAlignment.start,
  215. children: <Widget>[
  216. Text(
  217. '注:奖金池的${houseInfo.houseLevel.feeRatio}%为平台方运营服务费',
  218. style: TextStyle(fontSize: 11, color: Color.fromARGB(50, 255, 255, 255)),
  219. ),
  220. Padding(
  221. padding: EdgeInsets.only(left: 20),
  222. child: Text(' 奖金池的${houseInfo.houseLevel.poolRatio}%流入赛季总奖金', style: TextStyle(fontSize: 11, color: Color.fromARGB(50, 255, 255, 255))))
  223. ],
  224. ),
  225. )
  226. ],
  227. ),
  228. );
  229. } else if (index == 2) {
  230. useContent = Container(
  231. margin: EdgeInsets.only(top: 20),
  232. padding: EdgeInsets.symmetric(horizontal: 20),
  233. child: Column(
  234. children: <Widget>[
  235. Image.asset('images/img_xuzhi_02.png', width: 136),
  236. Container(
  237. height: 10,
  238. ),
  239. Text.rich(
  240. TextSpan(children: [
  241. TextSpan(
  242. text: '竞赛开始前请在此耐心等待,在开始时会有上图所示弹窗,玩家必须在10秒内',
  243. style: _text,
  244. ),
  245. TextSpan(
  246. text: '点击确认',
  247. style: TextStyle(color: Color(0xFFC2524D), fontSize: 14, fontWeight: FontWeight.bold),
  248. ),
  249. TextSpan(
  250. text: ',否则视为放弃此次竞赛,已支付金币概不退换',
  251. style: _text,
  252. )
  253. ]),
  254. textAlign: TextAlign.center)
  255. ],
  256. ),
  257. );
  258. } else if (index == 3) {
  259. useContent = Container(
  260. margin: EdgeInsets.only(top: 20),
  261. padding: EdgeInsets.symmetric(horizontal: 20),
  262. child: Column(
  263. children: <Widget>[
  264. Image.asset('images/img_xuzhi_03.png', width: 176),
  265. Container(
  266. height: 10,
  267. ),
  268. Text.rich(
  269. TextSpan(children: [
  270. TextSpan(
  271. text: '确认竞赛后会有弹窗提示授权进行录屏的操作,请一定',
  272. style: _text,
  273. ),
  274. TextSpan(
  275. text: '点击“确定”',
  276. style: TextStyle(color: Color(0xFFC2524D), fontSize: 14, fontWeight: FontWeight.bold),
  277. ),
  278. TextSpan(
  279. text: '或“允许”此操作,否则竞赛判定失败',
  280. style: _text,
  281. )
  282. ]),
  283. textAlign: TextAlign.center)
  284. ],
  285. ),
  286. );
  287. } else if (index == 4) {
  288. useContent = Container(
  289. margin: EdgeInsets.only(top: 20),
  290. padding: EdgeInsets.symmetric(horizontal: 20),
  291. child: Column(
  292. children: <Widget>[
  293. Image.asset('images/img_xuzhi_04.png', width: 216),
  294. Container(
  295. height: 10,
  296. ),
  297. Text.rich(
  298. TextSpan(children: [
  299. TextSpan(
  300. text: '在游戏中吃鸡后,',
  301. style: _text,
  302. ),
  303. TextSpan(
  304. text: '请一定一定一定要点击“继续”按钮',
  305. style: TextStyle(color: Color(0xFFC2524D), fontSize: 14, fontWeight: FontWeight.bold),
  306. ),
  307. TextSpan(
  308. text: ',显示到上图所示画面,然后再切换到我们全民APP中,点击完成比赛,方可成功上传本次成绩,赢取大奖',
  309. style: _text,
  310. )
  311. ]),
  312. textAlign: TextAlign.center)
  313. ],
  314. ),
  315. );
  316. }
  317. return useContent;
  318. }
  319. }