CompetitionInformation.dart 12 KB

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