|
@@ -1,21 +1,17 @@
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
|
import '../widget/HomeDrawer.dart';
|
|
import '../widget/HomeDrawer.dart';
|
|
|
-import './Setting.dart';
|
|
|
|
|
-import './CreateRoom.dart';
|
|
|
|
|
-import 'RoomList.dart'; //房间列表
|
|
|
|
|
|
|
+import 'Setting.dart';
|
|
|
|
|
+import 'CreateRoom.dart';
|
|
|
|
|
+import 'RoomList.dart';
|
|
|
import 'rankList.dart';
|
|
import 'rankList.dart';
|
|
|
-import 'roomInfo.dart'; //房间信息
|
|
|
|
|
|
|
+import 'roomInfo.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';
|
|
|
-import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import '../model/CompetitionSeason.dart';
|
|
import '../model/CompetitionSeason.dart';
|
|
|
import '../styles/totast.dart';
|
|
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
|
|
@@ -39,7 +35,6 @@ class _HomePageState extends State<HomePage> {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
seasonList = list;
|
|
seasonList = list;
|
|
|
});
|
|
});
|
|
|
- print(seasonList);
|
|
|
|
|
} else {}
|
|
} else {}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -71,16 +66,11 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
|
|
|
void getOneRoom() async {
|
|
void getOneRoom() async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
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();
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
if (res.data != null) {
|
|
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 {
|
|
} else {
|
|
|
showBackDialog();
|
|
showBackDialog();
|
|
|
}
|
|
}
|
|
@@ -90,25 +80,22 @@ class _HomePageState extends State<HomePage> {
|
|
|
@override
|
|
@override
|
|
|
void initState() {
|
|
void initState() {
|
|
|
super.initState();
|
|
super.initState();
|
|
|
- _pageController=PageController(initialPage:0);
|
|
|
|
|
- Future.delayed(const Duration(seconds: 1), () {
|
|
|
|
|
|
|
+ _pageController = PageController(initialPage: 0);
|
|
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
getSeasonInfo();
|
|
getSeasonInfo();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
- ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
|
|
|
|
|
return Scaffold(
|
|
return Scaffold(
|
|
|
drawer: HomeDrawer(),
|
|
drawer: HomeDrawer(),
|
|
|
body: Container(
|
|
body: Container(
|
|
|
width: double.infinity,
|
|
width: double.infinity,
|
|
|
height: double.infinity,
|
|
height: double.infinity,
|
|
|
decoration: BoxDecoration(
|
|
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: SafeArea(
|
|
|
child: centerWidget(context),
|
|
child: centerWidget(context),
|
|
|
),
|
|
),
|
|
@@ -117,7 +104,6 @@ class _HomePageState extends State<HomePage> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Widget centerWidget(BuildContext context) {
|
|
Widget centerWidget(BuildContext context) {
|
|
|
- UserInfo userInfo = StoreProvider.of<AppState>(context).state.userInfo;
|
|
|
|
|
return Column(
|
|
return Column(
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
Expanded(
|
|
Expanded(
|
|
@@ -131,11 +117,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
scrollDirection: Axis.horizontal,
|
|
scrollDirection: Axis.horizontal,
|
|
|
loop: true,
|
|
loop: true,
|
|
|
onTap: (index) {
|
|
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) {
|
|
onIndexChanged: (index) {
|
|
|
setState(() {
|
|
setState(() {
|
|
@@ -152,15 +134,12 @@ class _HomePageState extends State<HomePage> {
|
|
|
Image.asset("images/home_icon_yuan.png"),
|
|
Image.asset("images/home_icon_yuan.png"),
|
|
|
Center(
|
|
Center(
|
|
|
child: Row(
|
|
child: Row(
|
|
|
- mainAxisAlignment:
|
|
|
|
|
- MainAxisAlignment.center,
|
|
|
|
|
- crossAxisAlignment:
|
|
|
|
|
- CrossAxisAlignment.baseline,
|
|
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.baseline,
|
|
|
textBaseline: TextBaseline.alphabetic,
|
|
textBaseline: TextBaseline.alphabetic,
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
Text(
|
|
Text(
|
|
|
- (seasonList[index].bonus / 1000)
|
|
|
|
|
- .toStringAsFixed(1),
|
|
|
|
|
|
|
+ (seasonList[index].bonus / 1000).toStringAsFixed(1),
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
fontSize: 68,
|
|
fontSize: 68,
|
|
@@ -232,10 +211,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
color: Colors.transparent,
|
|
color: Colors.transparent,
|
|
|
child: InkWell(
|
|
child: InkWell(
|
|
|
onTap: () {
|
|
onTap: () {
|
|
|
- Navigator.push(
|
|
|
|
|
- context,
|
|
|
|
|
- new CupertinoPageRoute(
|
|
|
|
|
- builder: (context) => new Setting()));
|
|
|
|
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new Setting()));
|
|
|
},
|
|
},
|
|
|
child: Padding(
|
|
child: Padding(
|
|
|
padding: EdgeInsets.all(12),
|
|
padding: EdgeInsets.all(12),
|
|
@@ -257,40 +233,12 @@ class _HomePageState extends State<HomePage> {
|
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
),
|
|
),
|
|
|
Text(
|
|
Text(
|
|
|
- seasonList.length > 0
|
|
|
|
|
- ? seasonList[nowIndex].gameInfo.gameName
|
|
|
|
|
- : '',
|
|
|
|
|
|
|
+ seasonList.length > 0 ? seasonList[nowIndex].gameInfo.gameName : '',
|
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
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());
|
|
|
|
|
- // },
|
|
|
|
|
- // ),
|
|
|
|
|
- // )
|
|
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -307,13 +255,9 @@ class _HomePageState extends State<HomePage> {
|
|
|
Navigator.of(context).push(PageRouteBuilder(
|
|
Navigator.of(context).push(PageRouteBuilder(
|
|
|
opaque: false,
|
|
opaque: false,
|
|
|
transitionDuration: Duration(milliseconds: 300),
|
|
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(
|
|
return FadeTransition(
|
|
|
- opacity: CurvedAnimation(
|
|
|
|
|
- parent: animation, curve: Curves.linear),
|
|
|
|
|
|
|
+ opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
|
|
|
child: child,
|
|
child: child,
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
@@ -333,21 +277,16 @@ class _HomePageState extends State<HomePage> {
|
|
|
"images/home_icon_sousuo.png",
|
|
"images/home_icon_sousuo.png",
|
|
|
"搜索",
|
|
"搜索",
|
|
|
onTapHomeMenu: () {
|
|
onTapHomeMenu: () {
|
|
|
- Navigator.push(
|
|
|
|
|
- context,
|
|
|
|
|
- new CupertinoPageRoute(
|
|
|
|
|
- builder: (context) => new RoomList()));
|
|
|
|
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new RoomList()));
|
|
|
},
|
|
},
|
|
|
),
|
|
),
|
|
|
HomeMenu(
|
|
HomeMenu(
|
|
|
"images/home_icon_youjian.png",
|
|
"images/home_icon_youjian.png",
|
|
|
"邮件",
|
|
"邮件",
|
|
|
onTapHomeMenu: () {
|
|
onTapHomeMenu: () {
|
|
|
- Navigator.push(
|
|
|
|
|
- context,
|
|
|
|
|
- new CupertinoPageRoute(
|
|
|
|
|
- builder: (context) => new TipList()));
|
|
|
|
|
|
|
+ Navigator.push(context, new CupertinoPageRoute(builder: (context) => new TipList()));
|
|
|
},
|
|
},
|
|
|
|
|
+ showBadge: true,
|
|
|
),
|
|
),
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
@@ -363,15 +302,13 @@ class HomeMenu extends StatelessWidget {
|
|
|
final String icon;
|
|
final String icon;
|
|
|
final String title;
|
|
final String title;
|
|
|
final OnTapHomeMenu onTapHomeMenu;
|
|
final OnTapHomeMenu onTapHomeMenu;
|
|
|
- HomeMenu(this.icon, this.title, {this.onTapHomeMenu});
|
|
|
|
|
|
|
+ final bool showBadge;
|
|
|
|
|
+ HomeMenu(this.icon, this.title, {this.onTapHomeMenu, this.showBadge = false});
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
return Container(
|
|
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(
|
|
child: AspectRatio(
|
|
|
aspectRatio: 1,
|
|
aspectRatio: 1,
|
|
|
child: Container(
|
|
child: Container(
|
|
@@ -387,11 +324,28 @@ class HomeMenu extends StatelessWidget {
|
|
|
child: Column(
|
|
child: Column(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Image.asset(
|
|
|
|
|
- icon,
|
|
|
|
|
- fit: BoxFit.contain,
|
|
|
|
|
|
|
+ Container(
|
|
|
width: 44,
|
|
width: 44,
|
|
|
height: 34,
|
|
height: 34,
|
|
|
|
|
+ child: Stack(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Image.asset(
|
|
|
|
|
+ icon,
|
|
|
|
|
+ fit: BoxFit.contain,
|
|
|
|
|
+ width: 44,
|
|
|
|
|
+ height: 34,
|
|
|
|
|
+ ),
|
|
|
|
|
+ Positioned(
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ width: showBadge ? 10 : 0,
|
|
|
|
|
+ height: showBadge ? 10 : 0,
|
|
|
|
|
+ decoration: BoxDecoration(color: Color.fromARGB(255, 239, 0, 9), borderRadius: BorderRadius.all(Radius.circular(10))),
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
Text(
|
|
Text(
|
|
|
title,
|
|
title,
|