|
@@ -4,6 +4,11 @@ import './Setting.dart';
|
|
|
import './CreateRoom.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 '../model/CompetitionSeason.dart';
|
|
|
|
|
+import '../styles/totast.dart';
|
|
|
|
|
+import '../net/HttpManager.dart';
|
|
|
|
|
+import '../net/Result.dart';
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
class HomePage extends StatefulWidget {
|
|
|
@override
|
|
@override
|
|
@@ -11,6 +16,31 @@ class HomePage extends StatefulWidget {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
class _HomePageState extends State<HomePage> {
|
|
|
|
|
+ List<CompetitionSeason> seasonList = [];
|
|
|
|
|
+ int nowIndex = 0;
|
|
|
|
|
+
|
|
|
|
|
+ void getSeasonInfo() async {
|
|
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
|
|
+ Result res = await HttpManager.get("competitionSeason/all");
|
|
|
|
|
+ Toast.hide();
|
|
|
|
|
+ if (res.success) {
|
|
|
|
|
+ List<CompetitionSeason> list = [];
|
|
|
|
|
+ for (var item in res.data) {
|
|
|
|
|
+ list.add(CompetitionSeason.fromJson(item));
|
|
|
|
|
+ }
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ seasonList = list;
|
|
|
|
|
+ });
|
|
|
|
|
+ print(seasonList);
|
|
|
|
|
+ } else {}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ void initState() {
|
|
|
|
|
+ super.initState();
|
|
|
|
|
+ getSeasonInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
return Scaffold(
|
|
return Scaffold(
|
|
@@ -24,55 +54,78 @@ class _HomePageState extends State<HomePage> {
|
|
|
Color.fromARGB(255, 147, 64, 61)
|
|
Color.fromARGB(255, 147, 64, 61)
|
|
|
], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
|
|
], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
|
|
|
child: SafeArea(
|
|
child: SafeArea(
|
|
|
- child: Column(
|
|
|
|
|
|
|
+ child: centerWidget(),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget centerWidget() {
|
|
|
|
|
+ return Column(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: Stack(
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Expanded(
|
|
|
|
|
- child: Stack(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- 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(
|
|
|
|
|
|
|
+ Positioned(
|
|
|
|
|
+ left: 0,
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ width: 48,
|
|
|
|
|
+ height: 48,
|
|
|
|
|
+ child: Material(
|
|
|
|
|
+ color: Colors.transparent,
|
|
|
|
|
+ child: Builder(
|
|
|
|
|
+ builder: (context) => InkWell(
|
|
|
onTap: () {
|
|
onTap: () {
|
|
|
- Navigator.push(
|
|
|
|
|
- context,
|
|
|
|
|
- new CupertinoPageRoute(
|
|
|
|
|
- builder: (context) => new Setting()));
|
|
|
|
|
|
|
+ Scaffold.of(context).openDrawer();
|
|
|
},
|
|
},
|
|
|
child: Padding(
|
|
child: Padding(
|
|
|
padding: EdgeInsets.all(12),
|
|
padding: EdgeInsets.all(12),
|
|
|
- child: Image.asset("images/home_icon_shezhi.png"),
|
|
|
|
|
|
|
+ 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"),
|
|
|
),
|
|
),
|
|
|
- Center(
|
|
|
|
|
- child: SizedBox(
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ child: 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,
|
|
width: 214,
|
|
|
height: 214,
|
|
height: 214,
|
|
|
child: Stack(
|
|
child: Stack(
|
|
@@ -85,7 +138,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
textBaseline: TextBaseline.alphabetic,
|
|
textBaseline: TextBaseline.alphabetic,
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
Text(
|
|
Text(
|
|
|
- "568",
|
|
|
|
|
|
|
+ (seasonList[index].bonus/1000).toStringAsFixed(1),
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
fontSize: 68,
|
|
fontSize: 68,
|
|
@@ -109,102 +162,98 @@ class _HomePageState extends State<HomePage> {
|
|
|
right: 0,
|
|
right: 0,
|
|
|
child: Column(
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Text(
|
|
|
|
|
- "当前排名",
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white, fontSize: 13),
|
|
|
|
|
- ),
|
|
|
|
|
- Text(
|
|
|
|
|
- "98686",
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white, fontSize: 13),
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ // Text(
|
|
|
|
|
+ // "当前排名",
|
|
|
|
|
+ // style: TextStyle(
|
|
|
|
|
+ // color: Colors.white, fontSize: 13),
|
|
|
|
|
+ // ),
|
|
|
|
|
+ // Text(
|
|
|
|
|
+ // "98686",
|
|
|
|
|
+ // style: TextStyle(
|
|
|
|
|
+ // color: Colors.white, fontSize: 13),
|
|
|
|
|
+ // )
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Positioned(
|
|
|
|
|
- bottom: 11,
|
|
|
|
|
- left: 0,
|
|
|
|
|
- right: 0,
|
|
|
|
|
- child: Column(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Text(
|
|
|
|
|
- "赛季奖金",
|
|
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
- ),
|
|
|
|
|
- Text(
|
|
|
|
|
- "刺激战场之大逃杀",
|
|
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- child: GridView.count(
|
|
|
|
|
- physics: new BouncingScrollPhysics(),
|
|
|
|
|
- shrinkWrap: true,
|
|
|
|
|
- crossAxisCount: 2,
|
|
|
|
|
|
|
+ )),
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ )),
|
|
|
|
|
+ Positioned(
|
|
|
|
|
+ bottom: 11,
|
|
|
|
|
+ left: 0,
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
children: <Widget>[
|
|
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: () {},
|
|
|
|
|
|
|
+ Text(
|
|
|
|
|
+ seasonList[nowIndex].season,
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
),
|
|
),
|
|
|
|
|
+ Text(
|
|
|
|
|
+ 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: () {},
|
|
|
|
|
+ ),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|