x1ongzhu 6 سال پیش
والد
کامیت
970720a75d
7فایلهای تغییر یافته به همراه91 افزوده شده و 129 حذف شده
  1. 59 46
      lib/pages/CompetitionRooms.dart
  2. 1 1
      lib/pages/HomePage.bak.dart
  3. 1 1
      lib/pages/ShoppingMall.dart
  4. 1 1
      lib/pages/openRoom.dart
  5. 4 4
      lib/pages/roomInfo.dart
  6. 1 1
      lib/pages/setting.dart
  7. 24 75
      lib/widget/Dialog.dart

+ 59 - 46
lib/pages/CompetitionRooms.dart

@@ -1,3 +1,4 @@
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
 import 'package:flutter/widgets.dart';
 import 'package:wanna_battle/model/UserPlayTimes.dart';
 import 'package:wanna_battle/model/UserPlayTimes.dart';
@@ -7,6 +8,8 @@ import 'package:gradient_text/gradient_text.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 '../widget/Dialog.dart';
+import './RoomInfo.dart';
 
 
 class CompetitionRooms extends StatefulWidget {
 class CompetitionRooms extends StatefulWidget {
   CompetitionRooms(this.competitionInfo);
   CompetitionRooms(this.competitionInfo);
@@ -107,11 +110,16 @@ class _CompetitionRoomsState extends State<CompetitionRooms> {
             ),
             ),
           ),
           ),
           Expanded(
           Expanded(
+              child: RefreshIndicator(
+            onRefresh: () {
+              _getPlayTimes();
+              return _getRooms();
+            },
             child: ListView(
             child: ListView(
               padding: EdgeInsets.only(bottom: 10),
               padding: EdgeInsets.only(bottom: 10),
               children: houseList.map((f) => _Room(f)).toList(),
               children: houseList.map((f) => _Room(f)).toList(),
             ),
             ),
-          )
+          ))
         ],
         ],
       ),
       ),
     );
     );
@@ -182,57 +190,62 @@ class _Room extends StatelessWidget {
         imgSrc = 'images/icon_yijiesu.png';
         imgSrc = 'images/icon_yijiesu.png';
         break;
         break;
     }
     }
-    return Container(
-      height: 43,
-      margin: EdgeInsets.fromLTRB(15, 10, 15, 0),
-      decoration: BoxDecoration(
-        color: backgroundColor,
-        border: Border.all(color: borderColor, width: 2),
-      ),
-      child: Row(
-        children: <Widget>[
-          Expanded(
-            child: Container(
-              margin: EdgeInsets.only(left: 13),
-              child: Text(
-                houseInfo.houseName,
-                style: TextStyle(fontSize: 14, color: Colors.white),
+    return GestureDetector(
+      onTap: () {
+        Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(roomId: houseInfo.id.toString())));
+      },
+      child: Container(
+        height: 43,
+        margin: EdgeInsets.fromLTRB(15, 10, 15, 0),
+        decoration: BoxDecoration(
+          color: backgroundColor,
+          border: Border.all(color: borderColor, width: 2),
+        ),
+        child: Row(
+          children: <Widget>[
+            Expanded(
+              child: Container(
+                margin: EdgeInsets.only(left: 13),
+                child: Text(
+                  houseInfo.houseName,
+                  style: TextStyle(fontSize: 14, color: Colors.white),
+                ),
               ),
               ),
             ),
             ),
-          ),
-          Container(
-            width: 105,
-            child: RichText(
-              text: TextSpan(
-                style: TextStyle(color: Colors.white, fontSize: 11),
-                children: <TextSpan>[
-                  TextSpan(text: '参赛人数:'),
-                  TextSpan(text: houseInfo.playerNumber.toString(), style: TextStyle(color: Color(0xFF38A968))),
-                  TextSpan(text: '/${houseInfo.maxNumber}'),
-                ],
+            Container(
+              width: 105,
+              child: RichText(
+                text: TextSpan(
+                  style: TextStyle(color: Colors.white, fontSize: 11),
+                  children: <TextSpan>[
+                    TextSpan(text: '参赛人数:'),
+                    TextSpan(text: houseInfo.playerNumber.toString(), style: TextStyle(color: Color(0xFF38A968))),
+                    TextSpan(text: '/${houseInfo.maxNumber}'),
+                  ],
+                ),
               ),
               ),
             ),
             ),
-          ),
-          Container(
-            width: 60,
-            height: 43,
-            padding: EdgeInsets.only(left: 10),
-            alignment: Alignment.center,
-            decoration: BoxDecoration(
-              image: DecorationImage(
-                image: AssetImage(imgSrc),
-                fit: BoxFit.cover,
+            Container(
+              width: 60,
+              height: 43,
+              padding: EdgeInsets.only(left: 10),
+              alignment: Alignment.center,
+              decoration: BoxDecoration(
+                image: DecorationImage(
+                  image: AssetImage(imgSrc),
+                  fit: BoxFit.cover,
+                ),
               ),
               ),
-            ),
-            child: Text(
-              status,
-              style: TextStyle(
-                color: Colors.white,
-                fontSize: 14,
+              child: Text(
+                status,
+                style: TextStyle(
+                  color: Colors.white,
+                  fontSize: 14,
+                ),
               ),
               ),
-            ),
-          )
-        ],
+            )
+          ],
+        ),
       ),
       ),
     );
     );
   }
   }

