|
@@ -1,7 +1,9 @@
|
|
|
|
|
+import 'package:cached_network_image/cached_network_image.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
|
+import 'package:shared_preferences/shared_preferences.dart';
|
|
|
import 'package:wanna_battle/model/UserPlayTimes.dart';
|
|
import 'package:wanna_battle/model/UserPlayTimes.dart';
|
|
|
import 'package:wanna_battle/styles/totast.dart';
|
|
import 'package:wanna_battle/styles/totast.dart';
|
|
|
import '../model/CompetitionInfo.dart';
|
|
import '../model/CompetitionInfo.dart';
|
|
@@ -16,6 +18,7 @@ import './CompetitionRank.dart';
|
|
|
import '../Constants.dart';
|
|
import '../Constants.dart';
|
|
|
import './CompetitionRank.dart';
|
|
import './CompetitionRank.dart';
|
|
|
import 'CompetitionNotice.dart';
|
|
import 'CompetitionNotice.dart';
|
|
|
|
|
+import 'UserGuid.dart';
|
|
|
|
|
|
|
|
class CompetitionRooms extends StatefulWidget {
|
|
class CompetitionRooms extends StatefulWidget {
|
|
|
CompetitionRooms(this.competitionInfo);
|
|
CompetitionRooms(this.competitionInfo);
|
|
@@ -35,117 +38,129 @@ class _CompetitionRoomsState extends State<CompetitionRooms> {
|
|
|
@override
|
|
@override
|
|
|
void initState() {
|
|
void initState() {
|
|
|
super.initState();
|
|
super.initState();
|
|
|
- Future.delayed(Duration.zero, () {
|
|
|
|
|
- showNotice(context);
|
|
|
|
|
|
|
+ Future.delayed(Duration.zero, () async {
|
|
|
_getRooms();
|
|
_getRooms();
|
|
|
_getPlayTimes();
|
|
_getPlayTimes();
|
|
|
|
|
+ final prefs = await SharedPreferences.getInstance();
|
|
|
|
|
+ final bool showGuid2 = prefs.getBool('showGuid2') ?? true;
|
|
|
|
|
+ if (showGuid2) {
|
|
|
|
|
+ await prefs.setBool('showGuid2', false);
|
|
|
|
|
+ await showUserGuide2(context);
|
|
|
|
|
+ }
|
|
|
|
|
+ showNotice(context);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
|
|
+ final appBar = AppBar(
|
|
|
|
|
+ title: Text(widget.competitionInfo.competitionName),
|
|
|
|
|
+ centerTitle: true,
|
|
|
|
|
+ elevation: 0,
|
|
|
|
|
+ backgroundColor: Colors.transparent,
|
|
|
|
|
+ );
|
|
|
return Scaffold(
|
|
return Scaffold(
|
|
|
- appBar: AppBar(
|
|
|
|
|
- title: Text(widget.competitionInfo.competitionName),
|
|
|
|
|
- centerTitle: true,
|
|
|
|
|
- elevation: 0,
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ backgroundColor: Color(0xff19213B),
|
|
|
body: Column(
|
|
body: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
Container(
|
|
Container(
|
|
|
- color: SUB_COLOR,
|
|
|
|
|
- padding: EdgeInsets.only(left: 15, right: 15, bottom: 10),
|
|
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
|
+ image: DecorationImage(
|
|
|
|
|
+ image: NetworkImage(widget.competitionInfo.pic),
|
|
|
|
|
+ fit: BoxFit.cover,
|
|
|
|
|
+ )),
|
|
|
|
|
+ height: MediaQuery.of(context).size.width * 200 / 375,
|
|
|
|
|
+ padding: EdgeInsets.only(left: 15, right: 15),
|
|
|
child: Column(
|
|
child: Column(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(top: 10),
|
|
|
|
|
- child: Text(
|
|
|
|
|
- widget.competitionInfo.intro ?? '',
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Color(0xADFFFFFF),
|
|
|
|
|
- fontSize: 13,
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- color: Colors.yellow,
|
|
|
|
|
- margin: EdgeInsets.only(top: 10),
|
|
|
|
|
- padding: EdgeInsets.fromLTRB(6, 1, 6, 2),
|
|
|
|
|
- child: Text(
|
|
|
|
|
- '剩余参赛次数 $restTimes次',
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Color(0xFF293354),
|
|
|
|
|
- fontSize: 12,
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(top: 15),
|
|
|
|
|
- child: Row(
|
|
|
|
|
|
|
+ appBar,
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: Column(
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Expanded(
|
|
|
|
|
- child: MaterialButton(
|
|
|
|
|
- color: Color(0xFFE56B45),
|
|
|
|
|
- elevation: 0,
|
|
|
|
|
- highlightElevation: 0,
|
|
|
|
|
- child: Row(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Image.asset(
|
|
|
|
|
- 'images/icon_jiangpin.png',
|
|
|
|
|
- width: 19,
|
|
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(left: 15),
|
|
|
|
|
- child: Text(
|
|
|
|
|
- '奖品规则',
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white, fontSize: 14),
|
|
|
|
|
- ),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ Container(
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ widget.competitionInfo.intro ?? '',
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Color(0xADFFFFFF),
|
|
|
|
|
+ fontSize: 13,
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ color: Colors.yellow,
|
|
|
|
|
+ margin: EdgeInsets.only(top: 10),
|
|
|
|
|
+ padding: EdgeInsets.fromLTRB(6, 1, 6, 2),
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ '剩余参赛次数 $restTimes次',
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Color(0xFF293354),
|
|
|
|
|
+ fontSize: 12,
|
|
|
),
|
|
),
|
|
|
- onPressed: () {
|
|
|
|
|
- showBonus();
|
|
|
|
|
- },
|
|
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
- Container(width: 15),
|
|
|
|
|
- Expanded(
|
|
|
|
|
- child: MaterialButton(
|
|
|
|
|
- color: PRIMARY_COLOR,
|
|
|
|
|
- elevation: 0,
|
|
|
|
|
- highlightElevation: 0,
|
|
|
|
|
- child: Row(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Image.asset(
|
|
|
|
|
- 'images/icon_paihangbang.png',
|
|
|
|
|
- width: 19,
|
|
|
|
|
|
|
+ Container(
|
|
|
|
|
+ margin: EdgeInsets.only(top: 10),
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: MaterialButton(
|
|
|
|
|
+ color: Color(0xFFE56B45),
|
|
|
|
|
+ elevation: 0,
|
|
|
|
|
+ highlightElevation: 0,
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Image.asset(
|
|
|
|
|
+ 'images/icon_jiangpin.png',
|
|
|
|
|
+ width: 19,
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ margin: EdgeInsets.only(left: 15),
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ '奖品规则',
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ onPressed: () {
|
|
|
|
|
+ showBonus();
|
|
|
|
|
+ },
|
|
|
),
|
|
),
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(left: 15),
|
|
|
|
|
- child: Text(
|
|
|
|
|
- '排行榜',
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white, fontSize: 14),
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(width: 15),
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: MaterialButton(
|
|
|
|
|
+ color: PRIMARY_COLOR,
|
|
|
|
|
+ elevation: 0,
|
|
|
|
|
+ highlightElevation: 0,
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Image.asset(
|
|
|
|
|
+ 'images/icon_paihangbang.png',
|
|
|
|
|
+ width: 19,
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ margin: EdgeInsets.only(left: 15),
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ '排行榜',
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
),
|
|
),
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- onPressed: () {
|
|
|
|
|
- Navigator.push(
|
|
|
|
|
- context,
|
|
|
|
|
- CupertinoPageRoute(
|
|
|
|
|
- builder: (context) => CompetitionRank(
|
|
|
|
|
- competitionId:
|
|
|
|
|
- widget.competitionInfo.id)));
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ onPressed: () {
|
|
|
|
|
+ Navigator.push(context, CupertinoPageRoute(builder: (context) => CompetitionRank(competitionId: widget.competitionInfo.id)));
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
@@ -173,8 +188,7 @@ class _CompetitionRoomsState extends State<CompetitionRooms> {
|
|
|
Future<void> _getRooms() async {
|
|
Future<void> _getRooms() async {
|
|
|
final Result res = await HttpManager.get('houseInfo/all', data: {
|
|
final Result res = await HttpManager.get('houseInfo/all', data: {
|
|
|
'competitionId': widget.competitionInfo.id,
|
|
'competitionId': widget.competitionInfo.id,
|
|
|
- 'advancedQuery':
|
|
|
|
|
- ' AND_,status_flag_,!=_,' + HouseStatus.SETTLEMENT.toString(),
|
|
|
|
|
|
|
+ 'advancedQuery': ' AND_,status_flag_,!=_,' + HouseStatus.SETTLEMENT.toString(),
|
|
|
});
|
|
});
|
|
|
final List<HouseInfo> list = [];
|
|
final List<HouseInfo> list = [];
|
|
|
if (res.success && res.data != null) {
|
|
if (res.success && res.data != null) {
|
|
@@ -212,17 +226,14 @@ class _CompetitionRoomsState extends State<CompetitionRooms> {
|
|
|
showGeneralDialog(
|
|
showGeneralDialog(
|
|
|
context: context,
|
|
context: context,
|
|
|
barrierDismissible: true,
|
|
barrierDismissible: true,
|
|
|
- pageBuilder: (BuildContext buildContext, Animation<double> animation,
|
|
|
|
|
- Animation<double> secondaryAnimation) {
|
|
|
|
|
|
|
+ pageBuilder: (BuildContext buildContext, Animation<double> animation, Animation<double> secondaryAnimation) {
|
|
|
return Center(
|
|
return Center(
|
|
|
child: Material(
|
|
child: Material(
|
|
|
color: Colors.transparent,
|
|
color: Colors.transparent,
|
|
|
child: Container(
|
|
child: Container(
|
|
|
width: 270,
|
|
width: 270,
|
|
|
padding: EdgeInsets.all(0),
|
|
padding: EdgeInsets.all(0),
|
|
|
- decoration: BoxDecoration(
|
|
|
|
|
- color: Color(0xE6293559),
|
|
|
|
|
- border: Border.all(width: 1, color: Color(0xFF1990F8))),
|
|
|
|
|
|
|
+ decoration: BoxDecoration(color: Color(0xE6293559), border: Border.all(width: 1, color: Color(0xFF1990F8))),
|
|
|
child: Column(
|
|
child: Column(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
@@ -231,10 +242,7 @@ class _CompetitionRoomsState extends State<CompetitionRooms> {
|
|
|
margin: EdgeInsets.only(top: 25),
|
|
margin: EdgeInsets.only(top: 25),
|
|
|
child: Text(
|
|
child: Text(
|
|
|
'奖品规则',
|
|
'奖品规则',
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white,
|
|
|
|
|
- fontSize: 18,
|
|
|
|
|
- fontWeight: FontWeight.bold),
|
|
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
|
|
|
textAlign: TextAlign.center,
|
|
textAlign: TextAlign.center,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -328,9 +336,7 @@ class _Room extends StatelessWidget {
|
|
|
style: TextStyle(color: Colors.white, fontSize: 11),
|
|
style: TextStyle(color: Colors.white, fontSize: 11),
|
|
|
children: <TextSpan>[
|
|
children: <TextSpan>[
|
|
|
TextSpan(text: '参赛人数:'),
|
|
TextSpan(text: '参赛人数:'),
|
|
|
- TextSpan(
|
|
|
|
|
- text: (houseInfo.playerNumber ?? 0).toString(),
|
|
|
|
|
- style: TextStyle(color: Color(0xFF38A968))),
|
|
|
|
|
|
|
+ TextSpan(text: (houseInfo.playerNumber ?? 0).toString(), style: TextStyle(color: Color(0xFF38A968))),
|
|
|
TextSpan(text: '/${houseInfo.maxNumber}'),
|
|
TextSpan(text: '/${houseInfo.maxNumber}'),
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
@@ -384,15 +390,11 @@ class _Room extends StatelessWidget {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- Result res = await HttpManager.post('houseInfo/join', data: {
|
|
|
|
|
- 'houseId': houseId,
|
|
|
|
|
- 'userId': StoreProvider.of<AppState>(context).state.userInfo.id
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ Result res = await HttpManager.post('houseInfo/join', data: {'houseId': houseId, 'userId': StoreProvider.of<AppState>(context).state.userInfo.id});
|
|
|
Toast.hide();
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
Toast.show(context, '加入成功', 1500, 'success');
|
|
Toast.show(context, '加入成功', 1500, 'success');
|
|
|
- Navigator.push(context,
|
|
|
|
|
- CupertinoPageRoute(builder: (context) => RoomInfo(houseInfo)));
|
|
|
|
|
|
|
+ Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(houseInfo)));
|
|
|
} else {
|
|
} else {
|
|
|
Toast.show(context, res.error, 1500, 'info');
|
|
Toast.show(context, res.error, 1500, 'info');
|
|
|
}
|
|
}
|