Просмотр исходного кода

Merge branch 'master' of http://git.izouma.com/panhui/mobileCyberGamesApp

x1ongzhu 6 лет назад
Родитель
Сommit
8cde143d0e

BIN
images/zhanji_icon_01.png


BIN
images/zhanji_icon_02.png


BIN
images/zhanji_icon_03.png


BIN
images/zhanji_icon_04.png


+ 0 - 2
lib/pages/Example.dart

@@ -11,8 +11,6 @@ class Rechrage extends StatefulWidget {
 class RechrageState extends State<Rechrage> {
   @override
   Widget build(BuildContext context) {
-
-
     return new WillPopScope(
         child: Scaffold(
         appBar: AppBar(

+ 1 - 7
lib/pages/HomePage.dart

@@ -39,15 +39,9 @@ class _HomePageState extends State<HomePage> {
       });
       print(seasonList);
     } else {}
-    getUserInfo();
   }
 
-  void getUserInfo() async {
-    Result res = await HttpManager.get("userInfo/getUserInfo");
-    if (res.success) {
-      StoreProvider.of<AppState>(context).dispatch({"action": Actions.updateUser, "user": res.data});
-    } else {}
-  }
+ 
 
   @override
   void initState() {

+ 25 - 22
lib/pages/RecordList.dart

@@ -109,21 +109,40 @@ class RecordListState extends State<RecordList> {
                       );
                     }
                     return houseItem(
-                      roomInfo: playerList[index].houseInfo,
-                      gameInfo: playerList[index].gameInfo,
-                    );
+                        roomInfo: playerList[index].houseInfo,
+                        gameInfo: playerList[index].gameInfo,
+                        playerInfo: playerList[index]);
                   })),
         ));
   }
 }
 
 class houseItem extends StatelessWidget {
-  houseItem({Key key, this.roomInfo, this.gameInfo}) : super(key: key);
+  houseItem({Key key, this.roomInfo, this.gameInfo, this.playerInfo})
+      : super(key: key);
   final HouseInfo roomInfo;
   final GameInfo gameInfo;
+  final PlayerInfo playerInfo;
+
   @override
   Widget build(BuildContext context) {
-    if(roomInfo==null){
+    List imageList = [
+      'images/zhanji_icon_01.png',
+      'images/zhanji_icon_02.png',
+      'images/zhanji_icon_03.png',
+      'images/zhanji_icon_04.png'
+    ];
+    String imageSrc = '';
+     print('****');
+    print(playerInfo.rank);
+    if (playerInfo.rank != null && playerInfo.rank != 0) {
+      if (playerInfo.rank < 4) {
+        imageSrc = imageList[playerInfo.rank - 1];
+      } else {
+        imageSrc = imageList[3];
+      }
+    }
+    if (roomInfo == null) {
       return Container();
     }
     return Container(
@@ -194,23 +213,7 @@ class houseItem extends StatelessWidget {
                     ],
                   ),
                 ),
-                Row(
-                  mainAxisAlignment: MainAxisAlignment.center,
-                  children: <Widget>[
-                    Image.asset('images/icon_renshu.png', width: 20),
-                    Text(
-                      (roomInfo.playerNumber != null
-                              ? roomInfo.playerNumber.toString()
-                              : '0') +
-                          '/' +
-                          roomInfo.maxNumber.toString(),
-                      style: TextStyle(
-                          fontSize: 14,
-                          fontWeight: FontWeight.w500,
-                          color: Color(0xFFB1B2C0)),
-                    )
-                  ],
-                )
+                // Image.asset(imageSrc,width:70)
               ],
             ),
           ),

+ 1 - 4
lib/pages/StartWindow.dart

@@ -70,9 +70,6 @@ class StartWindowState extends State<StartWindow> {
                           fontWeight: FontWeight.w600)),
                   _centerContent(),
                   Container(
-                    width: double.infinity,
-                    height: 44,
-                    padding: EdgeInsets.symmetric(vertical: 42),
                     child: RaisedButton(
                       textTheme: ButtonTextTheme.primary,
                       child: Text('确认'),
@@ -87,7 +84,7 @@ class StartWindowState extends State<StartWindow> {
           ),
         ),
         onWillPop: () {
-          return Future.value(false);
+          
         },
       ),
     );

+ 1 - 0
lib/pages/roomInfo.dart

@@ -229,6 +229,7 @@ class RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin
       getRoomInfo();
       checkJoinInfo();
       // showBackDialog();
+      // showStart();
     });
   }
 

+ 23 - 1
lib/widget/HomeDrawer.dart

@@ -7,8 +7,30 @@ import '../model/UserInfo.dart';
 import '../pages/MyWallet.dart'; //我的钱包
 import '../pages/BindGame.dart'; //游戏绑定
 import '../pages/RecordList.dart'; //我的战绩
+import '../net/HttpManager.dart';
+import '../net/Result.dart';
+import '../model/UserInfo.dart';
+import '../redux/AppState.dart';
+
+class HomeDrawer extends StatefulWidget {
+  @override
+  HomeDrawerState createState() => HomeDrawerState();
+}
 
-class HomeDrawer extends StatelessWidget {
+class HomeDrawerState extends State<HomeDrawer> {
+
+   void getUserInfo() async {
+    Result res = await HttpManager.get("userInfo/getUserInfo");
+    if (res.success) {
+      StoreProvider.of<AppState>(context).dispatch({"action": Actions.updateUser, "user": res.data});
+    } else {}
+  }
+  @override
+  void initState() {
+    // TODO: implement initState
+    super.initState();
+    Future.delayed(Duration(milliseconds: 100),()=>getUserInfo);
+  }
   @override
   Widget build(BuildContext context) {
     return StoreConnector<AppState, UserInfo>(