x1ongzhu 6 anni fa
parent
commit
cb320aff46

BIN
images/2x/home_icon_vip1.png


BIN
images/2x/icon_jifen_da.png


BIN
images/3x/home_icon_vip1.png


BIN
images/3x/icon_jifen_da.png


BIN
images/home_icon_vip1.png


BIN
images/icon_jifen_da.png


+ 8 - 0
lib/model/PlayerInfo.dart

@@ -19,9 +19,13 @@ class PlayerInfo {
       this.points,
       this.points,
       this.gameInfo,
       this.gameInfo,
       this.houseInfo,
       this.houseInfo,
+      this.liveTime,
+      this.score,
       this.rank,
       this.rank,
+      this.ranking,
       this.houseRank,
       this.houseRank,
       this.video,
       this.video,
+      this.played,
       this.competitionInfo);
       this.competitionInfo);
 
 
   factory PlayerInfo.fromJson(Map<String, dynamic> json) =>
   factory PlayerInfo.fromJson(Map<String, dynamic> json) =>
@@ -35,9 +39,13 @@ class PlayerInfo {
   int points; //积分
   int points; //积分
   GameInfo gameInfo;
   GameInfo gameInfo;
   HouseInfo houseInfo;
   HouseInfo houseInfo;
+  String liveTime;
+  double score;
   int rank; //名次
   int rank; //名次
+  int ranking;
   int houseRank; //房间比赛名次
   int houseRank; //房间比赛名次
   String video; //视频地址
   String video; //视频地址
+  bool played;
   CompetitionInfo competitionInfo;
   CompetitionInfo competitionInfo;
 
 
   Map<String, dynamic> toJson() => _$PlayerInfoToJson(this);
   Map<String, dynamic> toJson() => _$PlayerInfoToJson(this);

+ 8 - 0
lib/model/PlayerInfo.g.dart

@@ -22,9 +22,13 @@ PlayerInfo _$PlayerInfoFromJson(Map<String, dynamic> json) {
       json['houseInfo'] == null
       json['houseInfo'] == null
           ? null
           ? null
           : HouseInfo.fromJson(json['houseInfo'] as Map<String, dynamic>),
           : HouseInfo.fromJson(json['houseInfo'] as Map<String, dynamic>),
+      json['liveTime'] as String,
+      (json['score'] as num)?.toDouble(),
       json['rank'] as int,
       json['rank'] as int,
+      json['ranking'] as int,
       json['houseRank'] as int,
       json['houseRank'] as int,
       json['video'] as String,
       json['video'] as String,
+      json['played'] as bool,
       json['competitionInfo'] == null
       json['competitionInfo'] == null
           ? null
           ? null
           : CompetitionInfo.fromJson(
           : CompetitionInfo.fromJson(
@@ -41,8 +45,12 @@ Map<String, dynamic> _$PlayerInfoToJson(PlayerInfo instance) =>
       'points': instance.points,
       'points': instance.points,
       'gameInfo': instance.gameInfo,
       'gameInfo': instance.gameInfo,
       'houseInfo': instance.houseInfo,
       'houseInfo': instance.houseInfo,
+      'liveTime': instance.liveTime,
+      'score': instance.score,
       'rank': instance.rank,
       'rank': instance.rank,
+      'ranking': instance.ranking,
       'houseRank': instance.houseRank,
       'houseRank': instance.houseRank,
       'video': instance.video,
       'video': instance.video,
+      'played': instance.played,
       'competitionInfo': instance.competitionInfo
       'competitionInfo': instance.competitionInfo
     };
     };

+ 2 - 2
lib/net/HttpManager.dart

@@ -3,8 +3,8 @@ import 'Result.dart';
 import 'package:intl/intl.dart';
 import 'package:intl/intl.dart';
 
 
 class HttpManager {
 class HttpManager {
-  //  static String baseUrl = 'http://123.58.240.138:8090/';
- static String baseUrl = 'http://192.168.50.132:8080/';
+   static String baseUrl = 'http://123.58.240.138:8090/';
+//  static String baseUrl = 'http://192.168.50.132:8080/';
   static String token;
   static String token;
   static bool debug;
   static bool debug;
 
 

+ 4 - 0
lib/pages/AppNotice.dart

@@ -39,8 +39,12 @@ class AppNotice extends StatefulWidget {
 class AppNoticeState extends State<AppNotice> {
 class AppNoticeState extends State<AppNotice> {
   final pageController = PageController(initialPage: 0);
   final pageController = PageController(initialPage: 0);
   int currPage = 0;
   int currPage = 0;
+
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
+    widget.pics.forEach((f) {
+      precacheImage(Image.network(f).image, context);
+    });
     return Material(
     return Material(
       color: Colors.transparent,
       color: Colors.transparent,
       child: Column(
       child: Column(

+ 3 - 3
lib/pages/BonusDialog.dart

@@ -100,10 +100,10 @@ class BonusDialogState extends State<BonusDialog> {
             Row(
             Row(
               children: <Widget>[
               children: <Widget>[
                 Container(
                 Container(
-                  width: 21,
-                  height: 18,
+                  width: 23,
+                  height: 20,
                   child: competitionInfo.type == 2
                   child: competitionInfo.type == 2
-                      ? Image.asset('images/home_icon_vip.png')
+                      ? Image.asset('images/home_icon_vip1.png')
                       : Container(),
                       : Container(),
                 ),
                 ),
                 Expanded(
                 Expanded(

+ 32 - 24
lib/pages/CompetitionNotice.dart

@@ -76,14 +76,22 @@ class CompetitionNoticeState extends State<CompetitionNotice> {
                     margin: EdgeInsets.only(top: 65),
                     margin: EdgeInsets.only(top: 65),
                     child: Column(
                     child: Column(
                       children: <Widget>[
                       children: <Widget>[
-                        Image.asset('images/icon_jifen_da.png'),
+                        Container(
+                          margin: EdgeInsets.only(top: 35),
+                          child: Image.asset(
+                            'images/icon_jifen_da.png',
+                            width: 96,
+                          ),
+                        ),
                         Container(
                         Container(
                           width: 230,
                           width: 230,
                           margin: EdgeInsets.only(top: 10),
                           margin: EdgeInsets.only(top: 10),
                           child: Text.rich(
                           child: Text.rich(
-                            TextSpan(text: '每局比赛按照吃鸡单人游戏的', children: [
-                              TextSpan(text: '评分', style: TextStyle(color: Colors.yellow)),
-                              TextSpan(text: '进行排序,评分相同游戏时长短的优胜'),
+                            TextSpan(text: '每局比赛按照', children: [
+                              TextSpan(text: '《和平精英》-单人模式', style: TextStyle(color: Colors.yellow)),
+                              TextSpan(text: '中的'),
+                              TextSpan(text: '比赛评分', style: TextStyle(color: Colors.yellow)),
+                              TextSpan(text: '进行排序,评分相同,存活时间长者优胜'),
                             ]),
                             ]),
                             textAlign: TextAlign.center,
                             textAlign: TextAlign.center,
                             style: TextStyle(
                             style: TextStyle(
@@ -92,23 +100,23 @@ class CompetitionNoticeState extends State<CompetitionNotice> {
                             ),
                             ),
                           ),
                           ),
                         ),
                         ),
-                        Container(
-                          margin: EdgeInsets.only(top: 10),
-                          child: Row(
-                            mainAxisAlignment: MainAxisAlignment.center,
-                            crossAxisAlignment: CrossAxisAlignment.start,
-                            children: <Widget>[
-                              Text(
-                                '注:',
-                                style: TextStyle(color: Color(0x66FFFFFF), fontSize: 12),
-                              ),
-                              Text(
-                                '第一名获得40积分\n剩余10%获得20积分\n剩余20%获得10积分\n剩余30%获得0积分\n剩余40%获得-10积分\n吃鸡选手额外获得10积分',
-                                style: TextStyle(color: Color(0x66FFFFFF), fontSize: 12),
-                              ),
-                            ],
-                          ),
-                        )
+                        // Container(
+                        //   margin: EdgeInsets.only(top: 10),
+                        //   child: Row(
+                        //     mainAxisAlignment: MainAxisAlignment.center,
+                        //     crossAxisAlignment: CrossAxisAlignment.start,
+                        //     children: <Widget>[
+                        //       Text(
+                        //         '注:',
+                        //         style: TextStyle(color: Color(0x66FFFFFF), fontSize: 12),
+                        //       ),
+                        //       Text(
+                        //         '第一名获得40积分\n剩余10%获得20积分\n剩余20%获得10积分\n剩余30%获得0积分\n剩余40%获得-10积分\n吃鸡选手额外获得10积分',
+                        //         style: TextStyle(color: Color(0x66FFFFFF), fontSize: 12),
+                        //       ),
+                        //     ],
+                        //   ),
+                        // )
                       ],
                       ],
                     ),
                     ),
                   ),
                   ),
@@ -119,7 +127,7 @@ class CompetitionNoticeState extends State<CompetitionNotice> {
                   onNext: () {
                   onNext: () {
                     pageController.nextPage(duration: Duration(milliseconds: 500), curve: Curves.linearToEaseOut);
                     pageController.nextPage(duration: Duration(milliseconds: 500), curve: Curves.linearToEaseOut);
                   },
                   },
-                  body:Container(
+                  body: Container(
                     margin: EdgeInsets.only(top: 75),
                     margin: EdgeInsets.only(top: 75),
                     child: Column(
                     child: Column(
                       children: <Widget>[
                       children: <Widget>[
@@ -149,7 +157,7 @@ class CompetitionNoticeState extends State<CompetitionNotice> {
                   onNext: () {
                   onNext: () {
                     pageController.nextPage(duration: Duration(milliseconds: 500), curve: Curves.linearToEaseOut);
                     pageController.nextPage(duration: Duration(milliseconds: 500), curve: Curves.linearToEaseOut);
                   },
                   },
-                  body:Container(
+                  body: Container(
                     margin: EdgeInsets.only(top: 75),
                     margin: EdgeInsets.only(top: 75),
                     child: Column(
                     child: Column(
                       children: <Widget>[
                       children: <Widget>[
@@ -190,7 +198,7 @@ class CompetitionNoticeState extends State<CompetitionNotice> {
                           width: 230,
                           width: 230,
                           margin: EdgeInsets.only(top: 10),
                           margin: EdgeInsets.only(top: 10),
                           child: Text.rich(
                           child: Text.rich(
-                              TextSpan(text: '在游戏比赛结束后,', children: [
+                            TextSpan(text: '在游戏比赛结束后,', children: [
                               TextSpan(text: '请一定要点击查看游戏最后的分数名次结算页面', style: TextStyle(color: Colors.yellow)),
                               TextSpan(text: '请一定要点击查看游戏最后的分数名次结算页面', style: TextStyle(color: Colors.yellow)),
                               TextSpan(text: ',返回游戏主页,最后再切换到我们竞赛app中,点击完成比赛,方可成功上传本次成绩,赢取积分'),
                               TextSpan(text: ',返回游戏主页,最后再切换到我们竞赛app中,点击完成比赛,方可成功上传本次成绩,赢取积分'),
                             ]),
                             ]),

+ 49 - 34
lib/pages/CompetitionRooms.dart

@@ -11,7 +11,7 @@ import '../styles/colors.dart';
 import '../model/HouseInfo.dart';
 import '../model/HouseInfo.dart';
 import '../net/HttpManager.dart';
 import '../net/HttpManager.dart';
 import '../net/Result.dart';
 import '../net/Result.dart';
-import './RoomInfo.dart';
+import './RoomInfoNew.dart';
 import '../redux/AppState.dart';
 import '../redux/AppState.dart';
 import '../plugins/ScreenStramPlugin.dart';
 import '../plugins/ScreenStramPlugin.dart';
 import './CompetitionRank.dart';
 import './CompetitionRank.dart';
@@ -230,40 +230,55 @@ class _CompetitionRoomsState extends State<CompetitionRooms> {
         return Center(
         return Center(
           child: Material(
           child: Material(
             color: Colors.transparent,
             color: Colors.transparent,
-            child: Container(
-              width: 270,
-              padding: EdgeInsets.all(0),
-              decoration: BoxDecoration(color: Color(0xE6293559), border: Border.all(width: 1, color: Color(0xFF1990F8))),
-              child: Column(
-                mainAxisSize: MainAxisSize.min,
-                crossAxisAlignment: CrossAxisAlignment.stretch,
-                children: <Widget>[
-                  Container(
-                    margin: EdgeInsets.only(top: 25),
-                    child: Text(
-                      '奖品规则',
-                      style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
-                      textAlign: TextAlign.center,
-                    ),
+            child: Column(
+              mainAxisSize: MainAxisSize.min,
+              mainAxisAlignment: MainAxisAlignment.center,
+              children: <Widget>[
+                Container(
+                  width: 270,
+                  padding: EdgeInsets.all(0),
+                  decoration: BoxDecoration(color: Color(0xE6293559), border: Border.all(width: 1, color: Color(0xFF1990F8))),
+                  child: Column(
+                    mainAxisSize: MainAxisSize.min,
+                    crossAxisAlignment: CrossAxisAlignment.stretch,
+                    children: <Widget>[
+                      Container(
+                        margin: EdgeInsets.only(top: 25),
+                        child: Text(
+                          '奖品规则',
+                          style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
+                          textAlign: TextAlign.center,
+                        ),
+                      ),
+                      Container(
+                        margin: EdgeInsets.only(top: 20, left: 20, right: 20),
+                        child: Text(
+                          '按照比赛周期内\n各个玩家累计积分排名发放奖金',
+                          style: TextStyle(color: Colors.white, fontSize: 14),
+                          textAlign: TextAlign.left,
+                        ),
+                      ),
+                      Container(
+                        margin: EdgeInsets.only(top: 10, bottom: 40),
+                        padding: EdgeInsets.only(left: 20, right: 20),
+                        child: Text(
+                          widget.competitionInfo.bonus ?? '',
+                          style: TextStyle(color: Colors.white, fontSize: 14),
+                        ),
+                      )
+                    ],
                   ),
                   ),
-                  Container(
-                    margin: EdgeInsets.only(top: 20),
-                    child: Text(
-                      '按照比赛周期内\n各个玩家累计积分排名发放奖金',
-                      style: TextStyle(color: Colors.yellow, fontSize: 14),
-                      textAlign: TextAlign.center,
-                    ),
+                ),
+                Container(
+                  margin: EdgeInsets.only(top: 20),
+                  child: GestureDetector(
+                    child: Image.asset('images/icon_guanbi.png'),
+                    onTap: () {
+                      Navigator.of(context).pop();
+                    },
                   ),
                   ),
-                  Container(
-                    margin: EdgeInsets.only(top: 10, bottom: 40),
-                    padding: EdgeInsets.only(left: 38, right: 38),
-                    child: Text(
-                      widget.competitionInfo.bonus ?? '',
-                      style: TextStyle(color: Colors.yellow, fontSize: 14),
-                    ),
-                  )
-                ],
-              ),
+                )
+              ],
             ),
             ),
           ),
           ),
         );
         );
@@ -389,11 +404,11 @@ class _Room extends StatelessWidget {
       );
       );
       return;
       return;
     }
     }
+    // Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(houseInfo)));
     Toast.show(context, '加载中', -1, 'loading');
     Toast.show(context, '加载中', -1, 'loading');
     Result res = await HttpManager.post('houseInfo/join', data: {'houseId': houseId, 'userId': StoreProvider.of<AppState>(context).state.userInfo.id});
     Result res = await HttpManager.post('houseInfo/join', data: {'houseId': houseId, 'userId': StoreProvider.of<AppState>(context).state.userInfo.id});
     Toast.hide();
     Toast.hide();
     if (res.success) {
     if (res.success) {
-      Toast.show(context, '加入成功', 1500, 'success');
       Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(houseInfo)));
       Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(houseInfo)));
     } else {
     } else {
       Toast.show(context, res.error, 1500, 'info');
       Toast.show(context, res.error, 1500, 'info');

+ 1 - 4
lib/pages/Competitions.dart

@@ -38,12 +38,9 @@ class _CompetitionState extends State<Competitions> {
       final bool gameInstalled = await canLaunch(url);
       final bool gameInstalled = await canLaunch(url);
       if (!gameInstalled) {
       if (!gameInstalled) {
         setState(() {
         setState(() {
-          showDownload = false;
+          showDownload = true;
         });
         });
       }
       }
-      setState(() {
-        showDownload = true;
-      });
     });
     });
   }
   }
 
 

+ 1 - 1
lib/pages/Home.dart

@@ -76,7 +76,7 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
           BottomNavigationBarItem(
           BottomNavigationBarItem(
             icon: ImageIcon(AssetImage('images/tabbar_icon_02.png'), size: 28),
             icon: ImageIcon(AssetImage('images/tabbar_icon_02.png'), size: 28),
             title: Text(
             title: Text(
-              '邮件',
+              '消息',
               style: TextStyle(fontSize: 11),
               style: TextStyle(fontSize: 11),
             ),
             ),
           ),
           ),

+ 1 - 1
lib/pages/OpenRoom.dart

@@ -8,7 +8,7 @@ import 'dart:async';
 import 'dart:convert';
 import 'dart:convert';
 import 'dart:ui';
 import 'dart:ui';
 import '../styles/totast.dart';
 import '../styles/totast.dart';
-import '../pages/RoomInfo.dart';
+import '../pages/RoomInfoNew.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import '../redux/AppState.dart';
 import '../redux/AppState.dart';
 import '../net/HttpManager.dart';
 import '../net/HttpManager.dart';

+ 46 - 49
lib/pages/RecordList.dart

@@ -1,4 +1,5 @@
 import 'dart:ui';
 import 'dart:ui';
+import 'package:intl/intl.dart';
 import 'package:cached_network_image/cached_network_image.dart';
 import 'package:cached_network_image/cached_network_image.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import '../styles/colors.dart';
 import '../styles/colors.dart';
@@ -9,7 +10,7 @@ import '../net/HttpManager.dart';
 import '../net/Result.dart';
 import '../net/Result.dart';
 import '../model/HouseInfo.dart';
 import '../model/HouseInfo.dart';
 import '../model/GameInfo.dart';
 import '../model/GameInfo.dart';
-import '../pages/RoomInfo.dart';
+import '../pages/RoomInfoNew.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import '../redux/AppState.dart';
 import '../redux/AppState.dart';
 
 
@@ -28,11 +29,8 @@ class RecordListState extends State<RecordList> {
   Future<void> getListPage() async {
   Future<void> getListPage() async {
     isMore = false;
     isMore = false;
     Toast.show(context, '加载中', -1, 'loading');
     Toast.show(context, '加载中', -1, 'loading');
-    Result res = await HttpManager.get('playerInfo/page', data: {
-      'userId': StoreProvider.of<AppState>(context).state.userInfo.id,
-      'currentPage': currentPage,
-      'pageNumber': 20
-    });
+    Result res = await HttpManager.get('playerInfo/page',
+        data: {'userId': StoreProvider.of<AppState>(context).state.userInfo.id, 'currentPage': currentPage, 'pageNumber': 20});
     Toast.hide();
     Toast.hide();
     List<PlayerInfo> list = playerList;
     List<PlayerInfo> list = playerList;
     if (currentPage == 1) {
     if (currentPage == 1) {
@@ -101,23 +99,18 @@ class RecordListState extends State<RecordList> {
                     if (playerList.isEmpty) {
                     if (playerList.isEmpty) {
                       return Text(
                       return Text(
                         '还没有战绩快去比赛吧...',
                         '还没有战绩快去比赛吧...',
-                        style: TextStyle(
-                            color: Colors.white30, fontSize: 13, height: 2),
+                        style: TextStyle(color: Colors.white30, fontSize: 13, height: 2),
                         textAlign: TextAlign.center,
                         textAlign: TextAlign.center,
                       );
                       );
                     }
                     }
-                    return houseItem(
-                        roomInfo: playerList[index].houseInfo,
-                        gameInfo: playerList[index].gameInfo,
-                        playerInfo: playerList[index]);
+                    return houseItem(roomInfo: playerList[index].houseInfo, gameInfo: playerList[index].gameInfo, playerInfo: playerList[index]);
                   })),
                   })),
         ));
         ));
   }
   }
 }
 }
 
 
 class houseItem extends StatelessWidget {
 class houseItem extends StatelessWidget {
-  houseItem({Key key, this.roomInfo, this.gameInfo, this.playerInfo})
-      : super(key: key);
+  houseItem({Key key, this.roomInfo, this.gameInfo, this.playerInfo}) : super(key: key);
   final HouseInfo roomInfo;
   final HouseInfo roomInfo;
   final GameInfo gameInfo;
   final GameInfo gameInfo;
   final PlayerInfo playerInfo;
   final PlayerInfo playerInfo;
@@ -152,58 +145,62 @@ class houseItem extends StatelessWidget {
                     children: <Widget>[
                     children: <Widget>[
                       Row(
                       Row(
                         children: <Widget>[
                         children: <Widget>[
-                          LimitedBox(
-                            maxWidth: 170,
-                            child: Text(
-                              playerInfo.competitionInfo?.competitionName ?? '',
-                              style: TextStyle(
-                                  color: Colors.white,
-                                  fontSize: 14,
-                                  fontWeight: FontWeight.bold),
-                              maxLines: 1,
-                              overflow: TextOverflow.ellipsis,
+                          Expanded(
+                            child: LimitedBox(
+                              maxWidth: 170,
+                              child: Text(
+                                playerInfo.competitionInfo?.competitionName ?? '',
+                                style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
+                                maxLines: 1,
+                                overflow: TextOverflow.ellipsis,
+                              ),
                             ),
                             ),
                           ),
                           ),
+                          playerInfo.points == null
+                              ? Container()
+                              : Container(
+                                  width: 60,
+                                  child: Row(
+                                    children: <Widget>[
+                                      Image.asset('images/icon_jifen_da.png', width: 20),
+                                      Text(
+                                        playerInfo.points.toString(),
+                                        style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
+                                      )
+                                    ],
+                                  ),
+                                )
                         ],
                         ],
                       ),
                       ),
                       Container(
                       Container(
                         margin: EdgeInsets.only(top: 8),
                         margin: EdgeInsets.only(top: 8),
-                        child: Text(
-                          roomInfo.houseName,
-                          style: TextStyle(
-                              fontSize: 12,
-                              fontWeight: FontWeight.normal,
-                              color: Color(0xFF9BA0AE)),
-                          maxLines: 2,
-                          overflow: TextOverflow.ellipsis,
-                        ),
-                      )
-                    ],
-                  ),
-                ),
-                playerInfo.points == null
-                    ? Container()
-                    : Container(
-                        width: 60,
                         child: Row(
                         child: Row(
                           children: <Widget>[
                           children: <Widget>[
-                            Image.asset('images/icon_jifen_da.png', width: 20),
+                            Expanded(
+                              child: Text(
+                                roomInfo.houseName,
+                                style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal, color: Color(0xFF9BA0AE)),
+                                maxLines: 2,
+                                overflow: TextOverflow.ellipsis,
+                              ),
+                            ),
                             Text(
                             Text(
-                              playerInfo.points.toString(),
-                              style: TextStyle(
-                                  color: Colors.yellow,
-                                  fontSize: 14,
-                                  fontWeight: FontWeight.bold),
+                              readTimestamp(roomInfo.createTime, 'yyyy-MM-dd HH:mm'),
+                              style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal, color: Color(0xFF9BA0AE)),
+                              maxLines: 2,
+                              overflow: TextOverflow.ellipsis,
                             )
                             )
                           ],
                           ],
                         ),
                         ),
                       )
                       )
+                    ],
+                  ),
+                ),
               ],
               ],
             ),
             ),
           ),
           ),
           onTap: () {
           onTap: () {
-            Navigator.push(context,
-                CupertinoPageRoute(builder: (context) => RoomInfo(roomInfo)));
+            Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(roomInfo)));
           },
           },
         ),
         ),
       ),
       ),

+ 3 - 2
lib/pages/RoomInfo.dart

@@ -108,11 +108,14 @@ class RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
       success = await ScreenStreamPlugin.start(playerInfo.id.toString());
       success = await ScreenStreamPlugin.start(playerInfo.id.toString());
       if (success) {
       if (success) {
         data['statusFlag'] = 2;
         data['statusFlag'] = 2;
+        data['played'] = 1;
       } else {
       } else {
         data['statusFlag'] = 6;
         data['statusFlag'] = 6;
+        data['played'] = 0;
       }
       }
     } else {
     } else {
       data['statusFlag'] = 6;
       data['statusFlag'] = 6;
+      data['played'] = 0;
     }
     }
     Result res = await HttpManager.post('playerInfo/update', data: data);
     Result res = await HttpManager.post('playerInfo/update', data: data);
 
 
@@ -134,8 +137,6 @@ class RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
           Timer(Duration(seconds: 10), () {
           Timer(Duration(seconds: 10), () {
             showSucessInfo();
             showSucessInfo();
           });
           });
-
-          throw 'Could not launch $url';
         }
         }
       } else {
       } else {
         showBackDialog(success ? 1 : 0);
         showBackDialog(success ? 1 : 0);

+ 216 - 81
lib/pages/RoomInfoDetail.dart

@@ -1,51 +1,33 @@
-import 'dart:async';
-
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter_html/flutter_html.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import 'package:flutter_redux/flutter_redux.dart';
-import 'package:url_launcher/url_launcher.dart';
 import 'package:wanna_battle/redux/AppState.dart';
 import 'package:wanna_battle/redux/AppState.dart';
 import '../Constants.dart';
 import '../Constants.dart';
 import '../styles/colors.dart';
 import '../styles/colors.dart';
-import '../styles/totast.dart';
 import '../widget/VideoWidget.dart';
 import '../widget/VideoWidget.dart';
 import '../model/HouseInfo.dart';
 import '../model/HouseInfo.dart';
 import '../widget/Dialog.dart';
 import '../widget/Dialog.dart';
 import './CompetitionNotice.dart';
 import './CompetitionNotice.dart';
 import '../model/PlayerInfo.dart';
 import '../model/PlayerInfo.dart';
-import 'StartWindow.dart';
-import '../net/Result.dart';
-import '../net/HttpManager.dart';
-import '../plugins/ScreenStramPlugin.dart';
 
 
 class RoomInfoDetail extends StatefulWidget {
 class RoomInfoDetail extends StatefulWidget {
-  RoomInfoDetail(this.houseInfo, {Key key, this.onStart}) : super(key: key);
+  RoomInfoDetail(this.houseInfo, this.playerInfo, {Key key, this.onStart, this.finishedPlayerNum = 0}) : super(key: key);
 
 
   final HouseInfo houseInfo;
   final HouseInfo houseInfo;
+  final PlayerInfo playerInfo;
   final VoidCallback onStart;
   final VoidCallback onStart;
-  _RoomInfoDetailState state;
-
-  void setHouseInfo(HouseInfo houseInfo) {
-    state.setHouseInfo(houseInfo);
-  }
+  final int finishedPlayerNum;
 
 
   @override
   @override
   State<StatefulWidget> createState() {
   State<StatefulWidget> createState() {
-    state = _RoomInfoDetailState();
-    return state;
+    return RoomInfoDetailState();
   }
   }
 }
 }
 
 
-class _RoomInfoDetailState extends State<RoomInfoDetail> {
-  HouseInfo mHouseInfo;
-  PlayerInfo mPlayerInfo;
-  int finishedPlayerNum;
-
+class RoomInfoDetailState extends State<RoomInfoDetail> {
   @override
   @override
   void initState() {
   void initState() {
     super.initState();
     super.initState();
-    mHouseInfo = widget.houseInfo;
   }
   }
 
 
   @override
   @override
@@ -55,7 +37,7 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
         children: <Widget>[
         children: <Widget>[
           ListView(
           ListView(
             children: <Widget>[
             children: <Widget>[
-              mHouseInfo != null ? VideoWidget(videoSrc: mHouseInfo.video) : Container(),
+              widget.houseInfo != null ? VideoWidget(videoSrc: widget.houseInfo.video) : Container(),
               Container(
               Container(
                 height: 60,
                 height: 60,
                 padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
                 padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
@@ -63,7 +45,7 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
                   children: <Widget>[
                   children: <Widget>[
                     Expanded(
                     Expanded(
                       child: Text(
                       child: Text(
-                        mHouseInfo.houseName,
+                        widget.houseInfo.houseName,
                         style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.white),
                         style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.white),
                       ),
                       ),
                     ),
                     ),
@@ -75,7 +57,7 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
                           width: 20,
                           width: 20,
                         ),
                         ),
                         Text(
                         Text(
-                          (mHouseInfo?.playerNumber ?? 0).toString() + '/' + (mHouseInfo?.maxNumber ?? 0).toString(),
+                          (widget.houseInfo?.playerNumber ?? 0).toString() + '/' + (widget.houseInfo?.maxNumber ?? 0).toString(),
                           style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xFFB1B2C0)),
                           style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xFFB1B2C0)),
                         ),
                         ),
                       ],
                       ],
@@ -94,7 +76,13 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
                       child: CupertinoButton(
                       child: CupertinoButton(
                         padding: EdgeInsets.all(0),
                         padding: EdgeInsets.all(0),
                         onPressed: () {
                         onPressed: () {
-                          Toast.show(context, '比赛即将开始,暂不能离开房间', 1500, 'info');
+                          if (widget.houseInfo.statusFlag == 0) {
+                            showCustomDialog(context, '比赛即将开始,确定离开房间?', isCancel: true, onsubmit: () {
+                              Navigator.of(context).pop();
+                            });
+                          } else {
+                            Navigator.of(context).pop();
+                          }
                         },
                         },
                         child: Text(
                         child: Text(
                           '返回锦标赛',
                           '返回锦标赛',
@@ -123,32 +111,24 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
                   ],
                   ],
                 ),
                 ),
               ),
               ),
-              Container(
-                height: 40,
-                margin: EdgeInsets.fromLTRB(15, 10, 15, 0),
-                decoration: BoxDecoration(
-                    color: Color(0x1AFFFF00),
-                    border: Border.all(
-                      width: 1,
-                      color: Colors.yellow,
-                    )),
-                child: Row(
-                  mainAxisAlignment: MainAxisAlignment.spaceAround,
-                  children: <Widget>[
-                    Text('积分 加成+0%', style: TextStyle(color: Colors.yellow, fontSize: 12)),
-                    Text('保底 0积分', style: TextStyle(color: Colors.yellow, fontSize: 12)),
-                  ],
-                ),
-              ),
-              Container(
-                margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
-                color: SUB_COLOR,
-                padding: EdgeInsets.all(15),
-                child: Text.rich(
-                  tipText(),
-                  style: TextStyle(color: Colors.white, fontSize: 13),
-                ),
-              )
+              // Container(
+              //   height: 40,
+              //   margin: EdgeInsets.fromLTRB(15, 10, 15, 0),
+              //   decoration: BoxDecoration(
+              //       color: Color(0x1AFFFF00),
+              //       border: Border.all(
+              //         width: 1,
+              //         color: Colors.yellow,
+              //       )),
+              //   child: Row(
+              //     mainAxisAlignment: MainAxisAlignment.spaceAround,
+              //     children: <Widget>[
+              //       Text('积分 加成+0%', style: TextStyle(color: Colors.yellow, fontSize: 12)),
+              //       Text('保底 0积分', style: TextStyle(color: Colors.yellow, fontSize: 12)),
+              //     ],
+              //   ),
+              // ),
+              tipText()
             ],
             ],
           ),
           ),
           Align(
           Align(
@@ -160,39 +140,200 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
     );
     );
   }
   }
 
 