+ 1 - 1
lib/pages/HomePage.bak.dart

@@ -44,7 +44,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
   }
   }
 
 
   void showBackDialog() {
   void showBackDialog() {
-    MyDialog.showDialog(context, '暂时没有进行中的房间,敬请期待...');
+     showCustomDialog(context, '暂时没有进行中的房间,敬请期待...');
     // showDialog<Null>(
     // showDialog<Null>(
     //   context: context,
     //   context: context,
     //   barrierDismissible: false,
     //   barrierDismissible: false,

+ 1 - 1
lib/pages/ShoppingMall.dart

@@ -93,7 +93,7 @@ class RechargeState extends State<Recharge> {
     Result res = await HttpManager.get('alertMessage/getOne', data: {'id': id});
     Result res = await HttpManager.get('alertMessage/getOne', data: {'id': id});
     Toast.hide();
     Toast.hide();
     if (res.success) {
     if (res.success) {
-      MyDialog.showDialog(context, res.data['remark']);
+      showCustomDialog(context, res.data['remark']);
     }
     }
   }
   }
 
 

+ 1 - 1
lib/pages/openRoom.dart

@@ -57,7 +57,7 @@ class OpenRoomState extends State<OpenRoom> {
     Result res = await HttpManager.get('alertMessage/getOne', data: {'id': id});
     Result res = await HttpManager.get('alertMessage/getOne', data: {'id': id});
     Toast.hide();
     Toast.hide();
     if (res.success) {
     if (res.success) {
-      MyDialog.showDialog(context, res.data['remark']);
+      showCustomDialog(context, res.data['remark']);
     }
     }
   }
   }
 
 

+ 4 - 4
lib/pages/roomInfo.dart

