|
|
@@ -20,8 +20,7 @@ class RoomInfo extends StatefulWidget {
|
|
|
RoomInfoState createState() => RoomInfoState();
|
|
|
}
|
|
|
|
|
|
-class RoomInfoState extends State<RoomInfo>
|
|
|
- with SingleTickerProviderStateMixin {
|
|
|
+class RoomInfoState extends State<RoomInfo> with SingleTickerProviderStateMixin {
|
|
|
List<Map> tabList;
|
|
|
TabController mController;
|
|
|
Map roomInfo;
|
|
|
@@ -33,8 +32,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
//获取房间信息
|
|
|
void getRoomInfo() async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- Result res =
|
|
|
- await HttpManager.get("houseInfo/getOne", data: {"id": widget.roomId});
|
|
|
+ Result res = await HttpManager.get("houseInfo/getOne", data: {"id": widget.roomId});
|
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
|
setState(() {
|
|
|
@@ -50,8 +48,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
//隔一秒检查是否开始
|
|
|
getNowStatus() async {
|
|
|
await Future.delayed(const Duration(seconds: 1));
|
|
|
- Result res = await HttpManager.get("houseInfo/getPlayerNum",
|
|
|
- data: {"id": widget.roomId});
|
|
|
+ Result res = await HttpManager.get("houseInfo/getPlayerNum", data: {"id": widget.roomId});
|
|
|
if (res.success) {
|
|
|
if (houseInfo.statusFlag == 0 && res.data["statusFlag"] == 2) {
|
|
|
showStart();
|
|
|
@@ -72,8 +69,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
final result = await 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),
|
|
|
child: child,
|
|
|
@@ -95,11 +91,8 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
if (res.success) {
|
|
|
if (data['statusFlag'] == 2) {
|
|
|
//加入比赛成功,开始录屏
|
|
|
- bool success = await ScreenStreamPlugin.start(
|
|
|
- 'rtmp://49.4.66.233:1935/myapp/' +
|
|
|
- playerInfo.userId.toString() +
|
|
|
- '?playerInfoId=' +
|
|
|
- playerInfo.id.toString());
|
|
|
+ bool success =
|
|
|
+ await ScreenStreamPlugin.start('rtmp://49.4.66.233:1935/myapp/' + playerInfo.userId.toString() + '?playerInfoId=' + playerInfo.id.toString());
|
|
|
print('stream screen:' + success.toString());
|
|
|
Future.delayed(Duration(milliseconds: 100), () => showSucessInfo());
|
|
|
} else {
|
|
|
@@ -128,8 +121,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
child: new Text('完成比赛'),
|
|
|
onPressed: () async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- HttpManager.post("playerInfo/update",
|
|
|
- data: {'id': playerInfo.id, 'statusFlag': 3});
|
|
|
+ HttpManager.post("playerInfo/update", data: {'id': playerInfo.id, 'statusFlag': 3});
|
|
|
bool success = await ScreenStreamPlugin.stop();
|
|
|
print('stop stream screen:' + success.toString());
|
|
|
Toast.hide();
|
|
|
@@ -176,10 +168,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
|
|
|
//检查加入信息
|
|
|
checkJoinInfo() async {
|
|
|
- Result res = await HttpManager.get("playerInfo/getOne", data: {
|
|
|
- "userId": StoreProvider.of<AppState>(context).state.userInfo.id,
|
|
|
- "houseId": widget.roomId
|
|
|
- });
|
|
|
+ Result res = await HttpManager.get("playerInfo/getOne", data: {"userId": StoreProvider.of<AppState>(context).state.userInfo.id, "houseId": widget.roomId});
|
|
|
if (res.success) {
|
|
|
print(res.data);
|
|
|
if (res.data == null) {
|
|
|
@@ -205,10 +194,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
//加入房间
|
|
|
joinRoom() async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- Result res = await HttpManager.post("houseInfo/join", data: {
|
|
|
- "houseId": widget.roomId,
|
|
|
- "userId": StoreProvider.of<AppState>(context).state.userInfo.id
|
|
|
- });
|
|
|
+ Result res = await HttpManager.post("houseInfo/join", data: {"houseId": widget.roomId, "userId": StoreProvider.of<AppState>(context).state.userInfo.id});
|
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
|
Toast.show(context, '加入成功', 1500, 'success');
|
|
|
@@ -238,8 +224,9 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
"白银": Color(0xFFAFCAD8),
|
|
|
"青铜": Color(0xFFE18D50),
|
|
|
};
|
|
|
- getRoomInfo();
|
|
|
- Future.delayed(Duration(milliseconds: 100), () {
|
|
|
+
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
+ getRoomInfo();
|
|
|
checkJoinInfo();
|
|
|
// showBackDialog();
|
|
|
});
|
|
|
@@ -258,7 +245,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
if (houseInfo != null) {
|
|
|
status = houseInfo.statusFlag;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return new WillPopScope(
|
|
|
child: Scaffold(
|
|
|
appBar: AppBar(
|
|
|
@@ -295,10 +282,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
color: BG_SUB_COLOR,
|
|
|
child: TabBarView(
|
|
|
controller: mController,
|
|
|
- children: [
|
|
|
- _firstPage(),
|
|
|
- SecondPage(roomId: widget.roomId, status: status)
|
|
|
- ],
|
|
|
+ children: [_firstPage(), SecondPage(roomId: widget.roomId, status: status)],
|
|
|
)),
|
|
|
floatingActionButton: _joinBtn(),
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
@@ -314,17 +298,11 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Widget _firstPage() {
|
|
|
Map houseLevelInfo = roomInfo.isNotEmpty ? roomInfo["houseLevelInfo"] : {};
|
|
|
|
|
|
- String levelName = houseLevelInfo.containsKey("levelName")
|
|
|
- ? houseLevelInfo["levelName"]
|
|
|
- : '黄金';
|
|
|
+ String levelName = houseLevelInfo.containsKey("levelName") ? houseLevelInfo["levelName"] : '黄金';
|
|
|
|
|
|
- int joinMoney =
|
|
|
- houseLevelInfo.containsKey('feeRatio') && roomInfo.containsKey("bonus")
|
|
|
- ? houseLevelInfo["feeRatio"] * roomInfo["bonus"]
|
|
|
- : 0;
|
|
|
+ int joinMoney = houseLevelInfo.containsKey('feeRatio') && roomInfo.containsKey("bonus") ? houseLevelInfo["feeRatio"] * roomInfo["bonus"] : 0;
|
|
|
|
|
|
- String topImg =
|
|
|
- 'http://images.liqucn.com/img/h22/h70/img_localize_8e824debdd9ee29522690f36680e2d8e_600x337.png';
|
|
|
+ String topImg = 'http://images.liqucn.com/img/h22/h70/img_localize_8e824debdd9ee29522690f36680e2d8e_600x337.png';
|
|
|
int statuFlag = 0;
|
|
|
if (houseInfo != null) {
|
|
|
if (houseInfo.video != null) {
|
|
|
@@ -357,25 +335,16 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Container(
|
|
|
margin: EdgeInsets.only(left: 30, right: 8),
|
|
|
child: Text(
|
|
|
- roomInfo.containsKey("houseName")
|
|
|
- ? roomInfo["houseName"]
|
|
|
- : '',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
+ roomInfo.containsKey("houseName") ? roomInfo["houseName"] : '',
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
Image.network(
|
|
|
- houseLevelInfo.containsKey("icon")
|
|
|
- ? houseLevelInfo["icon"]
|
|
|
- : '',
|
|
|
+ houseLevelInfo.containsKey("icon") ? houseLevelInfo["icon"] : '',
|
|
|
width: 14,
|
|
|
),
|
|
|
Text(
|
|
|
- houseLevelInfo.containsKey("levelName")
|
|
|
- ? houseLevelInfo["levelName"]
|
|
|
- : '',
|
|
|
+ houseLevelInfo.containsKey("levelName") ? houseLevelInfo["levelName"] : '',
|
|
|
style: TextStyle(color: colorInfo[levelName]),
|
|
|
)
|
|
|
],
|
|
|
@@ -383,9 +352,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Container(
|
|
|
margin: EdgeInsets.only(top: 6),
|
|
|
child: Text(
|
|
|
- roomInfo.containsKey('houseAbstract')
|
|
|
- ? roomInfo["houseAbstract"]
|
|
|
- : "",
|
|
|
+ roomInfo.containsKey('houseAbstract') ? roomInfo["houseAbstract"] : "",
|
|
|
style: TextStyle(color: Color(0xFF9BA0AE), fontSize: 12),
|
|
|
),
|
|
|
),
|
|
|
@@ -397,17 +364,8 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
width: 20,
|
|
|
),
|
|
|
Text(
|
|
|
- (houseInfo != null
|
|
|
- ? houseInfo.playerNumber.toString()
|
|
|
- : '0') +
|
|
|
- '/' +
|
|
|
- (houseInfo != null
|
|
|
- ? houseInfo.maxNumber.toString()
|
|
|
- : '0'),
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- color: Color(0xFFB1B2C0)),
|
|
|
+ (houseInfo != null ? houseInfo.playerNumber.toString() : '0') + '/' + (houseInfo != null ? houseInfo.maxNumber.toString() : '0'),
|
|
|
+ style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xFFB1B2C0)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
@@ -416,10 +374,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
width: 200,
|
|
|
height: 40,
|
|
|
decoration: BoxDecoration(
|
|
|
- border: Border.all(
|
|
|
- width: 1,
|
|
|
- color: PRIMARY_COLOR,
|
|
|
- style: BorderStyle.solid),
|
|
|
+ border: Border.all(width: 1, color: PRIMARY_COLOR, style: BorderStyle.solid),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(2)),
|
|
|
),
|
|
|
child: Row(
|
|
|
@@ -441,10 +396,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
),
|
|
|
),
|
|
|
Text(
|
|
|
- 'X' +
|
|
|
- (houseInfo != null
|
|
|
- ? houseInfo.bonus.toString()
|
|
|
- : '0'),
|
|
|
+ 'X' + (houseInfo != null ? houseInfo.bonus.toString() : '0'),
|
|
|
style: TextStyle(
|
|
|
color: PRIMARY_COLOR,
|
|
|
fontSize: 22,
|
|
|
@@ -458,14 +410,10 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
? Container(
|
|
|
width: double.infinity,
|
|
|
margin: EdgeInsets.only(top: 25, left: 15, right: 15),
|
|
|
- padding: EdgeInsets.only(
|
|
|
- top: 15, left: 15, right: 10, bottom: 15),
|
|
|
+ padding: EdgeInsets.only(top: 15, left: 15, right: 10, bottom: 15),
|
|
|
decoration: BoxDecoration(
|
|
|
borderRadius: BorderRadius.only(
|
|
|
- topLeft: Radius.circular(0),
|
|
|
- topRight: Radius.circular(8),
|
|
|
- bottomLeft: Radius.circular(8),
|
|
|
- bottomRight: Radius.circular(8)),
|
|
|
+ topLeft: Radius.circular(0), topRight: Radius.circular(8), bottomLeft: Radius.circular(8), bottomRight: Radius.circular(8)),
|
|
|
gradient: LinearGradient(
|
|
|
begin: Alignment.topRight,
|
|
|
colors: [Color(0xFF464B6A), Color(0xFF35395E)],
|
|
|
@@ -492,16 +440,12 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Widget _joinBtn() {
|
|
|
int joinMoney = houseInfo != null ? houseInfo.houseLevel.entryCoin : 0;
|
|
|
int statusFlag = houseInfo != null ? houseInfo.statusFlag : 1;
|
|
|
- int playerStatus=playerInfo!=null?playerInfo.statusFlag:0;
|
|
|
+ int playerStatus = playerInfo != null ? playerInfo.statusFlag : 0;
|
|
|
if (!isJoin && statusFlag == 0) {
|
|
|
return Container(
|
|
|
width: ScreenUtil().setWidth(375),
|
|
|
height: 48 + ScreenUtil().setHeight(40),
|
|
|
- padding: EdgeInsets.only(
|
|
|
- top: ScreenUtil().setHeight(20),
|
|
|
- bottom: ScreenUtil().setHeight(20),
|
|
|
- left: 15,
|
|
|
- right: 15),
|
|
|
+ padding: EdgeInsets.only(top: ScreenUtil().setHeight(20), bottom: ScreenUtil().setHeight(20), left: 15, right: 15),
|
|
|
child: RaisedButton(
|
|
|
textColor: Colors.white,
|
|
|
child: Row(
|
|
|
@@ -515,20 +459,14 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
margin: EdgeInsets.only(left: 6),
|
|
|
child: Text(
|
|
|
'X' + joinMoney.toString(),
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
Container(
|
|
|
margin: EdgeInsets.only(left: 20),
|
|
|
child: Text(
|
|
|
'加入房间',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
))
|
|
|
],
|
|
|
),
|
|
|
@@ -549,7 +487,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
onPressed: null,
|
|
|
),
|
|
|
);
|
|
|
- } else if (isJoin && statusFlag == 2 &&playerStatus==3) {
|
|
|
+ } else if (isJoin && statusFlag == 2 && playerStatus == 3) {
|
|
|
return Container(
|
|
|
width: double.infinity,
|
|
|
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
|
|
|
@@ -611,8 +549,7 @@ class RankContentState extends State<RankContent> {
|
|
|
List<PlayerInfo> topList = [];
|
|
|
getTopList() async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- Result res = await HttpManager.get("playerInfo/rankPage",
|
|
|
- data: {"houseId": widget.roomId, "currentPage": 1, "pageNumber": 3});
|
|
|
+ Result res = await HttpManager.get("playerInfo/rankPage", data: {"houseId": widget.roomId, "currentPage": 1, "pageNumber": 3});
|
|
|
Toast.hide();
|
|
|
List<PlayerInfo> list = [];
|
|
|
if (res.success) {
|
|
|
@@ -628,9 +565,10 @@ class RankContentState extends State<RankContent> {
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
-
|
|
|
super.initState();
|
|
|
- getTopList();
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
+ getTopList();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
@@ -680,19 +618,14 @@ class RankContentState extends State<RankContent> {
|
|
|
width: _num == 1 ? 70 : 60,
|
|
|
height: _num == 1 ? 70 : 60,
|
|
|
decoration: BoxDecoration(
|
|
|
- gradient: LinearGradient(
|
|
|
- colors: colorList[_num - 1],
|
|
|
- begin: Alignment.topLeft,
|
|
|
- end: Alignment.bottomRight),
|
|
|
+ gradient: LinearGradient(colors: colorList[_num - 1], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(100)),
|
|
|
),
|
|
|
child: Center(
|
|
|
child: Container(
|
|
|
width: _num == 1 ? 60 : 50,
|
|
|
height: _num == 1 ? 60 : 50,
|
|
|
- child: CircleAvatar(
|
|
|
- backgroundImage:
|
|
|
- NetworkImage(topList[_num - 1].userInfo.icon)),
|
|
|
+ child: CircleAvatar(backgroundImage: NetworkImage(topList[_num - 1].userInfo.icon)),
|
|
|
)),
|
|
|
),
|
|
|
Positioned(
|
|
|
@@ -723,12 +656,7 @@ class RankContentState extends State<RankContent> {
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: <Widget>[
|
|
|
Image.asset('images/icon_jinbi_xiao_hong.png', width: 20),
|
|
|
- Text(
|
|
|
- 'x' +
|
|
|
- (topList[_num - 1].bonus != null
|
|
|
- ? topList[_num - 1].bonus.toString()
|
|
|
- : '0'),
|
|
|
- style: TextStyle(color: PRIMARY_COLOR, fontSize: 12))
|
|
|
+ Text('x' + (topList[_num - 1].bonus != null ? topList[_num - 1].bonus.toString() : '0'), style: TextStyle(color: PRIMARY_COLOR, fontSize: 12))
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
@@ -755,11 +683,7 @@ class SecondPageState extends State<SecondPage> {
|
|
|
getPlayerPage() async {
|
|
|
ismore = false;
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
- Result res = await HttpManager.get("playerInfo/rankPage", data: {
|
|
|
- "houseId": widget.roomId,
|
|
|
- "currentPage": currentPage,
|
|
|
- "pageNumber": 20
|
|
|
- });
|
|
|
+ Result res = await HttpManager.get("playerInfo/rankPage", data: {"houseId": widget.roomId, "currentPage": currentPage, "pageNumber": 20});
|
|
|
Toast.hide();
|
|
|
List<PlayerInfo> list = joinList;
|
|
|
if (currentPage == 1) {
|
|
|
@@ -783,25 +707,24 @@ class SecondPageState extends State<SecondPage> {
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
-
|
|
|
super.initState();
|
|
|
_perController = ScrollController();
|
|
|
currentPage = 1;
|
|
|
- getPlayerPage();
|
|
|
- _perController.addListener(() {
|
|
|
- if (_perController.position.pixels ==
|
|
|
- _perController.position.maxScrollExtent) {
|
|
|
- if (ismore) {
|
|
|
- currentPage++;
|
|
|
- getPlayerPage();
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
+ getPlayerPage();
|
|
|
+ _perController.addListener(() {
|
|
|
+ if (_perController.position.pixels == _perController.position.maxScrollExtent) {
|
|
|
+ if (ismore) {
|
|
|
+ currentPage++;
|
|
|
+ getPlayerPage();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
-
|
|
|
super.dispose();
|
|
|
_perController.dispose();
|
|
|
}
|
|
|
@@ -846,10 +769,7 @@ class SecondPageState extends State<SecondPage> {
|
|
|
margin: EdgeInsets.only(top: index == 0 ? 10 : 0),
|
|
|
padding: EdgeInsets.only(left: 15, right: 15),
|
|
|
child: Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- width: 1, color: BG_SUB_COLOR, style: BorderStyle.solid))),
|
|
|
+ decoration: BoxDecoration(border: Border(bottom: BorderSide(width: 1, color: BG_SUB_COLOR, style: BorderStyle.solid))),
|
|
|
child: Row(
|
|
|
children: <Widget>[
|
|
|
Container(
|
|
|
@@ -857,8 +777,7 @@ class SecondPageState extends State<SecondPage> {
|
|
|
width: 36,
|
|
|
height: 36,
|
|
|
child: CircleAvatar(
|
|
|
- backgroundImage: NetworkImage(
|
|
|
- info.userInfo != null ? info.userInfo.icon : ''),
|
|
|
+ backgroundImage: NetworkImage(info.userInfo != null ? info.userInfo.icon : ''),
|
|
|
),
|
|
|
),
|
|
|
Expanded(
|
|
|
@@ -875,9 +794,7 @@ class SecondPageState extends State<SecondPage> {
|
|
|
),
|
|
|
widget.status == 4 && index < 3
|
|
|
? Image.asset(
|
|
|
- 'images/icon_paihangbang_0' +
|
|
|
- (index + 1).toString() +
|
|
|
- '.png',
|
|
|
+ 'images/icon_paihangbang_0' + (index + 1).toString() + '.png',
|
|
|
width: 32,
|
|
|
)
|
|
|
: Container()
|