|
@@ -1,8 +1,7 @@
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
|
-import '../widgets/HomeDrawer.dart';
|
|
|
|
|
-import './Setting.dart';
|
|
|
|
|
-import './CreateRoom.dart';
|
|
|
|
|
|
|
+import '../widget/HomeDrawer.dart';
|
|
|
|
|
+import 'Setting.dart';
|
|
|
|
|
+import 'CreateRoom.dart';
|
|
|
import 'RoomList.dart'; //房间列表
|
|
import 'RoomList.dart'; //房间列表
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
@@ -12,8 +11,6 @@ import '../styles/totast.dart';
|
|
|
import '../net/HttpManager.dart';
|
|
import '../net/HttpManager.dart';
|
|
|
import '../net/Result.dart';
|
|
import '../net/Result.dart';
|
|
|
import 'TipList.dart';
|
|
import 'TipList.dart';
|
|
|
-import '../model/UserInfo.dart';
|
|
|
|
|
-import '../redux/AppState.dart';
|
|
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
class HomePage extends StatefulWidget {
|
|
|
@override
|
|
@override
|
|
@@ -66,197 +63,192 @@ class _HomePageState extends State<HomePage> {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget centerWidget(BuildContext context) {
|
|
|
|
|
- UserInfo userInfo = StoreProvider.of<AppState>(context).state.userInfo;
|
|
|
|
|
- return Column(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Expanded(
|
|
|
|
|
- child: Stack(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Container(
|
|
|
|
|
- child: seasonList.length > 0
|
|
|
|
|
- ? Swiper(
|
|
|
|
|
- index: nowIndex,
|
|
|
|
|
- itemCount: seasonList.length,
|
|
|
|
|
- scrollDirection: Axis.horizontal,
|
|
|
|
|
- loop: true,
|
|
|
|
|
- onTap: (index) {
|
|
|
|
|
- setState(() {
|
|
|
|
|
- nowIndex = index;
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- onIndexChanged: (index) {
|
|
|
|
|
- setState(() {
|
|
|
|
|
- nowIndex = index;
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- itemBuilder: (context, index) {
|
|
|
|
|
- return Center(
|
|
|
|
|
- child: SizedBox(
|
|
|
|
|
- width: 214,
|
|
|
|
|
- height: 214,
|
|
|
|
|
- child: Stack(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Image.asset("images/home_icon_yuan.png"),
|
|
|
|
|
- Center(
|
|
|
|
|
- child: Row(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.baseline,
|
|
|
|
|
- textBaseline: TextBaseline.alphabetic,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Text(
|
|
|
|
|
- (seasonList[index].bonus / 1000).toStringAsFixed(1),
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white,
|
|
|
|
|
- fontSize: 68,
|
|
|
|
|
- fontFamily: 'DINEngschrift',
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ Widget centerWidget(BuildContext context) => Column(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: Stack(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Container(
|
|
|
|
|
+ child: seasonList.length > 0
|
|
|
|
|
+ ? Swiper(
|
|
|
|
|
+ index: nowIndex,
|
|
|
|
|
+ itemCount: seasonList.length,
|
|
|
|
|
+ scrollDirection: Axis.horizontal,
|
|
|
|
|
+ loop: true,
|
|
|
|
|
+ onTap: (index) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ nowIndex = index;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ onIndexChanged: (index) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ nowIndex = index;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ itemBuilder: (context, index) => Center(
|
|
|
|
|
+ child: SizedBox(
|
|
|
|
|
+ width: 214,
|
|
|
|
|
+ height: 214,
|
|
|
|
|
+ child: Stack(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Image.asset("images/home_icon_yuan.png"),
|
|
|
|
|
+ Center(
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.baseline,
|
|
|
|
|
+ textBaseline: TextBaseline.alphabetic,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Text(
|
|
|
|
|
+ (seasonList[index].bonus / 1000).toStringAsFixed(1),
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontSize: 68,
|
|
|
|
|
+ fontFamily: 'DINEngschrift',
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Text(
|
|
|
|
|
+ "K",
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontSize: 36,
|
|
|
|
|
+ fontFamily: 'DINEngschrift',
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
),
|
|
),
|
|
|
- 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"),
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ 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"),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
- Positioned(
|
|
|
|
|
- right: 0,
|
|
|
|
|
- top: 0,
|
|
|
|
|
- width: 48,
|
|
|
|
|
- height: 48,
|
|
|
|
|
- child: Material(
|
|
|
|
|
- color: Colors.transparent,
|
|
|
|
|
- child: InkWell(
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- Navigator.push(context, new CupertinoPageRoute(builder: (context) => new Setting()));
|
|
|
|
|
- },
|
|
|
|
|
- child: Padding(
|
|
|
|
|
- padding: EdgeInsets.all(12),
|
|
|
|
|
- child: Image.asset("images/home_icon_shezhi.png"),
|
|
|
|
|
|
|
+ Positioned(
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ width: 48,
|
|
|
|
|
+ height: 48,
|
|
|
|
|
+ child: Material(
|
|
|
|
|
+ color: Colors.transparent,
|
|
|
|
|
+ child: InkWell(
|
|
|
|
|
+ onTap: () {
|
|
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new Setting()));
|
|
|
|
|
+ },
|
|
|
|
|
+ child: Padding(
|
|
|
|
|
+ padding: EdgeInsets.all(12),
|
|
|
|
|
+ child: Image.asset("images/home_icon_shezhi.png"),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
- Positioned(
|
|
|
|
|
- bottom: 11,
|
|
|
|
|
- left: 0,
|
|
|
|
|
- right: 0,
|
|
|
|
|
- child: Column(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Text(
|
|
|
|
|
- seasonList.length > 0 ? seasonList[nowIndex].season : '',
|
|
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
- ),
|
|
|
|
|
- Text(
|
|
|
|
|
- seasonList.length > 0 ? seasonList[nowIndex].gameInfo.gameName : '',
|
|
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ Positioned(
|
|
|
|
|
+ bottom: 11,
|
|
|
|
|
+ left: 0,
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Text(
|
|
|
|
|
+ seasonList.length > 0 ? seasonList[nowIndex].season : '',
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Text(
|
|
|
|
|
+ seasonList.length > 0 ? seasonList[nowIndex].gameInfo.gameName : '',
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- 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()));
|
|
|
|
|
- },
|
|
|
|
|
- ),
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ 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();
|
|
typedef int OnTapHomeMenu();
|