|
@@ -7,6 +7,8 @@ import 'dart:ui';
|
|
|
import 'dart:convert';
|
|
import 'dart:convert';
|
|
|
import '../net/HttpManager.dart';
|
|
import '../net/HttpManager.dart';
|
|
|
import '../net/Result.dart';
|
|
import '../net/Result.dart';
|
|
|
|
|
+import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
|
+import '../redux/AppState.dart';
|
|
|
|
|
|
|
|
class RoomInfo extends StatefulWidget {
|
|
class RoomInfo extends StatefulWidget {
|
|
|
RoomInfo({Key key, this.roomId}) : super(key: key);
|
|
RoomInfo({Key key, this.roomId}) : super(key: key);
|
|
@@ -25,10 +27,23 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
Map roomInfo;
|
|
Map roomInfo;
|
|
|
Map colorInfo;
|
|
Map colorInfo;
|
|
|
List joinList = [];
|
|
List joinList = [];
|
|
|
- bool isJoin = false;
|
|
|
|
|
-
|
|
|
|
|
- checkJoinInfo() {
|
|
|
|
|
|
|
+ bool isJoin = true;
|
|
|
|
|
|
|
|
|
|
+ checkJoinInfo() async {
|
|
|
|
|
+ Result res = await HttpManager.get("playerInfo/check", data: {
|
|
|
|
|
+ "userId": StoreProvider.of<AppState>(context).state.userInfo.id,
|
|
|
|
|
+ "houseId": widget.roomId
|
|
|
|
|
+ });
|
|
|
|
|
+ print(res.error);
|
|
|
|
|
+ if (res.success) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ isJoin = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (res.error == '玩家已存在') {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ isJoin = true;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
@@ -51,7 +66,7 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
};
|
|
};
|
|
|
_perController = ScrollController();
|
|
_perController = ScrollController();
|
|
|
getRoomInfo();
|
|
getRoomInfo();
|
|
|
- Future.delayed(Duration(milliseconds: 100),(){
|
|
|
|
|
|
|
+ Future.delayed(Duration(milliseconds: 100), () {
|
|
|
checkJoinInfo();
|
|
checkJoinInfo();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -275,48 +290,63 @@ class RoomInfoState extends State<RoomInfo>
|
|
|
int joinMoney = houseLevelInfo.containsKey('entryCoin')
|
|
int joinMoney = houseLevelInfo.containsKey('entryCoin')
|
|
|
? houseLevelInfo['entryCoin']
|
|
? houseLevelInfo['entryCoin']
|
|
|
: 0;
|
|
: 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),
|
|
|
|
|
- child: RaisedButton(
|
|
|
|
|
- textColor: Colors.white,
|
|
|
|
|
- child: Row(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Image.asset(
|
|
|
|
|
- 'images/icon_jinbi_da_bai.png',
|
|
|
|
|
- width: 20,
|
|
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(left: 6),
|
|
|
|
|
- child: Text(
|
|
|
|
|
- 'X' + joinMoney.toString(),
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- color: Colors.white,
|
|
|
|
|
- fontSize: 16,
|
|
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
|
|
|
|
+ if (!isJoin) {
|
|
|
|
|
+ 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),
|
|
|
|
|
+ child: RaisedButton(
|
|
|
|
|
+ textColor: Colors.white,
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Image.asset(
|
|
|
|
|
+ 'images/icon_jinbi_da_bai.png',
|
|
|
|
|
+ width: 20,
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(left: 20),
|
|
|
|
|
|
|
+ Container(
|
|
|
|
|
+ margin: EdgeInsets.only(left: 6),
|
|
|
child: Text(
|
|
child: Text(
|
|
|
- '加入房间',
|
|
|
|
|
|
|
+ 'X' + joinMoney.toString(),
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
fontSize: 16,
|
|
fontSize: 16,
|
|
|
fontWeight: FontWeight.w500),
|
|
fontWeight: FontWeight.w500),
|
|
|
- ))
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ margin: EdgeInsets.only(left: 20),
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ '加入房间',
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontSize: 16,
|
|
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
|
|
+ ))
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ onPressed: () => {},
|
|
|
),
|
|
),
|
|
|
- onPressed: () => {},
|
|
|
|
|
- ),
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ } else if (roomInfo['statusFlag'] == 0) {
|
|
|
|
|
+ return Container(
|
|
|
|
|
+ width: double.infinity,
|
|
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
|
|
|
|
|
+ height: 88,
|
|
|
|
|
+ child: RaisedButton(
|
|
|
|
|
+ disabledColor: Color(0xFF914244),
|
|
|
|
|
+ disabledTextColor: Color(0xFF252532),
|
|
|
|
|
+ child: Text('等待开始中',style: TextStyle(fontSize: 16),),
|
|
|
|
|
+ onPressed: null,
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return Container();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Widget _secondPage(BuildContext context) {
|
|
Widget _secondPage(BuildContext context) {
|