-  TextSpan tipText() {
-    switch (mHouseInfo.statusFlag) {
+  Widget tipText() {
+    switch (widget.houseInfo.statusFlag) {
       case HouseStatus.WAIT:
       case HouseStatus.WAIT:
       case HouseStatus.READY:
       case HouseStatus.READY:
-        return TextSpan(
-            text: '待倒计时结束或人数满员时会自动开启比赛,房主也可以手动开启比赛,请在此页面耐心等待其他人的加入,'
-                '加入房间后再次退出则视为自动放弃比赛,快快点击右上角分享给好友加入战局吧');
-
+        return Container(
+          margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
+          color: SUB_COLOR,
+          padding: EdgeInsets.all(15),
+          child: Text.rich(
+            TextSpan(
+                text: '待倒计时结束或人数满员时会自动开启比赛,请在此页面耐心等待其他人的加入,'
+                    '祝您取得好成绩'),
+            style: TextStyle(color: Colors.white, fontSize: 13),
+          ),
+        );
       case HouseStatus.START:
       case HouseStatus.START:
       case HouseStatus.END:
       case HouseStatus.END:
       case HouseStatus.ANALYSIS:
       case HouseStatus.ANALYSIS:
-        final time = mHouseInfo.beginTime + 3600000 - DateTime.now().millisecondsSinceEpoch;
-        return TextSpan(children: <TextSpan>[
-          TextSpan(text: (mPlayerInfo?.statusFlag ?? 0 == PlayerStatus.END) ? '你已完成本次比赛,当前完成人数' : '当前完成人数'),
-          TextSpan(text: '${finishedPlayerNum ?? 0}'),
-          TextSpan(text: '比赛需要等待所有人完成后方可结算积分<br>最迟结算时间还剩'),
-          TextSpan(text: '${getCountDown(time)}'),
-          TextSpan(text: ',你可以先去参加其他竞赛,稍后在“个人中心-我的战绩”中可以查看本次竞赛排名及积分详情')
-        ]);
+        final time = widget.houseInfo.beginTime + 3600000 - DateTime.now().millisecondsSinceEpoch;
+        return Container(
+          margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
+          color: SUB_COLOR,
+          padding: EdgeInsets.all(15),
+          child: Text.rich(
+            TextSpan(children: <TextSpan>[
+              TextSpan(text: ((widget.playerInfo?.statusFlag ?? 0) == PlayerStatus.END) ? '你已完成本次比赛,当前完成人数' : '当前完成人数'),
+              TextSpan(text: ' ${widget.finishedPlayerNum ?? 0} ', style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold)),
+              TextSpan(text: '比赛需要等待所有人完成后方可结算积分最迟结算时间还剩'),
+              TextSpan(text: ' ${getCountDown(time)} ', style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold)),
+              TextSpan(text: ',你可以先去参加其他竞赛,稍后在“个人中心-我的战绩”中可以查看本次竞赛排名及积分详情'),
+            ]),
+            style: TextStyle(color: Colors.white, fontSize: 13),
+          ),
+        );
         break;
         break;
-        
       case HouseStatus.SETTLEMENT:
       case HouseStatus.SETTLEMENT:
-        return TextSpan(text: '当前比赛已结束,可在参赛成员列表可查看当前比赛详细排名情况');
+        return Column(
+          children: <Widget>[
+            Container(
+              margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
+              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(
+                              widget.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(
+                              (widget.playerInfo?.liveTime ?? '') + '分钟',
+                              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(
+                              widget.playerInfo?.score?.toString() ?? '',
+                              style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
+                            ),
+                          ),
+                        ),
+                      ],
+                    ),
+                  ),
+                ],
+              ),
+            ),
+            Container(
+              margin: EdgeInsets.fromLTRB(15, 5, 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(
+                          widget.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(
+                          widget.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(
+                          widget.playerInfo?.points?.toString() ?? '0',
+                          style: TextStyle(color: Colors.yellow, fontWeight: FontWeight.bold),
+                        )
+                      ],
+                    ),
+                  ),
+                  Container(
+                    margin: EdgeInsets.only(top: 5),
+                    child: Text(
+                      '吃鸡可额外获得10积分',
+                      style: TextStyle(color: PRIMARY_COLOR, fontSize: 12),
+                    ),
+                  )
+                ],
+              ),
+            )
+          ],
+        );
     }
     }
