|
|
@@ -1,5 +1,4 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:flutter_redux/flutter_redux.dart';
|
|
|
import '../widget/HomeDrawer.dart';
|
|
|
import './Setting.dart';
|
|
|
import './CreateRoom.dart';
|
|
|
@@ -8,14 +7,11 @@ 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';
|
|
|
import '../model/CompetitionSeason.dart';
|
|
|
import '../styles/totast.dart';
|
|
|
import '../net/HttpManager.dart';
|
|
|
import '../net/Result.dart';
|
|
|
import 'TipList.dart';
|
|
|
-import '../model/UserInfo.dart';
|
|
|
-import '../redux/AppState.dart';
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
@override
|
|
|
@@ -70,16 +66,11 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
|
void getOneRoom() async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- Result res =
|
|
|
- await HttpManager.get("houseInfo/getOne", data: {'statusFlag': 0});
|
|
|
+ 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())));
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new RoomInfo(roomId: res.data['id'].toString())));
|
|
|
} else {
|
|
|
showBackDialog();
|
|
|
}
|
|
|
@@ -89,24 +80,21 @@ class _HomePageState extends State<HomePage> {
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- Future.delayed(const Duration(seconds: 1), () {
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
getSeasonInfo();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
|
|
|
return Scaffold(
|
|
|
drawer: HomeDrawer(),
|
|
|
body: Container(
|
|
|
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),
|
|
|
),
|
|
|
@@ -115,7 +103,6 @@ class _HomePageState extends State<HomePage> {
|
|
|
}
|
|
|
|
|
|
Widget centerWidget(BuildContext context) {
|
|
|
- UserInfo userInfo = StoreProvider.of<AppState>(context).state.userInfo;
|
|
|
return Column(
|
|
|
children: <Widget>[
|
|
|
Expanded(
|
|
|
@@ -129,11 +116,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(() {
|
|
|
@@ -150,15 +133,12 @@ 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,
|
|
|
@@ -230,10 +210,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),
|
|
|
@@ -255,40 +232,12 @@ 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),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- // Positioned(
|
|
|
- // bottom: 60,
|
|
|
- // left: 0,
|
|
|
- // child: FlatButton(
|
|
|
- // child: Text("stream"),
|
|
|
- // onPressed: () async {
|
|
|
- // bool success = await ScreenStreamPlugin.start(
|
|
|
- // 'rtmp://49.4.66.233:1935/myapp/' +
|
|
|
- // userInfo.id.toString() +
|
|
|
- // '?playerInfoId=' +
|
|
|
- // '1234');
|
|
|
- // print('stream screen:' + success.toString());
|
|
|
- // },
|
|
|
- // ),
|
|
|
- // ),
|
|
|
- // Positioned(
|
|
|
- // bottom: 60,
|
|
|
- // right: 0,
|
|
|
- // child: FlatButton(
|
|
|
- // child: Text("stop stream"),
|
|
|
- // onPressed: () async {
|
|
|
- // bool success = await ScreenStreamPlugin.stop();
|
|
|
- // print('stop stream screen:' + success.toString());
|
|
|
- // },
|
|
|
- // ),
|
|
|
- // )
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
@@ -305,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,
|
|
|
);
|
|
|
},
|
|
|
@@ -331,20 +276,14 @@ 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()));
|
|
|
},
|
|
|
),
|
|
|
],
|
|
|
@@ -365,11 +304,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(
|