| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- import 'package:flutter/material.dart';
- import 'package:flutter_redux/flutter_redux.dart';
- import 'package:wanna_battle/model/AppealInfo.dart';
- import 'package:wanna_battle/redux/AppState.dart';
- import '../styles/colors.dart';
- import 'package:flutter/cupertino.dart';
- import 'dart:ui';
- import '../styles/totast.dart';
- import '../model/SystemNotice.dart';
- import '../net/HttpManager.dart';
- import '../net/Result.dart';
- import '../model/HouseInfo.dart';
- import '../model/GameInfo.dart';
- import '../pages/RoomInfoNew.dart';
- import '../widget/SuccessfulReception.dart';
- import 'Appeal.dart';
- class TipInfo extends StatefulWidget {
- TipInfo({Key key, this.notice}) : super(key: key);
- final SystemNotice notice;
- @override
- TipInfoState createState() => TipInfoState();
- }
- class TipInfoState extends State<TipInfo> {
- SystemNotice notice;
- HouseInfo houseInfo;
- bool canAppeal = false;
- int appealState = 0;
- Future<void> getInfo() async {
- HttpManager.get('systemNotice/getOne', data: {'id': widget.notice.id}).then((res) {
- if (res.success) {
- setState(() {
- notice = SystemNotice.fromJson(res.data);
- });
- }
- if (notice.statusFlag == 0 && notice.typeFlag != 2 && notice.typeFlag != 3) {
- HttpManager.post('systemNotice/update', data: {'id': notice.id, 'statusFlag': 1});
- }
- if (notice.typeFlag == 3) {
- return;
- }
- });
- HttpManager.get('houseInfo/getOne', data: {'id': notice.houseId}).then((res2) {
- if (res2.success) {
- setState(() {
- houseInfo = HouseInfo.fromJson(res2.data);
- });
- }
- });
- if (notice.playerInfo != null && (notice.playerInfo.ranking == null || notice.playerInfo.liveTime == null || notice.playerInfo.score == null)) {
- HttpManager.get('appealInfo/getOne', data: {
- 'userId': StoreProvider.of<AppState>(context).state.userInfo.id,
- 'playerInfoId': notice.playerInfo.id,
- }).then((res) {
- if (res.success && res.data != null) {
- setState(() {
- canAppeal = true;
- appealState = 1;
- });
- } else {
- setState(() {
- canAppeal = true;
- appealState = 0;
- });
- }
- });
- }
- }
- void showSuccess(money) {
- Navigator.of(context).push(
- PageRouteBuilder(
- opaque: false,
- transitionDuration: Duration(milliseconds: 300),
- transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
- return FadeTransition(
- opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
- child: child,
- );
- },
- pageBuilder: (BuildContext context, _, __) {
- return SuccessfulReception(money: money);
- },
- ),
- );
- }
- @override
- void initState() {
- super.initState();
- notice = widget.notice;
- Future.delayed(Duration.zero, () => getInfo());
- }
- @override
- Widget build(BuildContext context) {
- int type = notice.typeFlag != null ? notice.typeFlag : 0;
- int status = notice.statusFlag ?? 0;
- GameInfo gameInfo;
- if (notice.gameInfo != null) {
- gameInfo = notice.gameInfo;
- }
- return WillPopScope(
- child: Scaffold(
- appBar: AppBar(
- title: Text('消息详情'),
- centerTitle: true,
- elevation: 0,
- ),
- body: Container(
- child: Column(
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(left: 15, right: 15),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.symmetric(vertical: 12),
- child: Text(readTimestamp(notice.createTime, 'yyyy.MM.dd HH:mm:ss'), style: TextStyle(color: Colors.white24, fontSize: 13)),
- ),
- Container(
- height: 1,
- color: Colors.black26,
- ),
- Padding(
- padding: EdgeInsets.only(top: 10, bottom: 17),
- child: Text(
- notice.content,
- style: TextStyle(color: Colors.white, fontSize: 14),
- ),
- )
- ],
- ),
- ),
- // Builder(
- // builder: (context) {
- // String content = '';
- // if (notice.playerInfo.dataError || !notice.playerInfo.played) {
- // content = '造成此情况等原因可能是:\n'
- // '1、没有实际进行游戏比赛\n'
- // '2、使用作弊手段进行游戏';
- // } else if (notice.playerInfo.resultError) {
- // content = '造成此情况等原因可能是:\n'
- // '1、确认开始游戏后没有授权系统进行录屏\n'
- // '2、视频没有录制到最后的分数名次结算页面就回到APP点击完成比赛了\n'
- // '3、在游戏过程中,由于电量过低或系统安全性能策略问题导致本竞赛APP后台进程被退出\n'
- // '4、游戏结束后没有在规定时间内返回APP点击完成比赛按钮';
- // }
- // return Container(
- // margin: EdgeInsets.only(left: 15, right: 15, bottom: 20),
- // width: double.infinity,
- // child: Text(
- // content,
- // style: TextStyle(color: Color(0x99FFFFFF), fontSize: 13),
- // ),
- // );
- // },
- // ),
- houseInfo != null && type != 3 ? _houseWidget() : Container(),
- resultWidget(),
- Expanded(
- child: Container(),
- ),
- canAppeal
- ? SafeArea(
- child: Container(
- width: double.infinity,
- height: 48,
- margin: EdgeInsets.only(left: 15, right: 15, bottom: 10),
- child: FlatButton(
- color: PRIMARY_COLOR,
- child: Text(
- appealState == 0 ? '申诉结果' : '已提交申诉',
- style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
- ),
- onPressed: () async {
- if (appealState == 0) {
- final success = await Navigator.push(context, CupertinoPageRoute(builder: (context) => Appeal(notice.playerInfo)));
- if (success != null && success) {
- Toast.show(context, '提交成功', 1500, 'success');
- setState(() {
- appealState = 1;
- });
- }
- }
- },
- ),
- ),
- )
- : Container(),
- // CustomPaint(
- // painter: CircleProgressBarPainter(
- // Color(0xFFDCA659), Color(0xFFAE4945), 0.0, 270.0, 360.0, 18.0),
- // size: Size(108.0, 108.0),
- // )
- ],
- ),
- )),
- onWillPop: () {
- Navigator.of(context).pop(true);
- Toast.hide();
- return Future.value(false);
- },
- );
- }
- Widget _houseWidget() {
- return GestureDetector(
- child: Container(
- padding: EdgeInsets.all(15),
- margin: EdgeInsets.only(left: 15, right: 15, bottom: 10),
- height: 78,
- color: SUB_COLOR,
- child: Material(
- color: Colors.transparent,
- child: Row(
- children: <Widget>[
- Image.network(
- notice.gameInfo.icon,
- width: 48,
- height: 48,
- ),
- Container(
- width: 10,
- ),
- Expanded(
- flex: 1,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Row(
- children: <Widget>[
- Expanded(
- child: Text(
- notice.competitionInfo?.competitionName ?? '',
- style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Text(
- readTimestamp(notice.playerInfo.createTime, 'yyyy-MM-dd HH:mm:ss'),
- style: TextStyle(color: Color(0xff9BA0AE), fontSize: 12),
- )
- ],
- ),
- Container(
- margin: EdgeInsets.only(top: 4),
- child: Text(
- houseInfo.houseName,
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal, color: Color(0xFF9BA0AE)),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- onTap: () {
- Navigator.push(
- context,
- CupertinoPageRoute(
- builder: (context) => RoomInfo(
- houseInfo,
- playerInfo: notice.playerInfo,
- )));
- },
- );
- }
- Widget resultWidget() {
- return Column(
- children: <Widget>[
- (notice.playerInfo != null && notice.playerInfo.ranking != null && notice.playerInfo.liveTime != null && notice.playerInfo.score != null)
- ? Container(
- margin: EdgeInsets.fromLTRB(15, 0, 15, 5),
- color: SUB_COLOR,
- padding: EdgeInsets.fromLTRB(15, 15, 0, 15),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: <Widget>[
- Text(
- '和平精英游戏结果',
- textAlign: TextAlign.left,
- style: TextStyle(color: Color(0x99FFFFFF)),
- ),
- Container(
- margin: EdgeInsets.only(top: 10),
- child: Row(
- children: <Widget>[
- Text(
- '名次',
- style: TextStyle(color: Colors.white, fontSize: 14),
- ),
- Expanded(
- child: Container(
- margin: EdgeInsets.only(left: 5),
- child: Text(
- notice.playerInfo?.ranking?.toString() ?? '',
- style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
- ),
- ),
- ),
- Text(
- '时长',
- style: TextStyle(color: Colors.white, fontSize: 14),
- ),
- Expanded(
- child: Container(
- margin: EdgeInsets.only(left: 5),
- child: Text(
- (notice.playerInfo?.liveTime?.toString() ?? '') + '分钟',
- style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
- ),
- ),
- ),
- Text(
- '评分',
- style: TextStyle(color: Colors.white, fontSize: 14),
- ),
- Expanded(
- child: Container(
- margin: EdgeInsets.only(left: 5),
- child: Text(
- notice.playerInfo?.score?.toString() ?? '',
- style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
- ),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- )
- : Container(),
- Container(
- margin: EdgeInsets.fromLTRB(15, 0, 15, 20),
- color: SUB_COLOR,
- padding: EdgeInsets.all(15),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: <Widget>[
- Text(
- '比赛结果',
- textAlign: TextAlign.left,
- style: TextStyle(color: Color(0x99FFFFFF)),
- ),
- Container(
- margin: EdgeInsets.only(top: 10),
- child: Row(
- children: <Widget>[
- Expanded(
- child: Text(
- '参赛成员',
- style: TextStyle(color: Colors.white, fontSize: 14),
- textAlign: TextAlign.left,
- ),
- ),
- Text(
- houseInfo?.playerNumber?.toString() ?? '',
- style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: 10),
- child: Row(
- children: <Widget>[
- Expanded(
- child: Text(
- '我的排名',
- style: TextStyle(color: Colors.white, fontSize: 14),
- textAlign: TextAlign.left,
- ),
- ),
- Text(
- notice.playerInfo?.houseRank?.toString() ?? '',
- style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: 10),
- child: Row(
- children: <Widget>[
- Expanded(
- child: Text(
- '本场比赛获得积分',
- style: TextStyle(color: Colors.white, fontSize: 14),
- textAlign: TextAlign.left,
- ),
- ),
- Container(
- margin: EdgeInsets.only(right: 3),
- width: 20,
- child: Image.asset('images/icon_jifen_da.png'),
- ),
- Text(
- notice.playerInfo?.points?.toString() ?? '0',
- style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
- )
- ],
- ),
- ),
- (notice.playerInfo?.ranking ?? 99) == 1
- ? Container(
- margin: EdgeInsets.only(top: 5),
- child: Text(
- '吃鸡额外获得10积分',
- style: TextStyle(color: PRIMARY_COLOR, fontSize: 12),
- ),
- )
- : Container()
- ],
- ),
- )
- ],
- );
- }
- }
|