|
|
@@ -5,6 +5,7 @@ import './Setting.dart';
|
|
|
import './CreateRoom.dart';
|
|
|
import 'RoomList.dart'; //房间列表
|
|
|
import 'rankList.dart';
|
|
|
+import 'roomInfo.dart'; //房间信息
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
@@ -41,7 +42,49 @@ class _HomePageState extends State<HomePage> {
|
|
|
} else {}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ void showBackDialog() {
|
|
|
+ showDialog<Null>(
|
|
|
+ context: context,
|
|
|
+ barrierDismissible: false,
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return new AlertDialog(
|
|
|
+ content: Container(
|
|
|
+ height: 50,
|
|
|
+ child: Text(
|
|
|
+ '暂时没有进行中的房间,敬请期待...',
|
|
|
+ style: TextStyle(color: Colors.black),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ actions: <Widget>[
|
|
|
+ new FlatButton(
|
|
|
+ child: new Text('确定'),
|
|
|
+ onPressed: () {
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ },
|
|
|
+ ).then((val) {});
|
|
|
+ }
|
|
|
+
|
|
|
+ void getOneRoom() async {
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
+ Result res =
|
|
|
+ await HttpManager.get("houseInfo/getOne", data: {'statusFlag': 0});
|
|
|
+ Toast.hide();
|
|
|
+ if (res.success) {
|
|
|
+ if (res.data != null) {
|
|
|
+ Navigator.push(
|
|
|
+ context,
|
|
|
+ new CupertinoPageRoute(
|
|
|
+ builder: (context) =>
|
|
|
+ new RoomInfo(roomId: res.data['id'].toString())));
|
|
|
+ } else {
|
|
|
+ showBackDialog();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
@@ -60,8 +103,10 @@ 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),
|
|
|
),
|
|
|
@@ -84,7 +129,11 @@ 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(() {
|
|
|
@@ -101,12 +150,15 @@ 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,
|
|
|
@@ -178,7 +230,10 @@ 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),
|
|
|
@@ -200,7 +255,9 @@ 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),
|
|
|
)
|
|
|
],
|
|
|
@@ -248,9 +305,13 @@ 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,
|
|
|
);
|
|
|
},
|
|
|
@@ -262,20 +323,28 @@ class _HomePageState extends State<HomePage> {
|
|
|
HomeMenu(
|
|
|
"images/home_icon_kuaisu.png",
|
|
|
"快速进入",
|
|
|
- onTapHomeMenu: () {},
|
|
|
+ onTapHomeMenu: () {
|
|
|
+ getOneRoom();
|
|
|
+ },
|
|
|
),
|
|
|
HomeMenu(
|
|
|
"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()));
|
|
|
},
|
|
|
),
|
|
|
],
|
|
|
@@ -296,8 +365,11 @@ 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(
|