x1ongzhu 6 лет назад
Родитель
Сommit
778a207213
5 измененных файлов с 93 добавлено и 121 удалено
  1. 4 0
      lib/main.dart
  2. 0 26
      lib/main1.dart
  3. 9 11
      lib/pages/CreateRoom.dart
  4. 4 5
      lib/pages/HomePage.dart
  5. 76 79
      lib/widgets/HomeDrawer.dart

+ 4 - 0
lib/main.dart

@@ -1,3 +1,4 @@
+import 'package:flutter/services.dart';
 import 'package:redux/redux.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_redux/flutter_redux.dart';
@@ -24,6 +25,9 @@ class MobileCyberGamesApp extends StatelessWidget {
 }
 
 void main() async {
+  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light.copyWith(
+    statusBarColor: Colors.transparent,
+  ));
   final prefs = await SharedPreferences.getInstance();
   HttpManager.token = prefs.getString('token') ??
       "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkOWU0MDdhNy1iODU2LTQ0ZjAtYmM1Yy0yMGI4NmY4MWM4MTEiLCJpc3MiOiJhZG1pbiIsImlhdCI6MTU1MDczODk4MCwic3ViIjoiODQ2NjQiLCJleHAiOjE1NTA5OTgxODB9.sowgrK2LHLiVAZL4MFC2rgapD9ves8nCyZKlKaWtydY";

+ 0 - 26
lib/main1.dart

@@ -1,26 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:redux/redux.dart';
-import 'pages/home.dart';
-import 'state.dart';
-
-CountState updateState(CountState state, dynamic value) {
-  print(value);
-  if (value['action'] == Actions.updateToken) {
-    state.usetoken = value['val'];
-    return state;
-  } else if (value['action'] == Actions.updateUser) {
-    state.userInfo = value['val'];
-    return state;
-  } else if (value['action'] == Actions.updateAll) {
-    state.usetoken = value['token'];
-    state.userInfo = value['user'];
-    return state;
-  }
-  return state;
-}
-
-void main() {
-  final store =
-      Store<CountState>(updateState, initialState: CountState.initState());
-  runApp(new MyApp(store));
-}

+ 9 - 11
lib/pages/CreateRoom.dart

