|
|
@@ -1,9 +1,8 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
|
-import 'package:mobile_cyber_game_app/redux/AppState.dart';
|
|
|
import '../widget/HomeDrawer.dart';
|
|
|
-import 'Setting.dart';
|
|
|
-import 'CreateRoom.dart';
|
|
|
+import './Setting.dart';
|
|
|
+import './CreateRoom.dart';
|
|
|
import 'RoomList.dart'; //房间列表
|
|
|
import 'rankList.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
@@ -15,6 +14,7 @@ import '../net/HttpManager.dart';
|
|
|
import '../net/Result.dart';
|
|
|
import 'TipList.dart';
|
|
|
import '../model/UserInfo.dart';
|
|
|
+import '../redux/AppState.dart';
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
@override
|
|
|
@@ -39,7 +39,6 @@ class _HomePageState extends State<HomePage> {
|
|
|
});
|
|
|
print(seasonList);
|
|
|
} else {}
|
|
|
-
|
|
|
getUserInfo();
|
|
|
}
|
|
|
|
|
|
@@ -67,10 +66,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
width: double.infinity,
|
|
|
height: double.infinity,
|
|
|
decoration: BoxDecoration(
|
|
|
- gradient: LinearGradient(colors: [
|
|
|
- Color.fromARGB(255, 177, 59, 56),
|
|
|
- Color.fromARGB(255, 147, 64, 61)
|
|
|
- ], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
|
|
|
+ gradient: LinearGradient(
|
|
|
+ colors: [Color.fromARGB(255, 177, 59, 56), Color.fromARGB(255, 147, 64, 61)], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
|
|
|
child: SafeArea(
|
|
|
child: centerWidget(context),
|
|
|
),
|
|
|
@@ -93,11 +90,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
loop: true,
|
|
|
onTap: (index) {
|
|
|
- Navigator.push(
|
|
|
- context,
|
|
|
- new CupertinoPageRoute(
|
|
|
- builder: (context) => new RankList(
|
|
|
- raceId: seasonList[index].id)));
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new RankList(raceId: seasonList[index].id)));
|
|
|
},
|
|
|
onIndexChanged: (index) {
|
|
|
setState(() {
|
|
|
@@ -114,64 +107,71 @@ class _HomePageState extends State<HomePage> {
|
|
|
Image.asset("images/home_icon_yuan.png"),
|
|
|
Center(
|
|
|
child: Row(
|
|
|
- mainAxisAlignment:
|
|
|
- MainAxisAlignment.center,
|
|
|
- crossAxisAlignment:
|
|
|
- CrossAxisAlignment.baseline,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.baseline,
|
|
|
textBaseline: TextBaseline.alphabetic,
|
|
|
children: <Widget>[
|
|
|
Text(
|
|
|
- (seasonList[index].bonus / 1000)
|
|
|
- .toStringAsFixed(1),
|
|
|
+ (seasonList[index].bonus / 1000).toStringAsFixed(1),
|
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
|
fontSize: 68,
|
|
|
fontFamily: 'DINEngschrift',
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- Positioned(
|
|
|
- bottom: 30,
|
|
|
- left: 0,
|
|
|
- right: 0,
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- // Text(
|
|
|
- // "当前排名",
|
|
|
- // style: TextStyle(
|
|
|
- // color: Colors.white, fontSize: 13),
|
|
|
- // ),
|
|
|
- // Text(
|
|
|
- // "98686",
|
|
|
- // style: TextStyle(
|
|
|
- // color: Colors.white, fontSize: 13),
|
|
|
- // )
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- )),
|
|
|
- ),
|
|
|
- )
|
|
|
- : Container()),
|
|
|
- Positioned(
|
|
|
- left: 0,
|
|
|
- top: 0,
|
|
|
- width: 48,
|
|
|
- height: 48,
|
|
|
- child: Material(
|
|
|
- color: Colors.transparent,
|
|
|
- child: Builder(
|
|
|
- builder: (context) => InkWell(
|
|
|
- onTap: () {
|
|
|
- Scaffold.of(context).openDrawer();
|
|
|
- },
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.all(12),
|
|
|
- child: Image.asset("images/home_icon_wode.png"),
|
|
|
- ),
|
|
|
+ Text(
|
|
|
+ "K",
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 36,
|
|
|
+ fontFamily: 'DINEngschrift',
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Positioned(
|
|
|
+ bottom: 30,
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ // Text(
|
|
|
+ // "当前排名",
|
|
|
+ // style: TextStyle(
|
|
|
+ // color: Colors.white, fontSize: 13),
|
|
|
+ // ),
|
|
|
+ // Text(
|
|
|
+ // "98686",
|
|
|
+ // style: TextStyle(
|
|
|
+ // color: Colors.white, fontSize: 13),
|
|
|
+ // )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ )),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ )
|
|
|
+ : Container()),
|
|
|
+ Positioned(
|
|
|
+ left: 0,
|
|
|
+ top: 0,
|
|
|
+ width: 48,
|
|
|
+ height: 48,
|
|
|
+ child: Material(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: Builder(
|
|
|
+ builder: (context) => InkWell(
|
|
|
+ onTap: () {
|
|
|
+ Scaffold.of(context).openDrawer();
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.all(12),
|
|
|
+ child: Image.asset("images/home_icon_wode.png"),
|
|
|
),
|
|
|
- ),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
@@ -184,10 +184,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
color: Colors.transparent,
|
|
|
child: InkWell(
|
|
|
onTap: () {
|
|
|
- Navigator.push(
|
|
|
- context,
|
|
|
- new CupertinoPageRoute(
|
|
|
- builder: (context) => new Setting()));
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new Setting()));
|
|
|
},
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.all(12),
|
|
|
@@ -209,9 +206,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
),
|
|
|
Text(
|
|
|
- seasonList.length > 0
|
|
|
- ? seasonList[nowIndex].gameInfo.gameName
|
|
|
- : '',
|
|
|
+ seasonList.length > 0 ? seasonList[nowIndex].gameInfo.gameName : '',
|
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
)
|
|
|
],
|
|
|
@@ -259,13 +254,9 @@ class _HomePageState extends State<HomePage> {
|
|
|
Navigator.of(context).push(PageRouteBuilder(
|
|
|
opaque: false,
|
|
|
transitionDuration: Duration(milliseconds: 300),
|
|
|
- transitionsBuilder: (BuildContext context,
|
|
|
- Animation<double> animation,
|
|
|
- Animation<double> secondaryAnimation,
|
|
|
- Widget child) {
|
|
|
+ transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
|
|
|
return FadeTransition(
|
|
|
- opacity: CurvedAnimation(
|
|
|
- parent: animation, curve: Curves.linear),
|
|
|
+ opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
|
|
|
child: child,
|
|
|
);
|
|
|
},
|
|
|
@@ -283,72 +274,22 @@ class _HomePageState extends State<HomePage> {
|
|
|
"images/home_icon_sousuo.png",
|
|
|
"搜索",
|
|
|
onTapHomeMenu: () {
|
|
|
- Navigator.push(
|
|
|
- context,
|
|
|
- new CupertinoPageRoute(
|
|
|
- builder: (context) => new RoomList()));
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new RoomList()));
|
|
|
},
|
|
|
),
|
|
|
HomeMenu(
|
|
|
"images/home_icon_youjian.png",
|
|
|
"邮件",
|
|
|
onTapHomeMenu: () {
|
|
|
- Navigator.push(
|
|
|
- context,
|
|
|
- new CupertinoPageRoute(
|
|
|
- builder: (context) => new TipList()));
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new TipList()));
|
|
|
},
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
- Container(
|
|
|
- child: GridView.count(
|
|
|
- physics: new BouncingScrollPhysics(),
|
|
|
- shrinkWrap: true,
|
|
|
- crossAxisCount: 2,
|
|
|
- children: <Widget>[
|
|
|
- HomeMenu(
|
|
|
- "images/home_icon_fangjian.png",
|
|
|
- "创建房间",
|
|
|
- onTapHomeMenu: () {
|
|
|
- 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 CreateRoom();
|
|
|
- }));
|
|
|
- },
|
|
|
- ),
|
|
|
- HomeMenu(
|
|
|
- "images/home_icon_kuaisu.png",
|
|
|
- "快速进入",
|
|
|
- onTapHomeMenu: () {},
|
|
|
- ),
|
|
|
- HomeMenu(
|
|
|
- "images/home_icon_sousuo.png",
|
|
|
- "搜索",
|
|
|
- onTapHomeMenu: () {
|
|
|
- Navigator.push(context, new CupertinoPageRoute(builder: (context) => new RoomList()));
|
|
|
- },
|
|
|
- ),
|
|
|
- HomeMenu(
|
|
|
- "images/home_icon_youjian.png",
|
|
|
- "邮件",
|
|
|
- onTapHomeMenu: () {
|
|
|
- Navigator.push(context, new CupertinoPageRoute(builder: (context) => new TipList()));
|
|
|
- },
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- );
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
typedef int OnTapHomeMenu();
|
|
|
@@ -361,11 +302,8 @@ class HomeMenu extends StatelessWidget {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- gradient: LinearGradient(
|
|
|
- begin: Alignment.topCenter,
|
|
|
- end: Alignment.bottomCenter,
|
|
|
- colors: [Color(0xFF626C85), Color(0xFF3D3E6C)])),
|
|
|
+ decoration:
|
|
|
+ BoxDecoration(gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0xFF626C85), Color(0xFF3D3E6C)])),
|
|
|
child: AspectRatio(
|
|
|
aspectRatio: 1,
|
|
|
child: Container(
|