@@ -145,7 +145,7 @@ class RoomInfoState extends State<RoomInfo>
             showSucessInfo();
             showSucessInfo();
           });
           });
         } else {
         } else {
-          MyDialog.showDialog(context, '自动启动游戏失败,请手动切换到游戏app开始竞赛',
+          showCustomDialog(context, '自动启动游戏失败,请手动切换到游戏app开始竞赛',
               submitText: '知道了');
               submitText: '知道了');
           Timer(Duration(seconds: 10), () {
           Timer(Duration(seconds: 10), () {
             showSucessInfo();
             showSucessInfo();
@@ -161,7 +161,7 @@ class RoomInfoState extends State<RoomInfo>
 
 
 //开始录屏提示框
 //开始录屏提示框
   void showSucessInfo() {
   void showSucessInfo() {
-    MyDialog.showDialog(context, '您已经完成比赛了吗,确认完成,那就点击下方完成竞赛按钮,上传本次成绩,祝您赢取大奖',
+    showCustomDialog(context, '您已经完成比赛了吗,确认完成,那就点击下方完成竞赛按钮,上传本次成绩,祝您赢取大奖',
         title: '完成比赛', submitText: '我已完成比赛', onsubmit: () async {
         title: '完成比赛', submitText: '我已完成比赛', onsubmit: () async {
       HttpManager.post('playerInfo/update',
       HttpManager.post('playerInfo/update',
           data: {'id': playerInfo.id, 'statusFlag': 3});
           data: {'id': playerInfo.id, 'statusFlag': 3});
@@ -201,7 +201,7 @@ class RoomInfoState extends State<RoomInfo>
 
 
 //未确认比赛弹窗
 //未确认比赛弹窗
   void showBackDialog(type) {
   void showBackDialog(type) {
-    MyDialog.showDialog(context,
+    showCustomDialog(context,
         (type == 1 ? '由于您未在十秒内点击开始按钮' : '由于您未授权录屏') + ',系统已经判定您放弃比赛,谢谢您的参与。',
         (type == 1 ? '由于您未在十秒内点击开始按钮' : '由于您未授权录屏') + ',系统已经判定您放弃比赛,谢谢您的参与。',
         title: '很遗憾');
         title: '很遗憾');
   }
   }
@@ -699,7 +699,7 @@ class RoomInfoState extends State<RoomInfo>
               )
               )
             ])),
             ])),
             onPressed: () {
             onPressed: () {
-              MyDialog.showDialog(context, '确认要开始比赛吗?', isCancel: true,
+              showCustomDialog(context, '确认要开始比赛吗?', isCancel: true,
                   onsubmit: () {
                   onsubmit: () {
                 print('开始');
                 print('开始');
                 startGame();
                 startGame();

+ 1 - 1
lib/pages/setting.dart

@@ -90,7 +90,7 @@ class SettingState extends State<Setting> {
                               _sectionDivier(),
                               _sectionDivier(),
                               _section([
                               _section([
                                 _cell('检查更新', ' ', onTap: () {
                                 _cell('检查更新', ' ', onTap: () {
-                                  MyDialog.showDialog(context, '您已是最新版本。');
+                                  showCustomDialog(context, '您已是最新版本。');
                                 }),
                                 }),
                                 _cell('版本号', version, showBorder: false),
                                 _cell('版本号', version, showBorder: false),
                               ]),
                               ]),

+ 24 - 75
lib/widget/Dialog.dart

@@ -3,37 +3,22 @@ import 'package:flutter/material.dart';
 //  void showSuccess(text) {
 //  void showSuccess(text) {
 
 
 //   }
 //   }
-
-class MyDialog {
-  static void showDialog(context, text,
-      {String title,
-      bool isCancel = false,
-      String submitText = '确认',
-      OnTapHomeMenu onsubmit,
-      OnTapHomeMenu oncancel}) {
-    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 LoadingDialog(
-              title: title,
-              text: text,
-              submitText: submitText,
-              cancel: isCancel,
-              onsubmit: onsubmit,
-              oncancel: oncancel);
-        },
-      ),
-    );
-  }
+void showCustomDialog(context, text, {String title, bool isCancel = false, String submitText = '确认', OnTapHomeMenu onsubmit, OnTapHomeMenu oncancel}) {
+  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 LoadingDialog(title: title, text: text, submitText: submitText, cancel: isCancel, onsubmit: onsubmit, oncancel: oncancel);
+      },
+    ),
+  );
 }
 }
 
 
 typedef OnTapHomeMenu = void Function();
 typedef OnTapHomeMenu = void Function();
@@ -47,64 +32,44 @@ class LoadingDialog extends Dialog {
   OnTapHomeMenu onsubmit = () {};
   OnTapHomeMenu onsubmit = () {};
   OnTapHomeMenu oncancel = () {};
   OnTapHomeMenu oncancel = () {};
 
 
-  LoadingDialog(
-      {Key key,
-      @required this.text,
-      this.cancel,
-      this.onsubmit,
-      this.oncancel,
-      this.title,
-      this.submitText})
-      : super(key: key);
+  LoadingDialog({Key key, @required this.text, this.cancel, this.onsubmit, this.oncancel, this.title, this.submitText}) : super(key: key);
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     return WillPopScope(
     return WillPopScope(
       child: Scaffold(
       child: Scaffold(
-        backgroundColor: Color(0xCC000000),
+        backgroundColor: Color(0xb3000000),
         body: Container(
         body: Container(
           child: SizedBox.expand(
           child: SizedBox.expand(
             child: UnconstrainedBox(
             child: UnconstrainedBox(
               child: Container(
               child: Container(
                 width: 270,
                 width: 270,
                 // padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
                 // padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
-                decoration: BoxDecoration(
-                    color: Color(0xFF15151D),
-                    border: Border.all(width: 1, color: Color(0xFFC2524D))),
+                decoration: BoxDecoration(color: Color(0xE6293559), border: Border.all(width: 1, color: Color(0xFF1990F8))),
                 child: Stack(
                 child: Stack(
                   children: <Widget>[
                   children: <Widget>[
                     Padding(
                     Padding(
-                      padding:
-                          EdgeInsets.symmetric(horizontal: 20, vertical: 25),
+                      padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
                       child: Column(
                       child: Column(
                         mainAxisAlignment: MainAxisAlignment.center,
                         mainAxisAlignment: MainAxisAlignment.center,
                         children: <Widget>[
                         children: <Widget>[
-                          Text(title ?? '提示',
-                              style: TextStyle(
-                                  color: Colors.white,
-                                  fontSize: 18,
-                                  fontWeight: FontWeight.w600)),
+                          Text(title ?? '提示', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)),
                           Container(
                           Container(
                             height: 20,
                             height: 20,
                           ),
                           ),
-                          Text(text,
-                              style:
-                                  TextStyle(color: Colors.white, fontSize: 14),
-                              textAlign: TextAlign.center),
+                          Text(text, style: TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.center),
                           Container(
                           Container(
                             height: 30,
                             height: 30,
                           ),
                           ),
                           cancel
                           cancel
                               ? Row(
                               ? Row(
-                                  mainAxisAlignment:
-                                      MainAxisAlignment.spaceBetween,
+                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                   children: <Widget>[
                                   children: <Widget>[
                                     Container(
                                     Container(
                                       width: 100,
                                       width: 100,
                                       child: RaisedButton(
                                       child: RaisedButton(
                                         color: Color(0xFF3A3D5C),
                                         color: Color(0xFF3A3D5C),
-                                        highlightColor:
-                                            Color(0xFF3A3D5C).withOpacity(0.8),
+                                        highlightColor: Color(0xFF3A3D5C).withOpacity(0.8),
                                         textColor: Colors.white,
                                         textColor: Colors.white,
                                         child: Text('取消'),
                                         child: Text('取消'),
                                         onPressed: () {
                                         onPressed: () {
@@ -143,22 +108,6 @@ class LoadingDialog extends Dialog {
                         ],
                         ],
                       ),
                       ),
                     ),
                     ),
-                    Positioned(
-                      top: 0,
-                      left: 0,
-                      child: Image.asset(
-                        'images/tancuang_shang.png',
-                        width: 131,
-                      ),
-                    ),
-                    Positioned(
-                      bottom: 0,
-                      right: 4,
-                      child: Image.asset(
-                        'images/tancuang_xia.png',
-                        width: 148,
-                      ),
-                    ),
                   ],
                   ],
                 ),
                 ),
               ),
               ),