@@ -11,17 +11,15 @@ class CreateRoom extends StatelessWidget {
         backgroundColor: Color(0xCC000000),
         body: Container(
           child: SizedBox.expand(
-            child: SizedBox.shrink(
-              child: Column(
-                mainAxisAlignment: MainAxisAlignment.center,
-                children: <Widget>[
-                  _CreateRoomBtn("创建普通房间"),
-                  SizedBox(
-                    height: 36,
-                  ),
-                  _CreateRoomBtn("创建官方房间")
-                ],
-              ),
+            child: Column(
+              mainAxisAlignment: MainAxisAlignment.center,
+              children: <Widget>[
+                _CreateRoomBtn("创建普通房间"),
+                SizedBox(
+                  height: 36,
+                ),
+                _CreateRoomBtn("创建官方房间")
+              ],
             ),
           ),
         ),

+ 4 - 5
lib/pages/HomePage.dart

@@ -148,6 +148,7 @@ class _HomePageState extends State<HomePage> {
               ),
               Container(
                 child: GridView.count(
+                  physics: new BouncingScrollPhysics(),
                   shrinkWrap: true,
                   crossAxisCount: 2,
                   children: <Widget>[
@@ -229,13 +230,11 @@ class HomeMenu extends StatelessWidget {
               child: Column(
                 mainAxisAlignment: MainAxisAlignment.center,
                 children: <Widget>[
-                  SizedBox(
+                  Image.asset(
+                    icon,
+                    fit: BoxFit.contain,
                     width: 44,
                     height: 34,
-                    child: FittedBox(
-                      fit: BoxFit.contain,
-                      child: Image.asset(icon),
-                    ),
                   ),
                   Text(
                     title,

+ 76 - 79
lib/widgets/HomeDrawer.dart

@@ -17,90 +17,87 @@ class HomeDrawer extends StatelessWidget {
             begin: Alignment.bottomRight,
             colors: [Color(0xFF3D3E6C), Color(0xFF626C85)],
           )),
-          child: SafeArea(
-            child: Column(
-              children: <Widget>[
-                Container(
-                  decoration: BoxDecoration(color: Color(0x4D000000)),
-                  child: SizedBox(
-                    width: double.infinity,
-                    height: 210,
-                    child: Row(
-                      mainAxisAlignment: MainAxisAlignment.center,
-                      children: <Widget>[
-                        ClipOval(
-                          child: SizedBox(
-                              width: 86,
-                              height: 86,
-                              child: FittedBox(
-                                  fit: BoxFit.cover,
-                                  child: Image.network(userInfo.icon))),
+          child: Column(
+            children: <Widget>[
+              Container(
+                height: 210,
+                decoration: BoxDecoration(color: Color(0x4D000000)),
+                child: SafeArea(
+                  child: Row(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    children: <Widget>[
+                      ClipOval(
+                        child: Image.network(
+                          userInfo.icon,
+                          width: 86,
+                          height: 86,
+                          fit: BoxFit.cover,
                         ),
-                        Container(
-                          margin: EdgeInsets.only(left: 16),
-                          child: Column(
-                            mainAxisAlignment: MainAxisAlignment.center,
-                            crossAxisAlignment: CrossAxisAlignment.start,
-                            children: <Widget>[
-                              Text(
-                                userInfo.nickname,
-                                style: TextStyle(
-                                    fontSize: 27,
-                                    color: Colors.white,
-                                    fontWeight: FontWeight.w700),
-                              ),
-                              Row(
-                                mainAxisAlignment: MainAxisAlignment.center,
-                                children: <Widget>[
-                                  Container(
-                                    margin: EdgeInsets.only(right: 4),
-                                    child: SizedBox(
-                                      width: 20,
-                                      height: 20,
-                                      child: Image.asset(
-                                          "images/icon_jinbi_da_bai.png"),
-                                    ),
+                      ),
+                      Container(
+                        margin: EdgeInsets.only(left: 16),
+                        child: Column(
+                          mainAxisAlignment: MainAxisAlignment.center,
+                          crossAxisAlignment: CrossAxisAlignment.start,
+                          children: <Widget>[
+                            Text(
+                              userInfo.nickname,
+                              style: TextStyle(
+                                  fontSize: 27,
+                                  color: Colors.white,
+                                  fontWeight: FontWeight.w700),
+                            ),
+                            Row(
+                              mainAxisAlignment: MainAxisAlignment.center,
+                              children: <Widget>[
+                                Container(
+                                  margin: EdgeInsets.only(right: 4),
+                                  child: SizedBox(
+                                    width: 20,
+                                    height: 20,
+                                    child: Image.asset(
+                                        "images/icon_jinbi_da_bai.png"),
                                   ),
-                                  Text(
-                                    userInfo.moneyCoin.toString(),
-                                    style: TextStyle(
-                                        fontSize: 16,
-                                        color: Colors.white,
-                                        fontWeight: FontWeight.w700),
-                                  )
-                                ],
-                              ),
-                            ],
-                          ),
-                        )
-                      ],
-                    ),
+                                ),
+                                Text(
+                                  userInfo.moneyCoin.toString(),
+                                  style: TextStyle(
+                                      fontSize: 16,
+                                      color: Colors.white,
+                                      fontWeight: FontWeight.w700),
+                                )
+                              ],
+                            ),
+                          ],
+                        ),
+                      )
+                    ],
                   ),
                 ),
-                Expanded(
-                  flex: 1,
-                  child: Container(
-                    padding: EdgeInsets.only(top: 10),
-                    child: Column(
-                      children: <Widget>[
-                        DrawerMenu(
-                          "images/icon_qianbao.png",
-                          "我的钱包",
-                          onTap: () {
-                            print("object");
-                            Navigator.of(context).pop();
-                          },
-                        ),
-                        Divder(),
-                        DrawerMenu("images/icon_zhanji.png", "我的战绩"),
-                        Divder(),
-                        DrawerMenu("images/icon_bangding.png", "游戏绑定")
-                      ],
-                    ),
+              ),
+              Expanded(
+                flex: 1,
+                child: Container(
+                  padding: EdgeInsets.only(top: 10),
+                  child: Column(
+                    children: <Widget>[
+                      DrawerMenu(
+                        "images/icon_qianbao.png",
+                        "我的钱包",
+                        onTap: () {
+                          print("object");
+                          Navigator.of(context).pop();
+                        },
+                      ),
+                      Divder(),
+                      DrawerMenu("images/icon_zhanji.png", "我的战绩"),
+                      Divder(),
+                      DrawerMenu("images/icon_bangding.png", "游戏绑定")
+                    ],
                   ),
-                )
-              ],
-            ),
+                ),
+              )
+            ],
           ),
         ));
       },