|
@@ -14,6 +14,8 @@ import '../redux/AppState.dart';
|
|
|
import '../net/HttpManager.dart';
|
|
import '../net/HttpManager.dart';
|
|
|
import '../net/Result.dart';
|
|
import '../net/Result.dart';
|
|
|
import 'package:dio/dio.dart';
|
|
import 'package:dio/dio.dart';
|
|
|
|
|
+import '../model/GameInfo.dart';
|
|
|
|
|
+import '../model/HouseLevel.dart';
|
|
|
|
|
|
|
|
class OpenRoom extends StatefulWidget {
|
|
class OpenRoom extends StatefulWidget {
|
|
|
OpenRoom({Key key, this.roomFlag}) : super(key: key);
|
|
OpenRoom({Key key, this.roomFlag}) : super(key: key);
|
|
@@ -24,11 +26,16 @@ class OpenRoom extends StatefulWidget {
|
|
|
|
|
|
|
|
class OpenRoomState extends State<OpenRoom> {
|
|
class OpenRoomState extends State<OpenRoom> {
|
|
|
TextStyle titleStyle = TextStyle(color: Colors.white, fontSize: 14);
|
|
TextStyle titleStyle = TextStyle(color: Colors.white, fontSize: 14);
|
|
|
- TextStyle valStyle = TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500);
|
|
|
|
|
|
|
+ TextStyle valStyle =
|
|
|
|
|
+ TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500);
|
|
|
|
|
|
|
|
- Map<String, dynamic> editRoomInfo = {"gameId": 1, "houseLevel": 1, "maxNumber": 10};
|
|
|
|
|
- List gameList = [];
|
|
|
|
|
- List levelList = [];
|
|
|
|
|
|
|
+ Map<String, dynamic> editRoomInfo = {
|
|
|
|
|
+ "gameId": 1,
|
|
|
|
|
+ "houseLevel": 1,
|
|
|
|
|
+ "maxNumber": 10
|
|
|
|
|
+ };
|
|
|
|
|
+ List<GameInfo> gameList = [];
|
|
|
|
|
+ List<HouseLevel> levelList = [];
|
|
|
|
|
|
|
|
void getFilePath() async {
|
|
void getFilePath() async {
|
|
|
String filePath = await FilePicker.getFilePath(type: FileType.ANY);
|
|
String filePath = await FilePicker.getFilePath(type: FileType.ANY);
|
|
@@ -58,74 +65,99 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
Toast.show(context, '请选择房间等级', 1500, 'info');
|
|
Toast.show(context, '请选择房间等级', 1500, 'info');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (editRoomInfo['houseType'] == '1' && (editRoomInfo['gameHouseId'] == null || editRoomInfo['gameHouseId'] == '')) {
|
|
|
|
|
|
|
+ if (editRoomInfo['houseType'] == '1' &&
|
|
|
|
|
+ (editRoomInfo['gameHouseId'] == null ||
|
|
|
|
|
+ editRoomInfo['gameHouseId'] == '')) {
|
|
|
Toast.show(context, '请录入游戏房间号', 1500, 'info');
|
|
Toast.show(context, '请录入游戏房间号', 1500, 'info');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (editRoomInfo['houseType'] == '1' && (editRoomInfo['gameHousePassword'] == null || editRoomInfo['gameHousePassword'] == '')) {
|
|
|
|
|
|
|
+ if (editRoomInfo['houseType'] == '1' &&
|
|
|
|
|
+ (editRoomInfo['gameHousePassword'] == null ||
|
|
|
|
|
+ editRoomInfo['gameHousePassword'] == '')) {
|
|
|
Toast.show(context, '请录入游戏房间密码', 1500, 'info');
|
|
Toast.show(context, '请录入游戏房间密码', 1500, 'info');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- editRoomInfo['userId'] = StoreProvider.of<AppState>(context).state.userInfo.id;
|
|
|
|
|
|
|
+ editRoomInfo['createUser'] =
|
|
|
|
|
+ StoreProvider.of<AppState>(context).state.userInfo.id;
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
Result res = await HttpManager.post("houseInfo/save", data: editRoomInfo);
|
|
Result res = await HttpManager.post("houseInfo/save", data: editRoomInfo);
|
|
|
Toast.hide();
|
|
Toast.hide();
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
- HttpManager.post("houseInfo/join", data: {"houseId": res.data, "userId": StoreProvider.of<AppState>(context).state.userInfo.id});
|
|
|
|
|
- Toast.show(context, '创建成功', 1500, 'success');
|
|
|
|
|
|
|
+ HttpManager.post("houseInfo/join", data: {
|
|
|
|
|
+ "houseId": res.data,
|
|
|
|
|
+ "userId": StoreProvider.of<AppState>(context).state.userInfo.id
|
|
|
|
|
+ });
|
|
|
|
|
+ Toast.show(context, '创建成功', 1500, 'success');
|
|
|
Future.delayed(Duration(milliseconds: 1500), () {
|
|
Future.delayed(Duration(milliseconds: 1500), () {
|
|
|
Navigator.pushAndRemoveUntil(
|
|
Navigator.pushAndRemoveUntil(
|
|
|
- context, new CupertinoPageRoute(builder: (context) => new RoomInfo(roomId: res.data.toString())), ModalRoute.withName('/'));
|
|
|
|
|
|
|
+ context,
|
|
|
|
|
+ new CupertinoPageRoute(
|
|
|
|
|
+ builder: (context) =>
|
|
|
|
|
+ new RoomInfo(roomId: res.data.toString())),
|
|
|
|
|
+ ModalRoute.withName('/'));
|
|
|
});
|
|
});
|
|
|
} else {}
|
|
} else {}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @override
|
|
|
|
|
- void initState() {
|
|
|
|
|
- super.initState();
|
|
|
|
|
- editRoomInfo['houseType'] = widget.roomFlag;
|
|
|
|
|
-
|
|
|
|
|
- Future.delayed(Duration.zero, () {
|
|
|
|
|
- getInfo();
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- getInfo() async {
|
|
|
|
|
|
|
+ void getInfo() async {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
Result res = await HttpManager.get("gameInfo/all");
|
|
Result res = await HttpManager.get("gameInfo/all");
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
|
|
+ List<GameInfo> _list = [];
|
|
|
|
|
+ for (var item in res.data) {
|
|
|
|
|
+ _list.add(GameInfo.fromJson(item));
|
|
|
|
|
+ }
|
|
|
setState(() {
|
|
setState(() {
|
|
|
- gameList = res.data;
|
|
|
|
|
|
|
+ gameList = _list;
|
|
|
if (res.data.length > 0) {
|
|
if (res.data.length > 0) {
|
|
|
editRoomInfo['gameId'] = res.data[0]['id'];
|
|
editRoomInfo['gameId'] = res.data[0]['id'];
|
|
|
|
|
+ editRoomInfo['houseName'] =
|
|
|
|
|
+ StoreProvider.of<AppState>(context).state.userInfo.nickname +'的'+
|
|
|
|
|
+ res.data[0]['shortName']+'房间';
|
|
|
|
|
+ editRoomInfo['houseAbstract']=res.data[0]['profile']??'';
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
} else {}
|
|
} else {}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
Result res2 = await HttpManager.get("houseLevel/all");
|
|
Result res2 = await HttpManager.get("houseLevel/all");
|
|
|
Toast.hide();
|
|
Toast.hide();
|
|
|
if (res2.success) {
|
|
if (res2.success) {
|
|
|
|
|
+ List<HouseLevel> _list = [];
|
|
|
|
|
+ for (var item in res2.data) {
|
|
|
|
|
+ _list.add(HouseLevel.fromJson(item));
|
|
|
|
|
+ }
|
|
|
setState(() {
|
|
setState(() {
|
|
|
- levelList = res2.data;
|
|
|
|
|
|
|
+ levelList = _list;
|
|
|
if (levelList.length > 0) {
|
|
if (levelList.length > 0) {
|
|
|
- editRoomInfo['houseLevel'] = levelList[0]['id'];
|
|
|
|
|
|
|
+ editRoomInfo['houseLevel'] = res2.data[0]['id'];
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
} else {}
|
|
} else {}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @override
|
|
|
|
|
+ void initState() {
|
|
|
|
|
+ super.initState();
|
|
|
|
|
+ editRoomInfo['houseType'] = widget.roomFlag;
|
|
|
|
|
+
|
|
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
|
|
+ getInfo();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
- Map chooseGameInfo = {};
|
|
|
|
|
|
|
+ GameInfo chooseGameInfo = GameInfo.empty();
|
|
|
for (var item in gameList) {
|
|
for (var item in gameList) {
|
|
|
- if (item['id'].toString() == editRoomInfo['gameId'].toString()) {
|
|
|
|
|
|
|
+ if (item.id.toString() == editRoomInfo['gameId'].toString()) {
|
|
|
chooseGameInfo = item;
|
|
chooseGameInfo = item;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Map chooseLevelInfo = {};
|
|
|
|
|
|
|
+ HouseLevel chooseLevelInfo = HouseLevel.empty();
|
|
|
for (var item in levelList) {
|
|
for (var item in levelList) {
|
|
|
- if (item['id'].toString() == editRoomInfo['houseLevel'].toString()) {
|
|
|
|
|
|
|
+ if (item.id.toString() == editRoomInfo['houseLevel'].toString()) {
|
|
|
chooseLevelInfo = item;
|
|
chooseLevelInfo = item;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -143,7 +175,8 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
child: FlatButton(
|
|
child: FlatButton(
|
|
|
highlightColor: PRIMARY_COLOR,
|
|
highlightColor: PRIMARY_COLOR,
|
|
|
padding: EdgeInsets.only(right: 0),
|
|
padding: EdgeInsets.only(right: 0),
|
|
|
- child: Text('规则', style: TextStyle(color: Colors.white, fontSize: 13)),
|
|
|
|
|
|
|
+ child: Text('规则',
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 13)),
|
|
|
onPressed: () {},
|
|
onPressed: () {},
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
@@ -158,29 +191,13 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
color: BG_COLOR,
|
|
color: BG_COLOR,
|
|
|
child: Column(
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Container(
|
|
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 15),
|
|
|
|
|
- color: BG_COLOR,
|
|
|
|
|
- height: 60,
|
|
|
|
|
- child: GestureDetector(
|
|
|
|
|
- child: Row(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Text('选择游戏', style: titleStyle),
|
|
|
|
|
- Expanded(
|
|
|
|
|
- flex: 1,
|
|
|
|
|
- child: Text(
|
|
|
|
|
- chooseGameInfo.containsKey('gameName') ? chooseGameInfo['gameName'] : '',
|
|
|
|
|
- textAlign: TextAlign.right,
|
|
|
|
|
- style: valStyle,
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Image.asset('images/icon_inter.png', width: 24)
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- showPicker(context);
|
|
|
|
|
- },
|
|
|
|
|
- )),
|
|
|
|
|
|
|
+ ChooseContent(
|
|
|
|
|
+ title: '选择游戏',
|
|
|
|
|
+ val: chooseGameInfo.gameName,
|
|
|
|
|
+ onTapHomeMenu: () {
|
|
|
|
|
+ showPicker(context);
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
Container(
|
|
Container(
|
|
|
width: double.infinity,
|
|
width: double.infinity,
|
|
|
color: BG_SUB_COLOR,
|
|
color: BG_SUB_COLOR,
|
|
@@ -220,138 +237,107 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
Padding(
|
|
Padding(
|
|
|
padding: EdgeInsets.only(top: 12),
|
|
padding: EdgeInsets.only(top: 12),
|
|
|
child: Text(
|
|
child: Text(
|
|
|
- editRoomInfo.containsKey('video') ? '已选择' : '不上传则自动使用官方默认视频',
|
|
|
|
|
- style: TextStyle(color: Color(0xFF9BA0AE), fontSize: 13),
|
|
|
|
|
|
|
+ editRoomInfo.containsKey('video')
|
|
|
|
|
+ ? '已选择'
|
|
|
|
|
+ : '不上传则自动使用官方默认视频',
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Color(0xFF9BA0AE), fontSize: 13),
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
//房间标题
|
|
//房间标题
|
|
|
- Container(
|
|
|
|
|
- height: 60,
|
|
|
|
|
- color: BG_COLOR,
|
|
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
|
|
|
|
- child: TextField(
|
|
|
|
|
- textAlign: TextAlign.end,
|
|
|
|
|
- style: valStyle,
|
|
|
|
|
- maxLength: 10,
|
|
|
|
|
- decoration: InputDecoration(
|
|
|
|
|
- hintText: "请输入房间标题",
|
|
|
|
|
- hintStyle: TextStyle(color: Color(0xFF727785), fontSize: 13),
|
|
|
|
|
- prefixIcon: Padding(
|
|
|
|
|
- padding: EdgeInsets.symmetric(vertical: 12),
|
|
|
|
|
- child: Text('房间标题', style: titleStyle),
|
|
|
|
|
- ),
|
|
|
|
|
- border: InputBorder.none,
|
|
|
|
|
- counterStyle: TextStyle(fontSize: 0)),
|
|
|
|
|
- onChanged: (value) {
|
|
|
|
|
|
|
+ // Container(
|
|
|
|
|
+ // height: 60,
|
|
|
|
|
+ // color: BG_COLOR,
|
|
|
|
|
+ // padding:
|
|
|
|
|
+ // EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
|
|
|
|
+ // child: TextField(
|
|
|
|
|
+ // textAlign: TextAlign.end,
|
|
|
|
|
+ // style: valStyle,
|
|
|
|
|
+ // maxLength: 10,
|
|
|
|
|
+ // decoration: InputDecoration(
|
|
|
|
|
+ // hintText: "请输入房间标题",
|
|
|
|
|
+ // hintStyle: TextStyle(
|
|
|
|
|
+ // color: Color(0xFF727785), fontSize: 13),
|
|
|
|
|
+ // prefixIcon: Padding(
|
|
|
|
|
+ // padding: EdgeInsets.symmetric(vertical: 12),
|
|
|
|
|
+ // child: Text('房间标题', style: titleStyle),
|
|
|
|
|
+ // ),
|
|
|
|
|
+ // border: InputBorder.none,
|
|
|
|
|
+ // counterStyle: TextStyle(fontSize: 0)),
|
|
|
|
|
+ // onChanged: (value) {
|
|
|
|
|
+ // editRoomInfo['houseName'] = value;
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ),
|
|
|
|
|
+ // ),
|
|
|
|
|
+ InputContent(
|
|
|
|
|
+ title: '房间标题',
|
|
|
|
|
+ value: editRoomInfo['houseName'],
|
|
|
|
|
+ onTextChange: (value) {
|
|
|
editRoomInfo['houseName'] = value;
|
|
editRoomInfo['houseName'] = value;
|
|
|
- },
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ }),
|
|
|
Container(
|
|
Container(
|
|
|
height: 1,
|
|
height: 1,
|
|
|
color: BG_SUB_COLOR,
|
|
color: BG_SUB_COLOR,
|
|
|
),
|
|
),
|
|
|
//房间简介
|
|
//房间简介
|
|
|
- Container(
|
|
|
|
|
- height: 60,
|
|
|
|
|
- color: BG_COLOR,
|
|
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
|
|
|
|
- child: TextField(
|
|
|
|
|
- textAlign: TextAlign.end,
|
|
|
|
|
- style: valStyle,
|
|
|
|
|
- maxLength: 15,
|
|
|
|
|
- decoration: InputDecoration(
|
|
|
|
|
- hintText: "请输入房间简介",
|
|
|
|
|
- hintStyle: TextStyle(color: Color(0xFF727785), fontSize: 13),
|
|
|
|
|
- prefixIcon: Padding(
|
|
|
|
|
- padding: EdgeInsets.symmetric(vertical: 12),
|
|
|
|
|
- child: Text('房间简介', style: titleStyle),
|
|
|
|
|
- ),
|
|
|
|
|
- border: InputBorder.none,
|
|
|
|
|
- counterStyle: TextStyle(fontSize: 0)),
|
|
|
|
|
- onChanged: (value) {
|
|
|
|
|
|
|
+ InputContent(
|
|
|
|
|
+ title: '房间简介',
|
|
|
|
|
+ value: editRoomInfo['houseAbstract'],
|
|
|
|
|
+ onTextChange: (value) {
|
|
|
editRoomInfo['houseAbstract'] = value;
|
|
editRoomInfo['houseAbstract'] = value;
|
|
|
- },
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ // Container(
|
|
|
|
|
+ // height: 60,
|
|
|
|
|
+ // color: BG_COLOR,
|
|
|
|
|
+ // padding:
|
|
|
|
|
+ // EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
|
|
|
|
+ // child: TextField(
|
|
|
|
|
+ // textAlign: TextAlign.end,
|
|
|
|
|
+ // style: valStyle,
|
|
|
|
|
+ // maxLength: 15,
|
|
|
|
|
+ // decoration: InputDecoration(
|
|
|
|
|
+ // hintText: "请输入房间简介",
|
|
|
|
|
+ // hintStyle: TextStyle(
|
|
|
|
|
+ // color: Color(0xFF727785), fontSize: 13),
|
|
|
|
|
+ // prefixIcon: Padding(
|
|
|
|
|
+ // padding: EdgeInsets.symmetric(vertical: 12),
|
|
|
|
|
+ // child: Text('房间简介', style: titleStyle),
|
|
|
|
|
+ // ),
|
|
|
|
|
+ // border: InputBorder.none,
|
|
|
|
|
+ // counterStyle: TextStyle(fontSize: 0)),
|
|
|
|
|
+ // onChanged: (value) {
|
|
|
|
|
+ // editRoomInfo['houseAbstract'] = value;
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ),
|
|
|
|
|
+ // ),
|
|
|
Container(
|
|
Container(
|
|
|
height: 1,
|
|
height: 1,
|
|
|
color: BG_SUB_COLOR,
|
|
color: BG_SUB_COLOR,
|
|
|
),
|
|
),
|
|
|
//房间等级
|
|
//房间等级
|
|
|
- Container(
|
|
|
|
|
- height: 60,
|
|
|
|
|
- color: BG_COLOR,
|
|
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 15),
|
|
|
|
|
- child: GestureDetector(
|
|
|
|
|
- child: Row(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Text(
|
|
|
|
|
- '房间等级',
|
|
|
|
|
- style: titleStyle,
|
|
|
|
|
- ),
|
|
|
|
|
- Expanded(
|
|
|
|
|
- flex: 1,
|
|
|
|
|
- child: Row(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Image.network(
|
|
|
|
|
- chooseLevelInfo.containsKey('icon') ? chooseLevelInfo['icon'] : '',
|
|
|
|
|
- width: 22,
|
|
|
|
|
- ),
|
|
|
|
|
- Text(
|
|
|
|
|
- chooseLevelInfo.containsKey('levelName') ? chooseLevelInfo['levelName'] : '',
|
|
|
|
|
- style: TextStyle(color: Color(0xFFF9D881)),
|
|
|
|
|
- ),
|
|
|
|
|
- Padding(
|
|
|
|
|
- padding: EdgeInsets.only(left: 20, right: 2),
|
|
|
|
|
- child: Image.asset('images/icon_jinbi_da_bai.png', width: 20),
|
|
|
|
|
- ),
|
|
|
|
|
- Text(
|
|
|
|
|
- 'X' + (chooseLevelInfo.containsKey('entryCoin') ? chooseLevelInfo['entryCoin'].toString() : ''),
|
|
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Padding(padding: EdgeInsets.only(left: 4), child: Image.asset('images/icon_inter.png', width: 24))
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- showLevelPicker(context);
|
|
|
|
|
- },
|
|
|
|
|
- )),
|
|
|
|
|
|
|
+ ChooseContent(
|
|
|
|
|
+ title: '房间等级',
|
|
|
|
|
+ chooseLevelInfo: chooseLevelInfo,
|
|
|
|
|
+ isLevel: true,
|
|
|
|
|
+ onTapHomeMenu: () {
|
|
|
|
|
+ showLevelPicker(context);
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
Container(
|
|
Container(
|
|
|
height: 1,
|
|
height: 1,
|
|
|
color: BG_SUB_COLOR,
|
|
color: BG_SUB_COLOR,
|
|
|
),
|
|
),
|
|
|
//房间人数
|
|
//房间人数
|
|
|
- Container(
|
|
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 15),
|
|
|
|
|
- color: BG_COLOR,
|
|
|
|
|
- height: 60,
|
|
|
|
|
- child: GestureDetector(
|
|
|
|
|
- child: Row(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Text('房间人数', style: titleStyle),
|
|
|
|
|
- Expanded(
|
|
|
|
|
- flex: 1,
|
|
|
|
|
- child: Text(
|
|
|
|
|
- editRoomInfo['maxNumber'].toString(),
|
|
|
|
|
- textAlign: TextAlign.right,
|
|
|
|
|
- style: valStyle,
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Image.asset('images/icon_inter.png', width: 24)
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- showNumPicker(chooseLevelInfo);
|
|
|
|
|
- },
|
|
|
|
|
- )),
|
|
|
|
|
|
|
+ ChooseContent(
|
|
|
|
|
+ title: '房间人数',
|
|
|
|
|
+ val: editRoomInfo['maxNumber'].toString(),
|
|
|
|
|
+ onTapHomeMenu: () {
|
|
|
|
|
+ showNumPicker(context);
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
_bottomWidget(),
|
|
_bottomWidget(),
|
|
|
//创建房间
|
|
//创建房间
|
|
|
Container(
|
|
Container(
|
|
@@ -365,17 +351,24 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
Padding(
|
|
Padding(
|
|
|
padding: EdgeInsets.only(right: 6),
|
|
padding: EdgeInsets.only(right: 6),
|
|
|
- child: Image.asset('images/icon_jinbi_da_bai.png', width: 20),
|
|
|
|
|
|
|
+ child: Image.asset('images/icon_jinbi_da_bai.png',
|
|
|
|
|
+ width: 20),
|
|
|
),
|
|
),
|
|
|
Text(
|
|
Text(
|
|
|
- 'X' + (chooseLevelInfo.containsKey('entryCoin') ? chooseLevelInfo['entryCoin'].toString() : ''),
|
|
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
|
|
|
|
+ 'X' + (chooseLevelInfo.entryCoin ?? 0).toString(),
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontSize: 16,
|
|
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
),
|
|
),
|
|
|
Padding(
|
|
Padding(
|
|
|
padding: EdgeInsets.only(left: 20),
|
|
padding: EdgeInsets.only(left: 20),
|
|
|
child: Text(
|
|
child: Text(
|
|
|
'创建房间',
|
|
'创建房间',
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontSize: 16,
|
|
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
@@ -464,26 +457,29 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
showPicker(BuildContext context) {
|
|
showPicker(BuildContext context) {
|
|
|
- List _list = [];
|
|
|
|
|
|
|
+ List<String> _list = [];
|
|
|
for (var item in gameList) {
|
|
for (var item in gameList) {
|
|
|
- _list.add(item['gameName']);
|
|
|
|
|
|
|
+ _list.add(item.gameName);
|
|
|
}
|
|
}
|
|
|
String PickerData = json.encode(_list);
|
|
String PickerData = json.encode(_list);
|
|
|
new Picker(
|
|
new Picker(
|
|
|
confirmText: '确定',
|
|
confirmText: '确定',
|
|
|
cancelText: "取消",
|
|
cancelText: "取消",
|
|
|
- adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
|
|
|
|
+ adapter: PickerDataAdapter<String>(
|
|
|
|
|
+ pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
changeToFirst: true,
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
|
onConfirm: (Picker picker, List value) {
|
|
onConfirm: (Picker picker, List value) {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
- editRoomInfo['gameId'] = gameList[value[0]]['id'];
|
|
|
|
|
|
|
+ editRoomInfo['gameId'] = gameList[value[0]].id;
|
|
|
|
|
+ editRoomInfo['houseName']=StoreProvider.of<AppState>(context).state.userInfo.nickname +'的'+gameList[value[0]].shortName+'房间';
|
|
|
|
|
+ editRoomInfo['houseAbstract']=gameList[value[0]].profile??'';
|
|
|
});
|
|
});
|
|
|
}).showModal(this.context);
|
|
}).showModal(this.context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- showNumPicker(Map info) {
|
|
|
|
|
|
|
+ showNumPicker(BuildContext context) {
|
|
|
List _list = [];
|
|
List _list = [];
|
|
|
for (var i = 10; i <= 100; i = i + 10) {
|
|
for (var i = 10; i <= 100; i = i + 10) {
|
|
|
_list.add(i);
|
|
_list.add(i);
|
|
@@ -493,7 +489,8 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
new Picker(
|
|
new Picker(
|
|
|
confirmText: '确定',
|
|
confirmText: '确定',
|
|
|
cancelText: "取消",
|
|
cancelText: "取消",
|
|
|
- adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
|
|
|
|
+ adapter: PickerDataAdapter<String>(
|
|
|
|
|
+ pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
changeToFirst: true,
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
@@ -505,22 +502,151 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
showLevelPicker(BuildContext context) {
|
|
showLevelPicker(BuildContext context) {
|
|
|
- List _list = [];
|
|
|
|
|
|
|
+ List<String> _list = [];
|
|
|
for (var item in levelList) {
|
|
for (var item in levelList) {
|
|
|
- _list.add(item['levelName']);
|
|
|
|
|
|
|
+ _list.add(item.levelName);
|
|
|
}
|
|
}
|
|
|
String PickerData = json.encode(_list);
|
|
String PickerData = json.encode(_list);
|
|
|
new Picker(
|
|
new Picker(
|
|
|
confirmText: '确定',
|
|
confirmText: '确定',
|
|
|
cancelText: "取消",
|
|
cancelText: "取消",
|
|
|
- adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
|
|
|
|
+ adapter: PickerDataAdapter<String>(
|
|
|
|
|
+ pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
changeToFirst: true,
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
|
onConfirm: (Picker picker, List value) {
|
|
onConfirm: (Picker picker, List value) {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
- editRoomInfo['houseLevel'] = levelList[value[0]]['id'];
|
|
|
|
|
|
|
+ editRoomInfo['houseLevel'] = levelList[value[0]].id;
|
|
|
});
|
|
});
|
|
|
}).showModal(this.context);
|
|
}).showModal(this.context);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+typedef int OnTapHomeMenu();
|
|
|
|
|
+typedef ValueChanged<T> = void Function(T value);
|
|
|
|
|
+
|
|
|
|
|
+class ChooseContent extends StatelessWidget {
|
|
|
|
|
+ ChooseContent(
|
|
|
|
|
+ {Key key,
|
|
|
|
|
+ this.title,
|
|
|
|
|
+ this.val,
|
|
|
|
|
+ this.chooseLevelInfo,
|
|
|
|
|
+ this.isLevel = false,
|
|
|
|
|
+ this.onTapHomeMenu})
|
|
|
|
|
+ : super(key: key);
|
|
|
|
|
+ final String title;
|
|
|
|
|
+ final String val;
|
|
|
|
|
+ final OnTapHomeMenu onTapHomeMenu;
|
|
|
|
|
+ final HouseLevel chooseLevelInfo;
|
|
|
|
|
+ final bool isLevel;
|
|
|
|
|
+ @override
|
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
|
+ return Container(
|
|
|
|
|
+ child: InkWell(
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ height: 60,
|
|
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 15),
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Text(title, style: TextStyle(fontSize: 14, color: Colors.white)),
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ flex: 1,
|
|
|
|
|
+ child: isLevel
|
|
|
|
|
+ ? Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ chooseLevelInfo.icon != null
|
|
|
|
|
+ ? Image.network(
|
|
|
|
|
+ chooseLevelInfo.icon,
|
|
|
|
|
+ width: 22,
|
|
|
|
|
+ )
|
|
|
|
|
+ : Container(),
|
|
|
|
|
+ Text(
|
|
|
|
|
+ chooseLevelInfo.levelName ?? '',
|
|
|
|
|
+ style: TextStyle(color: Color(0xFFF9D881)),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Padding(
|
|
|
|
|
+ padding: EdgeInsets.only(left: 20, right: 2),
|
|
|
|
|
+ child: Image.asset('images/icon_jinbi_da_bai.png',
|
|
|
|
|
+ width: 20),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Text(
|
|
|
|
|
+ 'X' + (chooseLevelInfo.entryCoin ?? 0).toString(),
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontSize: 15,
|
|
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ )
|
|
|
|
|
+ : Text(val ?? '',
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ fontSize: 15,
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
|
|
+ textAlign: TextAlign.right),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Image.asset('images/icon_inter.png', width: 24)
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ onTap: onTapHomeMenu,
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+class InputContent extends StatefulWidget {
|
|
|
|
|
+ InputContent({Key key, this.title, this.value, this.onTextChange})
|
|
|
|
|
+ : super(key: key);
|
|
|
|
|
+ final String title;
|
|
|
|
|
+ final String value;
|
|
|
|
|
+ final ValueChanged onTextChange;
|
|
|
|
|
+ @override
|
|
|
|
|
+ InputContentState createState() => InputContentState();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+class InputContentState extends State<InputContent> {
|
|
|
|
|
+ TextEditingController _controller;
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ void initState() {
|
|
|
|
|
+ super.initState();
|
|
|
|
|
+ _controller = new TextEditingController();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ void didUpdateWidget(InputContent oldWidget) {
|
|
|
|
|
+ // TODO: implement didUpdateWidget
|
|
|
|
|
+ super.didUpdateWidget(oldWidget);
|
|
|
|
|
+ _controller.text = widget.value ?? '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
|
+ return Container(
|
|
|
|
|
+ height: 60,
|
|
|
|
|
+ color: BG_COLOR,
|
|
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
|
|
|
|
+ child: TextField(
|
|
|
|
|
+ controller: _controller,
|
|
|
|
|
+ textAlign: TextAlign.end,
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ fontSize: 15, color: Colors.white, fontWeight: FontWeight.w500),
|
|
|
|
|
+ maxLength: 10,
|
|
|
|
|
+ decoration: InputDecoration(
|
|
|
|
|
+ hintText: "请输入" + widget.title,
|
|
|
|
|
+ hintStyle: TextStyle(color: Color(0xFF727785), fontSize: 13),
|
|
|
|
|
+ prefixIcon: Padding(
|
|
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 12),
|
|
|
|
|
+ child: Text(widget.title,
|
|
|
|
|
+ style: TextStyle(fontSize: 14, color: Colors.white)),
|
|
|
|
|
+ ),
|
|
|
|
|
+ border: InputBorder.none,
|
|
|
|
|
+ counterStyle: TextStyle(fontSize: 0)),
|
|
|
|
|
+ onChanged: widget.onTextChange,
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+}
|