-    return TextSpan(text: '');
+    return Container();
   }
   }
 
 
   Widget roomBtn() {
   Widget roomBtn() {
-    switch (mHouseInfo.statusFlag) {
+    switch (widget.houseInfo.statusFlag) {
       case HouseStatus.WAIT:
       case HouseStatus.WAIT:
       case HouseStatus.READY:
       case HouseStatus.READY:
         {
         {
-          if (mHouseInfo.createUser == StoreProvider.of<AppState>(context).state.userInfo.id.toString()) {
+          if (widget.houseInfo.createUser == StoreProvider.of<AppState>(context).state.userInfo.id.toString()) {
             return startBtn();
             return startBtn();
           } else {
           } else {
             return countDownBtn();
             return countDownBtn();
@@ -202,7 +343,7 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
       case HouseStatus.START:
       case HouseStatus.START:
       case HouseStatus.END:
       case HouseStatus.END:
         {
         {
-          final time = mHouseInfo.beginTime + 3600000 - DateTime.now().millisecondsSinceEpoch;
+          final time = widget.houseInfo.beginTime + 3600000 - DateTime.now().millisecondsSinceEpoch;
           return statusBtn(time > 0 ? ('最迟在' + getCountDown(time) + '后结算') : '等待结算');
           return statusBtn(time > 0 ? ('最迟在' + getCountDown(time) + '后结算') : '等待结算');
         }
         }
         break;
         break;
@@ -217,7 +358,7 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
   }
   }
 
 
   Widget startBtn() {
   Widget startBtn() {
-    final time = mHouseInfo.createTime + 600000 - DateTime.now().millisecondsSinceEpoch;
+    final time = widget.houseInfo.createTime + 600000 - DateTime.now().millisecondsSinceEpoch;
     return Container(
     return Container(
       margin: EdgeInsets.fromLTRB(15, 0, 15, 10),
       margin: EdgeInsets.fromLTRB(15, 0, 15, 10),
       child: SizedBox(
       child: SizedBox(
@@ -249,7 +390,7 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
   }
   }
 
 
   Widget countDownBtn() {
   Widget countDownBtn() {
-    final time = mHouseInfo.createTime + 600000 - DateTime.now().millisecondsSinceEpoch;
+    final time = widget.houseInfo.createTime + 600000 - DateTime.now().millisecondsSinceEpoch;
     String text = '';
     String text = '';
     if (time >= 0) {
     if (time >= 0) {
       text = '预计${getCountDown(time)}后开始比赛';
       text = '预计${getCountDown(time)}后开始比赛';
@@ -291,12 +432,6 @@ class _RoomInfoDetailState extends State<RoomInfoDetail> {
     );
     );
   }
   }
 
 
-  void setHouseInfo(HouseInfo houseInfo) {
-    setState(() {
-      mHouseInfo = houseInfo;
-    });
-  }
-
   String getCountDown(int time) {
   String getCountDown(int time) {
     if (time == null) {
     if (time == null) {
       return '';
       return '';

+ 69 - 11
lib/pages/RoomInfoNew.dart

@@ -1,9 +1,12 @@
 import 'dart:async';
 import 'dart:async';
 
 
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_redux/flutter_redux.dart';
 import 'package:url_launcher/url_launcher.dart';
 import 'package:url_launcher/url_launcher.dart';
+import 'package:battery/battery.dart';
 import 'package:wanna_battle/model/PlayerInfo.dart';
 import 'package:wanna_battle/model/PlayerInfo.dart';
 import 'package:wanna_battle/pages/RoomInfoDetail.dart';
 import 'package:wanna_battle/pages/RoomInfoDetail.dart';
+import 'package:wanna_battle/redux/AppState.dart';
 import '../model/HouseInfo.dart';
 import '../model/HouseInfo.dart';
 import '../Constants.dart';
 import '../Constants.dart';
 import '../styles/colors.dart';
 import '../styles/colors.dart';
@@ -12,10 +15,12 @@ import '../net/Result.dart';
 import '../plugins/ScreenStramPlugin.dart';
 import '../plugins/ScreenStramPlugin.dart';
 import './StartWindow.dart';
 import './StartWindow.dart';
 import '../widget/Dialog.dart';
 import '../widget/Dialog.dart';
+import 'SecondRoomInfo.dart';
 
 
 class RoomInfo extends StatefulWidget {
 class RoomInfo extends StatefulWidget {
   final HouseInfo houseInfo;
   final HouseInfo houseInfo;
-  RoomInfo(this.houseInfo, {Key key}) : super(key: key);
+  final PlayerInfo playerInfo;
+  RoomInfo(this.houseInfo, {Key key, this.playerInfo}) : super(key: key);
   @override
   @override
   State<StatefulWidget> createState() {
   State<StatefulWidget> createState() {
     return _RoomInfoState();
     return _RoomInfoState();
@@ -27,21 +32,43 @@ class _RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
   PlayerInfo mPlayerInfo;
   PlayerInfo mPlayerInfo;
   TabController tabController;
   TabController tabController;
   RoomInfoDetail roomInfoDetail;
   RoomInfoDetail roomInfoDetail;
+  int finishedPlayerNum = 0;
+  Timer timer;
+
+  final Key key1 = GlobalKey<RoomInfoDetailState>();
+  final Key key2 = GlobalKey<SecondPageState>();
 
 
   @override
   @override
   void initState() {
   void initState() {
     super.initState();
     super.initState();
     mHouseInfo = widget.houseInfo;
     mHouseInfo = widget.houseInfo;
+    mPlayerInfo = widget.playerInfo;
     tabController = TabController(
     tabController = TabController(
       length: 2,
       length: 2,
       vsync: this,
       vsync: this,
     );
     );
+    Future.delayed(Duration.zero, () {
+      refreshData();
+    });
+    if (mHouseInfo.statusFlag == HouseStatus.WAIT) {
+      timer = Timer.periodic(Duration(seconds: 1), (timer) async {
+        refreshData();
+      });
+      Future.delayed(Duration.zero, () async {
+        final battery = Battery();
+        final batteryLevel = await battery.batteryLevel;
+        showCustomDialog(context, (batteryLevel < 50 ? '系统检测到你的电量低于50%' : '') + ' 为了正常上传比赛结果,建议插上电源线保持电量充足', submitText: '知道了');
+      });
+    }
   }
   }
 
 
   @override
   @override
   void dispose() {
   void dispose() {
     super.dispose();
     super.dispose();
     tabController.dispose();
     tabController.dispose();
+    if (timer != null) {
+      timer.cancel();
+    }
   }
   }
 
 
   @override
   @override
@@ -69,10 +96,6 @@ class _RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
           actions: <Widget>[
           actions: <Widget>[
             Container(
             Container(
               padding: EdgeInsets.only(right: 30, left: 20),
               padding: EdgeInsets.only(right: 30, left: 20),
-              child: Image.asset(
-                'images/icon_fenxiang.png',
-                width: 24,
-              ),
             )
             )
           ],
           ],
         ),
         ),
@@ -84,31 +107,68 @@ class _RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
                 builder: (context) {
                 builder: (context) {
                   roomInfoDetail = RoomInfoDetail(
                   roomInfoDetail = RoomInfoDetail(
                     mHouseInfo,
                     mHouseInfo,
+                    mPlayerInfo,
                     onStart: () {
                     onStart: () {
                       showStart();
                       showStart();
                     },
                     },
+                    key: key1,
+                    finishedPlayerNum: finishedPlayerNum,
                   );
                   );
                   return roomInfoDetail;
                   return roomInfoDetail;
                 },
                 },
               ),
               ),
-              Container()
+              SecondPage(mHouseInfo, key: key2, playerInfo: mPlayerInfo),
             ],
             ],
           ),
           ),
         ),
         ),
       ),
       ),
       onWillPop: () {
       onWillPop: () {
+        if ((mHouseInfo?.statusFlag ?? 0) == 0) {
+          showCustomDialog(context, '比赛即将开始,确定离开房间?', isCancel: true, onsubmit: () {
+            Navigator.of(context).pop();
+          });
+          return Future.value(false);
+        }
         return Future.value(true);
         return Future.value(true);
       },
       },
     );
     );
   }
   }
 
 
-  Future<void> refreshData() async {}
+  Future<void> refreshData() async {
+    HttpManager.get('houseInfo/getOne', data: {'id': mHouseInfo.id}).then((res) {
+      if (res.success) {
+        if (mHouseInfo.statusFlag == 0 && res.data['statusFlag'] == 2) {
+          showStart();
+        }
+        setState(() {
+          mHouseInfo = HouseInfo.fromJson(res.data);
+        });
+      }
+    });
+    HttpManager.get('playerInfo/getOne', data: {
+      'userId': StoreProvider.of<AppState>(context).state.userInfo.id,
+      'houseId': mHouseInfo.id,
+    }).then((res) {
+      if (res.success) {
+        setState(() {
+          mPlayerInfo = PlayerInfo.fromJson(res.data);
+        });
+      }
+    });
+    HttpManager.get('playerInfo/endNum', data: {'houseId': mHouseInfo.id}).then((res) {
+      if (res.success) {
+        setState(() {
+          finishedPlayerNum = res.data;
+        });
+      }
+    });
+  }
 
 
   Future<void> showStart() async {
   Future<void> showStart() async {
     if (mPlayerInfo == null) {
     if (mPlayerInfo == null) {
       return;
       return;
     }
     }
-    bool result = await Navigator.of(context).push<bool>(
+    final result = await Navigator.of(context).push(
       PageRouteBuilder(
       PageRouteBuilder(
         opaque: false,
         opaque: false,
         transitionDuration: Duration(milliseconds: 300),
         transitionDuration: Duration(milliseconds: 300),
@@ -149,8 +209,6 @@ class _RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
           Timer(Duration(seconds: 10), () {
           Timer(Duration(seconds: 10), () {
             showSucessInfo();
             showSucessInfo();
           });
           });
-
-          throw 'Could not launch $url';
         }
         }
       } else {
       } else {
         showStartFailDialog(success ? 1 : 0);
         showStartFailDialog(success ? 1 : 0);
@@ -176,6 +234,6 @@ class _RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
   }
   }
 
 
   void showStartFailDialog(type) {
   void showStartFailDialog(type) {
-    showCustomDialog(context, type == 1 ? '由于您未在十秒内点击开始按钮' : '由于您未授权录屏' ',系统已经判定您放弃比赛,谢谢您的参与。', title: '很遗憾');
+    showCustomDialog(context, (type == 1 ? '由于您未在十秒内点击开始按钮' : '由于您未授权录屏') + ',系统已经判定您放弃比赛,谢谢您的参与。', title: '很遗憾');
   }
   }
 }
 }

+ 106 - 37
lib/pages/SecondRoomInfo.dart

@@ -1,6 +1,8 @@
 import 'package:cached_network_image/cached_network_image.dart';
 import 'package:cached_network_image/cached_network_image.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_redux/flutter_redux.dart';
 import 'package:wanna_battle/model/HouseInfo.dart';
 import 'package:wanna_battle/model/HouseInfo.dart';
+import 'package:wanna_battle/redux/AppState.dart';
 import '../model/PlayerInfo.dart';
 import '../model/PlayerInfo.dart';
 import 'dart:async';
 import 'dart:async';
 import '../styles/totast.dart';
 import '../styles/totast.dart';
@@ -9,10 +11,12 @@ import '../net/Result.dart';
 import '../styles/colors.dart';
 import '../styles/colors.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/cupertino.dart';
 import 'VideoPlayer.dart';
 import 'VideoPlayer.dart';
+import '../Constants.dart';
 
 
 class SecondPage extends StatefulWidget {
 class SecondPage extends StatefulWidget {
-  SecondPage(this.houseInfo, {Key key}) : super(key: key);
+  SecondPage(this.houseInfo, {Key key, this.playerInfo}) : super(key: key);
   final HouseInfo houseInfo; // 用来储存传递过来的值
   final HouseInfo houseInfo; // 用来储存传递过来的值
+  final PlayerInfo playerInfo;
   @override
   @override
   SecondPageState createState() => SecondPageState();
   SecondPageState createState() => SecondPageState();
 }
 }
@@ -30,11 +34,10 @@ class SecondPageState extends State<SecondPage> {
     Result res = await HttpManager.get('playerInfo/rankPage', data: {'houseId': widget.houseInfo.id, 'currentPage': currentPage, 'pageNumber': 20});
     Result res = await HttpManager.get('playerInfo/rankPage', data: {'houseId': widget.houseInfo.id, 'currentPage': currentPage, 'pageNumber': 20});
     Toast.hide();
     Toast.hide();
     List<PlayerInfo> list = joinList;
     List<PlayerInfo> list = joinList;
-    if (currentPage == 1) {
-      list = [];
-    }
     if (res.success) {
     if (res.success) {
-      print(res.data['pp']);
+      if (currentPage == 1) {
+        list = [];
+      }
       for (var item in res.data['pp']) {
       for (var item in res.data['pp']) {
         PlayerInfo jonPlayer = PlayerInfo.fromJson(item);
         PlayerInfo jonPlayer = PlayerInfo.fromJson(item);
         list.add(jonPlayer);
         list.add(jonPlayer);
@@ -74,37 +77,103 @@ class SecondPageState extends State<SecondPage> {
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
-    return RefreshIndicator(
-      color: PRIMARY_COLOR,
-      backgroundColor: Colors.white,
-      displacement: 10,
-      onRefresh: () async {
-        await Future.delayed(const Duration(seconds: 1));
-        currentPage = 1;
-        getPlayerPage();
-      },
-      child: Container(
-        color: Color(0x1A000000),
-        child: ListView.builder(
-            physics: AlwaysScrollableScrollPhysics(),
-            padding: EdgeInsets.only(top: 10),
-            controller: _perController,
-            itemCount: joinList.length + 1,
-            itemBuilder: (BuildContext context, int index) {
-              if (index < joinList.length) {
-                return playerItem(joinList[index], index);
-              } else {
-                return Container(
-                  padding: EdgeInsets.all(15),
-                  child: Text(
-                    '其他人员正在火速赶来中...',
-                    style: TextStyle(color: Colors.white30),
-                    textAlign: TextAlign.center,
-                  ),
-                );
-              }
-            }),
-      ),
+    return Column(
+      children: <Widget>[
+        Expanded(
+          child: RefreshIndicator(
+            color: PRIMARY_COLOR,
+            backgroundColor: Colors.white,
+            displacement: 10,
+            onRefresh: () async {
+              await Future.delayed(const Duration(seconds: 1));
+              currentPage = 1;
+              getPlayerPage();
+            },
+            child: Container(
+              color: Color(0x1A000000),
+              child: ListView.builder(
+                  physics: AlwaysScrollableScrollPhysics(),
+                  padding: EdgeInsets.only(top: 10),
+                  controller: _perController,
+                  itemCount: joinList.length + 1,
+                  itemBuilder: (BuildContext context, int index) {
+                    if (index < joinList.length) {
+                      return playerItem(joinList[index], index);
+                    } else {
+                      return Container(
+                        padding: EdgeInsets.all(15),
+                        child: Text(
+                          '其他人员正在火速赶来中...',
+                          style: TextStyle(color: Colors.white30),
+                          textAlign: TextAlign.center,
+                        ),
+                      );
+                    }
+                  }),
+            ),
+          ),
+        ),
+        widget.houseInfo.statusFlag == HouseStatus.SETTLEMENT && widget.playerInfo != null
+            ? Container(
+                height: 60,
+                color: SUB_COLOR,
+                padding: EdgeInsets.only(right: 15),
+                child: Row(
+                  children: <Widget>[
+                    Container(
+                      width: 57,
+                      child: Center(
+                        child: Container(
+                          width: 22,
+                          height: 22,
+                          color: Color(0x33FFFFFF),
+                          child: Center(
+                            child: Text(
+                              widget.playerInfo?.houseRank?.toString() ?? '',
+                              style: TextStyle(color: Colors.white, fontSize: 12),
+                            ),
+                          ),
+                        ),
+                      ),
+                    ),
+                    Container(
+                      margin: EdgeInsets.only(right: 12),
+                      child: ClipOval(
+                        child: CachedNetworkImage(
+                          width: 36,
+                          height: 36,
+                          imageUrl: StoreProvider.of<AppState>(context).state.userInfo.icon,
+                        ),
+                      ),
+                    ),
+                    Expanded(
+                      flex: 1,
+                      child: Text(
+                        StoreProvider.of<AppState>(context).state.userInfo.nickname,
+                        style: TextStyle(
+                          color: PRIMARY_COLOR,
+                          fontSize: 14,
+                        ),
+                        maxLines: 1,
+                        overflow: TextOverflow.ellipsis,
+                      ),
+                    ),
+                    Container(
+                      margin: EdgeInsets.only(right: 3),
+                      child: Image.asset(
+                        'images/icon_jifen_da.png',
+                        width: 20,
+                      ),
+                    ),
+                    Text(
+                      widget.playerInfo?.points?.toString() ?? '0',
+                      style: TextStyle(color: Colors.yellow, fontSize: 14, fontWeight: FontWeight.bold),
+                    )
+                  ],
+                ),
+              )
+            : Container()
+      ],
     );
     );
   }
   }
 
 
@@ -113,7 +182,7 @@ class SecondPageState extends State<SecondPage> {
       width: double.infinity,
       width: double.infinity,
       height: 60,
       height: 60,
       color: BG_COLOR,
       color: BG_COLOR,
-      padding: EdgeInsets.only(left: 10, right: 15),
+      padding: EdgeInsets.only(right: 15),
       margin: EdgeInsets.only(top: 1),
       margin: EdgeInsets.only(top: 1),
       child: Container(
       child: Container(
         decoration: BoxDecoration(border: Border(bottom: BorderSide(width: 1, color: BG_SUB_COLOR, style: BorderStyle.solid))),
         decoration: BoxDecoration(border: Border(bottom: BorderSide(width: 1, color: BG_SUB_COLOR, style: BorderStyle.solid))),

+ 9 - 3
lib/pages/TipInfo.dart

@@ -8,7 +8,7 @@ import '../net/HttpManager.dart';
 import '../net/Result.dart';
 import '../net/Result.dart';
 import '../model/HouseInfo.dart';
 import '../model/HouseInfo.dart';
 import '../model/GameInfo.dart';
 import '../model/GameInfo.dart';
-import '../pages/RoomInfo.dart';
+import '../pages/RoomInfoNew.dart';
 import '../widget/SuccessfulReception.dart';
 import '../widget/SuccessfulReception.dart';
 
 
 class TipInfo extends StatefulWidget {
 class TipInfo extends StatefulWidget {
@@ -194,7 +194,7 @@ class TipInfoState extends State<TipInfo> {
                       ),
                       ),
                       Text(
                       Text(
                         houseInfo.houseName,
                         houseInfo.houseName,
-                        style: TextStyle(fontSize: 12, fontWeight:  FontWeight.normal, color: Color(0xFF9BA0AE)),
+                        style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal, color: Color(0xFF9BA0AE)),
                         maxLines: 2,
                         maxLines: 2,
                         overflow: TextOverflow.ellipsis,
                         overflow: TextOverflow.ellipsis,
                       )
                       )
@@ -215,7 +215,13 @@ class TipInfoState extends State<TipInfo> {
             ),
             ),
           ),
           ),
           onTap: () {
           onTap: () {
-            Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(houseInfo)));
+            Navigator.push(
+                context,
+                CupertinoPageRoute(
+                    builder: (context) => RoomInfo(
+                          houseInfo,
+                          playerInfo: notice.playerInfo,
+                        )));
           },
           },
         ),
         ),
       ),
       ),

+ 1 - 1
lib/pages/TipList.dart

@@ -82,7 +82,7 @@ class TipListState extends State<TipList> {
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     return Scaffold(
     return Scaffold(
       appBar: AppBar(
       appBar: AppBar(
-        title: Text('邮件列表'),
+        title: Text('消息列表'),
         centerTitle: true,
         centerTitle: true,
         elevation: 0,
         elevation: 0,
       ),
       ),

+ 4 - 0
lib/widget/Dialog.dart

@@ -68,6 +68,8 @@ class LoadingDialog extends Dialog {
                                     Container(
                                     Container(
                                       width: 100,
                                       width: 100,
                                       child: RaisedButton(
                                       child: RaisedButton(
+                                        elevation: 0,
+                                        highlightElevation: 0,
                                         color: Color(0xFF3A3D5C),
                                         color: Color(0xFF3A3D5C),
                                         highlightColor: Color(0xFF3A3D5C).withOpacity(0.8),
                                         highlightColor: Color(0xFF3A3D5C).withOpacity(0.8),
                                         textColor: Colors.white,
                                         textColor: Colors.white,
@@ -83,6 +85,8 @@ class LoadingDialog extends Dialog {
                                       child: RaisedButton(
                                       child: RaisedButton(
                                         textColor: Colors.white,
                                         textColor: Colors.white,
                                         child: Text(submitText),
                                         child: Text(submitText),
+                                        elevation: 0,
+                                        highlightElevation: 0,
                                         onPressed: () {
                                         onPressed: () {
                                           Navigator.of(context).pop();
                                           Navigator.of(context).pop();
                                           onsubmit();
                                           onsubmit();

+ 1 - 1
lib/widget/RoomItem.dart

@@ -3,7 +3,7 @@ import 'package:flutter/cupertino.dart';
 import 'dart:ui';
 import 'dart:ui';
 import '../model/HouseInfo.dart';
 import '../model/HouseInfo.dart';
 import '../model/GameInfo.dart';
 import '../model/GameInfo.dart';
-import '../pages/RoomInfo.dart';
+import '../pages/RoomInfoNew.dart';
 
 
 class HouseItem extends StatelessWidget {
 class HouseItem extends StatelessWidget {
   HouseItem({Key key, this.roomInfo, this.gameInfo}) : super(key: key);
   HouseItem({Key key, this.roomInfo, this.gameInfo}) : super(key: key);

+ 7 - 0
pubspec.lock

@@ -22,6 +22,13 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "2.1.0"
     version: "2.1.0"
+  battery:
+    dependency: "direct main"
+    description:
+      name: battery
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.3.0+4"
   boolean_selector:
   boolean_selector:
     dependency: transitive
     dependency: transitive
     description:
     description:

+ 2 - 1
pubspec.yaml

@@ -1,7 +1,7 @@
 name: wanna_battle
 name: wanna_battle
 description: A new Flutter project.
 description: A new Flutter project.
 
 
-version: 1.0.0+3
+version: 1.0.1+4
 
 
 environment:
 environment:
   sdk: ">=2.1.0 <3.0.0"
   sdk: ">=2.1.0 <3.0.0"
@@ -44,6 +44,7 @@ dependencies:
   install_plugin: ^2.0.1
   install_plugin: ^2.0.1
   open_file: ^2.0.3
   open_file: ^2.0.3
   permission_handler: ^3.1.0
   permission_handler: ^3.1.0
+  battery: ^0.3.0+4
 
 
 dev_dependencies:
 dev_dependencies:
   build_runner: ^1.1.1
   build_runner: ^1.1.1