|
|
@@ -7,6 +7,9 @@ import 'dart:convert';
|
|
|
import '../widget/room_item.dart';
|
|
|
import '../widget/popupButton_my.dart';
|
|
|
import 'dart:ui';
|
|
|
+import '../styles/netUtil.dart';
|
|
|
+import '../net/HttpManager.dart';
|
|
|
+import '../net/Result.dart';
|
|
|
|
|
|
class RoomList extends StatefulWidget {
|
|
|
@override
|
|
|
@@ -14,11 +17,36 @@ class RoomList extends StatefulWidget {
|
|
|
}
|
|
|
|
|
|
class RoomListState extends State<RoomList> {
|
|
|
- List<Map> roomList = [];
|
|
|
+ List roomList = [];
|
|
|
int currentPage = 1;
|
|
|
ScrollController _controller;
|
|
|
bool scrollFlag = true;
|
|
|
|
|
|
+ String game_id = '';
|
|
|
+ String house_level = '';
|
|
|
+ String house_type = '';
|
|
|
+ String status_flag = '0';
|
|
|
+
|
|
|
+ List gameList = [
|
|
|
+ {"id": '', "gameName": '全部游戏'}
|
|
|
+ ];
|
|
|
+ List levelList = [
|
|
|
+ {"levelName": '全部等级', "id": ''}
|
|
|
+ ];
|
|
|
+ List typeList = [
|
|
|
+ {"name": '全部房间', "val": ''},
|
|
|
+ {"name": '普通房间', 'val': '0'},
|
|
|
+ {"name": '官方房间', 'val': '1'}
|
|
|
+ ];
|
|
|
+ List statusList = [
|
|
|
+ {"name": '不限状态', "val": ''},
|
|
|
+ {"name": '等待中', "val": '0'},
|
|
|
+ {"name": '准备中', "val": '1'},
|
|
|
+ {"name": '已经开始', "val": '2'},
|
|
|
+ {"name": '已经结束', "val": '3'},
|
|
|
+ {"name": '正在结算', "val": '4'}
|
|
|
+ ];
|
|
|
+
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
@@ -32,9 +60,28 @@ class RoomListState extends State<RoomList> {
|
|
|
});
|
|
|
getRoomInfo();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ getInfo();
|
|
|
+ }
|
|
|
+
|
|
|
+ getInfo() async {
|
|
|
+ Result res = await HttpManager.get("gameInfo/all");
|
|
|
+ if (res.success) {
|
|
|
+ setState(() {
|
|
|
+ gameList.addAll(res.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ Result res2 = await HttpManager.get("houseLevel/all");
|
|
|
+ if (res2.success) {
|
|
|
+ print(res2.data);
|
|
|
+ setState(() {
|
|
|
+ levelList.addAll(res2.data);
|
|
|
+ });
|
|
|
+ print(levelList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
@@ -108,88 +155,289 @@ class RoomListState extends State<RoomList> {
|
|
|
child: Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: <Widget>[
|
|
|
- _chooseItem(),
|
|
|
- _chooseItem(),
|
|
|
- _chooseItem(),
|
|
|
- _chooseItem()
|
|
|
+ _chooseGame(),
|
|
|
+ _chooseHouseType(),
|
|
|
+ _chooseLevel(),
|
|
|
+ _chooseStatus()
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _chooseItem() {
|
|
|
+//选择游戏
|
|
|
+ Widget _chooseGame() {
|
|
|
+ Map gameInfo = {};
|
|
|
+ for (var item in gameList) {
|
|
|
+ print(item['id']);
|
|
|
+ if (item['id'].toString() == game_id.toString()) {
|
|
|
+ gameInfo = item;
|
|
|
+ }
|
|
|
+ }
|
|
|
return Expanded(
|
|
|
flex: 1,
|
|
|
child: MyPopupMenuButton(
|
|
|
- initialValue:'刺激战场',
|
|
|
- padding: EdgeInsets.all(0.0),
|
|
|
+ initialValue: game_id,
|
|
|
+ padding: EdgeInsets.all(0.0),
|
|
|
child: Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: <Widget>[
|
|
|
- Text(
|
|
|
- '全部游戏',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 12,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: Text(
|
|
|
+ gameInfo['gameName'],
|
|
|
+ style: TextStyle(
|
|
|
+ color: game_id != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ fontSize: 12,
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Icon(
|
|
|
+ Icons.keyboard_arrow_down,
|
|
|
+ color: game_id != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ size: 18,
|
|
|
),
|
|
|
- Image.asset(
|
|
|
- 'images/icon_zhankai_baise.png',
|
|
|
- width: 20,
|
|
|
- )
|
|
|
],
|
|
|
),
|
|
|
- onSelected: (String value) {
|
|
|
- print('******');
|
|
|
+ onSelected: (value) {
|
|
|
+ setState(() {
|
|
|
+ game_id = value;
|
|
|
+ });
|
|
|
+ getRoomInfo();
|
|
|
},
|
|
|
- itemBuilder: (BuildContext context) => <MyPopupMenuEntry<String>>[
|
|
|
- MyPopupMenuItem(
|
|
|
- child: Container(
|
|
|
- height: 30,
|
|
|
- child: Text('刺激战场',style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- )),
|
|
|
+ itemBuilder: (BuildContext context) {
|
|
|
+ return gameList.map((choice) {
|
|
|
+ return new MyPopupMenuItem(
|
|
|
+ child: new Text(
|
|
|
+ choice['gameName'],
|
|
|
+ style: TextStyle(fontSize: 14),
|
|
|
),
|
|
|
- value: '刺激战场',
|
|
|
+ value: choice['id'].toString());
|
|
|
+ }).toList();
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+//选择等级
|
|
|
+ Widget _chooseLevel() {
|
|
|
+ print(levelList);
|
|
|
+ Map levelInfo = {};
|
|
|
+ for (var item in levelList) {
|
|
|
+ print(item['id']);
|
|
|
+ if (item['id'].toString() == house_level.toString()) {
|
|
|
+ levelInfo = item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: MyPopupMenuButton(
|
|
|
+ initialValue: house_level,
|
|
|
+ padding: EdgeInsets.all(0.0),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: Text(
|
|
|
+ levelInfo['levelName'],
|
|
|
+ style: TextStyle(
|
|
|
+ color: house_level != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ fontSize: 12,
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
),
|
|
|
- MyPopupMenuItem(
|
|
|
- child: Container(
|
|
|
- child: Text('11',style: TextStyle(
|
|
|
- fontSize: 14
|
|
|
- )),
|
|
|
+ ),
|
|
|
+ Icon(
|
|
|
+ Icons.keyboard_arrow_down,
|
|
|
+ color: house_level != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ size: 18,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onSelected: (value) {
|
|
|
+ setState(() {
|
|
|
+ house_level = value;
|
|
|
+ });
|
|
|
+ getRoomInfo();
|
|
|
+ },
|
|
|
+ itemBuilder: (BuildContext context) {
|
|
|
+ return levelList.map((choice) {
|
|
|
+ return new MyPopupMenuItem(
|
|
|
+ child: new Text(
|
|
|
+ choice['levelName'],
|
|
|
+ style: TextStyle(fontSize: 14),
|
|
|
),
|
|
|
- value: '这是增加',
|
|
|
+ value: choice['id'].toString());
|
|
|
+ }).toList();
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ //选择房间状态
|
|
|
+ Widget _chooseHouseType() {
|
|
|
+ Map typeInfo = {};
|
|
|
+ for (var item in typeList) {
|
|
|
+ if (item['val'] == house_type) {
|
|
|
+ typeInfo = item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: MyPopupMenuButton(
|
|
|
+ initialValue: house_type,
|
|
|
+ padding: EdgeInsets.all(0.0),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: Text(
|
|
|
+ typeInfo['name'],
|
|
|
+ style: TextStyle(
|
|
|
+ color: house_type != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ fontSize: 12,
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Icon(
|
|
|
+ Icons.keyboard_arrow_down,
|
|
|
+ color: house_type != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ size: 18,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onSelected: (value) {
|
|
|
+ setState(() {
|
|
|
+ house_type = value;
|
|
|
+ });
|
|
|
+ getRoomInfo();
|
|
|
+ },
|
|
|
+ itemBuilder: (BuildContext context) {
|
|
|
+ return typeList.map((choice) {
|
|
|
+ return new MyPopupMenuItem(
|
|
|
+ child: new Text(
|
|
|
+ choice['name'],
|
|
|
+ style: TextStyle(fontSize: 14),
|
|
|
+ ),
|
|
|
+ value: choice['val']);
|
|
|
+ }).toList();
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ //选择状态
|
|
|
+ Widget _chooseStatus() {
|
|
|
+ Map statusInfo = {};
|
|
|
+ for (var item in statusList) {
|
|
|
+ if (item['val'] == status_flag) {
|
|
|
+ statusInfo = item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: MyPopupMenuButton(
|
|
|
+ initialValue: status_flag,
|
|
|
+ padding: EdgeInsets.all(0.0),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: Text(
|
|
|
+ statusInfo['name'],
|
|
|
+ style: TextStyle(
|
|
|
+ color: status_flag != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ fontSize: 12,
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
),
|
|
|
- ]),
|
|
|
+ ),
|
|
|
+ Icon(
|
|
|
+ Icons.keyboard_arrow_down,
|
|
|
+ color: status_flag != '' ? PRIMARY_COLOR : Colors.white,
|
|
|
+ size: 18,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onSelected: (value) {
|
|
|
+ setState(() {
|
|
|
+ status_flag = value;
|
|
|
+ });
|
|
|
+ getRoomInfo();
|
|
|
+ },
|
|
|
+ itemBuilder: (BuildContext context) {
|
|
|
+ return statusList.map((choice) {
|
|
|
+ return new MyPopupMenuItem(
|
|
|
+ child: new Text(
|
|
|
+ choice['name'],
|
|
|
+ style: TextStyle(fontSize: 14),
|
|
|
+ ),
|
|
|
+ value: choice['val']);
|
|
|
+ }).toList();
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
void getRoomInfo() async {
|
|
|
- print('getInfo');
|
|
|
if (currentPage == 1) {
|
|
|
setState(() {
|
|
|
roomList = [];
|
|
|
});
|
|
|
}
|
|
|
- final response = await Dio().get(domain + 'houseInfo/page', queryParameters: {
|
|
|
+
|
|
|
+ Map<String, dynamic> data = {
|
|
|
"currentPage": currentPage,
|
|
|
"pageNumber": 20,
|
|
|
- });
|
|
|
- final res = json.decode(response.toString());
|
|
|
- if (res['success']) {
|
|
|
- for (var item in res['data']['pp']) {
|
|
|
- setState(() {
|
|
|
- roomList.add(item);
|
|
|
- });
|
|
|
- }
|
|
|
- if (res['data']['page']['currentPage'] <
|
|
|
- res['data']['page']['totalPage']) {
|
|
|
+ };
|
|
|
+ data['advancedQuery'] = '';
|
|
|
+ if (game_id != '') {
|
|
|
+ data['advancedQuery'] += 'AND_,game_id_,=_,' + game_id + '_;';
|
|
|
+ }
|
|
|
+ if (house_level != '') {
|
|
|
+ data['advancedQuery'] += 'AND_,house_level_,=_,' + house_level + '_;';
|
|
|
+ }
|
|
|
+ if (house_type != '') {
|
|
|
+ data['advancedQuery'] += 'AND_,house_type_,=_,' + house_type + '_;';
|
|
|
+ }
|
|
|
+ if (status_flag != '') {
|
|
|
+ data['advancedQuery'] += 'AND_,status_flag_,=_,' + status_flag + '_;';
|
|
|
+ }
|
|
|
+ Result res = await HttpManager.get("houseInfo/page", data: data);
|
|
|
+ if (res.success) {
|
|
|
+ setState(() {
|
|
|
+ roomList.addAll(res.data['pp']);
|
|
|
+ });
|
|
|
+ if (res.data['page']['currentPage'] < res.data['page']['totalPage']) {
|
|
|
scrollFlag = true;
|
|
|
} else {
|
|
|
scrollFlag = false;
|
|
|
}
|
|
|
- }
|
|
|
+ } else {}
|
|
|
+
|
|
|
+ // final response = await Dio().get(domain + 'houseInfo/page', data: data);
|
|
|
+ // final res = json.decode(response.toString());
|
|
|
+ // if (res['success']) {
|
|
|
+ // for (var item in res['data']['pp']) {
|
|
|
+ // setState(() {
|
|
|
+ // roomList.add(item);
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // if (res['data']['page']['currentPage'] <
|
|
|
+ // res['data']['page']['totalPage']) {
|
|
|
+ // scrollFlag = true;
|
|
|
+ // } else {
|
|
|
+ // scrollFlag = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
}
|