|
|
@@ -1,15 +1,18 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
|
+import 'package:flutter/cupertino.dart';
|
|
|
import 'package:file_picker/file_picker.dart';
|
|
|
import '../styles/colors.dart';
|
|
|
import '../styles/netUtil.dart';
|
|
|
-import '../styles/totast.dart';
|
|
|
import 'dart:io';
|
|
|
import 'dart:async';
|
|
|
import 'dart:convert';
|
|
|
import 'dart:ui';
|
|
|
-import '../styles/api.dart';
|
|
|
import 'package:dio/dio.dart';
|
|
|
+import '../styles/totast.dart';
|
|
|
+import '../pages/roomInfo.dart';
|
|
|
+import 'package:flutter_redux/flutter_redux.dart';
|
|
|
+import '../state.dart';
|
|
|
|
|
|
class OpenRoom extends StatefulWidget {
|
|
|
OpenRoom({Key key, this.roomFlag}) : super(key: key);
|
|
|
@@ -23,28 +26,75 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
TextStyle valStyle =
|
|
|
TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500);
|
|
|
|
|
|
- Map editRoomInfo = {
|
|
|
+ Map<String, dynamic> editRoomInfo = {
|
|
|
"gameId": 1,
|
|
|
+ "houseLevel": 1,
|
|
|
+ "playerNumber": 0
|
|
|
};
|
|
|
List gameList = [];
|
|
|
+ List levelList = [];
|
|
|
|
|
|
void getFilePath() async {
|
|
|
String filePath = await FilePicker.getFilePath(type: FileType.ANY);
|
|
|
File _file = File(filePath);
|
|
|
|
|
|
- // final response =
|
|
|
- // await Dio().post(domain + 'assets/uploadFile', data: _formData);
|
|
|
- // print(response);
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
NetUtil.post(
|
|
|
"assets/uploadFile",
|
|
|
(data) {
|
|
|
- print(data);
|
|
|
- if (data['success']) {}
|
|
|
+ Toast.hide();
|
|
|
+ if (data['success']) {
|
|
|
+ setState(() {
|
|
|
+ editRoomInfo['video'] = data['data'];
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
params: {
|
|
|
"file": UploadFileInfo(_file, filePath),
|
|
|
},
|
|
|
errorCallBack: (errorMsg) {
|
|
|
+ Toast.hide();
|
|
|
+ print("error:" + errorMsg);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ void saveInfo() async {
|
|
|
+ if (!editRoomInfo.containsKey('gameId')) {
|
|
|
+ Toast.show(context, '请选择游戏', 1500, 'info');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (editRoomInfo['houseName'] == null || editRoomInfo['houseName'] == '') {
|
|
|
+ Toast.show(context, '请输入房间标题', 1500, 'info');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!editRoomInfo.containsKey('houseLevel')) {
|
|
|
+ Toast.show(context, '请选择房间等级', 1500, 'info');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ print(editRoomInfo);
|
|
|
+ return;
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
+ NetUtil.post(
|
|
|
+ "houseInfo/save",
|
|
|
+ (data) {
|
|
|
+ Toast.hide();
|
|
|
+ if (data['success']) {
|
|
|
+ Future.delayed(Duration(milliseconds: 100), () {
|
|
|
+ Toast.show(context, '创建成功', 1500, 'success');
|
|
|
+ });
|
|
|
+ Future.delayed(Duration(milliseconds: 1500), () {
|
|
|
+ Navigator.pushAndRemoveUntil(
|
|
|
+ context,
|
|
|
+ new CupertinoPageRoute(
|
|
|
+ builder: (context) =>
|
|
|
+ new RoomInfo(roomId: data['data'].toString())),
|
|
|
+ ModalRoute.withName('/'));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ params: editRoomInfo,
|
|
|
+ errorCallBack: (errorMsg) {
|
|
|
+ Toast.hide();
|
|
|
print("error:" + errorMsg);
|
|
|
});
|
|
|
}
|
|
|
@@ -55,7 +105,6 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
super.initState();
|
|
|
//获取游戏列表
|
|
|
NetUtil.get("gameInfo/all", (data) {
|
|
|
- print(data);
|
|
|
if (data['success']) {
|
|
|
setState(() {
|
|
|
gameList = data['data'];
|
|
|
@@ -68,6 +117,29 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
}, errorCallBack: (errorMsg) {
|
|
|
print("error:" + errorMsg);
|
|
|
});
|
|
|
+
|
|
|
+ NetUtil.get("houseLevel/all", (data) {
|
|
|
+ if (data['success']) {
|
|
|
+ levelList = data['data'];
|
|
|
+ setState(() {
|
|
|
+ if (levelList.length > 0) {
|
|
|
+ editRoomInfo['houseLevel'] = data['data'][0]['id'];
|
|
|
+ editRoomInfo['playerNumber'] = data['data'][0]['minNumber'];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, errorCallBack: (errorMsg) {
|
|
|
+ print("error:" + errorMsg);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void didChangeDependencies() {
|
|
|
+ // TODO: implement didChangeDependencies
|
|
|
+ super.didChangeDependencies();
|
|
|
+ editRoomInfo['userId'] =
|
|
|
+ StoreProvider.of<CountState>(context).state.userInfo['id'];
|
|
|
+ editRoomInfo['houseType'] = widget.roomFlag;
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
@@ -79,112 +151,385 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
chooseGameInfo = item;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ Map chooseLevelInfo = {};
|
|
|
+ for (var item in levelList) {
|
|
|
+ if (item['id'].toString() == editRoomInfo['houseLevel'].toString()) {
|
|
|
+ chooseLevelInfo = item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// TODO: implement build
|
|
|
- return new Scaffold(
|
|
|
- appBar: AppBar(
|
|
|
- backgroundColor: PRIMARY_COLOR,
|
|
|
- title: Text('创建' + (widget.roomFlag == '0' ? '普通' : '官方') + '房间'),
|
|
|
- centerTitle: true,
|
|
|
- elevation: 0,
|
|
|
- actions: <Widget>[
|
|
|
- Container(
|
|
|
- width: 60,
|
|
|
- child: FlatButton(
|
|
|
- highlightColor: PRIMARY_COLOR,
|
|
|
- padding: EdgeInsets.only(right: 0),
|
|
|
- child: Text('规则',
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 13)),
|
|
|
- onPressed: () {},
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- body: Container(
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- width: double.infinity,
|
|
|
- height: double.infinity,
|
|
|
- child: SingleChildScrollView(
|
|
|
- child: Container(
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 15),
|
|
|
+ return WillPopScope(
|
|
|
+ child: Scaffold(
|
|
|
+ appBar: AppBar(
|
|
|
+ backgroundColor: PRIMARY_COLOR,
|
|
|
+ title: Text('创建' + (widget.roomFlag == '0' ? '普通' : '官方') + '房间'),
|
|
|
+ centerTitle: true,
|
|
|
+ elevation: 0,
|
|
|
+ actions: <Widget>[
|
|
|
+ Container(
|
|
|
+ width: 60,
|
|
|
+ child: FlatButton(
|
|
|
+ highlightColor: PRIMARY_COLOR,
|
|
|
+ padding: EdgeInsets.only(right: 0),
|
|
|
+ child: Text('规则',
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 13)),
|
|
|
+ onPressed: () {},
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ body: Container(
|
|
|
+ color: BG_COLOR,
|
|
|
+ width: double.infinity,
|
|
|
+ height: double.infinity,
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ child: Container(
|
|
|
+ color: BG_COLOR,
|
|
|
+ child: Column(
|
|
|
+ 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);
|
|
|
+ },
|
|
|
+ )),
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
+ height: 210,
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ FlatButton(
|
|
|
+ padding: EdgeInsets.all(0),
|
|
|
+ color: Color(0xFF464B6A),
|
|
|
+ highlightColor: Color(0xFF333557),
|
|
|
+ child: Container(
|
|
|
+ height: 38,
|
|
|
+ width: 160,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topRight,
|
|
|
+ colors: [Colors.black12, Colors.black38],
|
|
|
+ )),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(right: 8),
|
|
|
+ child: Image.asset(
|
|
|
+ 'images/icon_shipin.png',
|
|
|
+ width: 20,
|
|
|
+ )),
|
|
|
+ Text('上传图片或视频', style: titleStyle)
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ onPressed: () {
|
|
|
+ getFilePath();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(top: 12),
|
|
|
+ child: Text(
|
|
|
+ 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) {
|
|
|
+ editRoomInfo['houseName'] = value;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ height: 1,
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
+ ),
|
|
|
+ //房间简介
|
|
|
+ Container(
|
|
|
height: 60,
|
|
|
- child: GestureDetector(
|
|
|
+ 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(
|
|
|
+ height: 1,
|
|
|
+ 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);
|
|
|
+ },
|
|
|
+ )),
|
|
|
+ Container(
|
|
|
+ height: 1,
|
|
|
+ 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['playerNumber'].toString(),
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: valStyle,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Image.asset('images/icon_inter.png', width: 24)
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onTap: () {
|
|
|
+ print('111111');
|
|
|
+ showNumPicker(chooseLevelInfo);
|
|
|
+ },
|
|
|
+ )),
|
|
|
+ _bottomWidget(),
|
|
|
+ //创建房间
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.fromLTRB(15, 39, 15, 28),
|
|
|
+ height: 109,
|
|
|
+ color: BG_COLOR,
|
|
|
+ child: FlatButton(
|
|
|
+ color: PRIMARY_COLOR,
|
|
|
child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: <Widget>[
|
|
|
- Text('选择游戏', style: titleStyle),
|
|
|
- Expanded(
|
|
|
- flex: 1,
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(right: 6),
|
|
|
+ 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: 16,
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(left: 20),
|
|
|
child: Text(
|
|
|
- chooseGameInfo.containsKey('gameName')
|
|
|
- ? chooseGameInfo['gameName']
|
|
|
- : '',
|
|
|
- textAlign: TextAlign.right,
|
|
|
- style: valStyle,
|
|
|
+ '创建房间',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 16,
|
|
|
+ fontWeight: FontWeight.w500),
|
|
|
),
|
|
|
- ),
|
|
|
- Image.asset('images/icon_inter.png', width: 24)
|
|
|
+ )
|
|
|
],
|
|
|
),
|
|
|
- onTap: () {
|
|
|
- showPicker(context);
|
|
|
+ onPressed: () {
|
|
|
+ saveInfo();
|
|
|
},
|
|
|
- )),
|
|
|
- Container(
|
|
|
- width: double.infinity,
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- height: 210,
|
|
|
- child: Column(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: <Widget>[
|
|
|
- FlatButton(
|
|
|
- padding: EdgeInsets.all(0),
|
|
|
- color: Color(0xFF464B6A),
|
|
|
- highlightColor: Color(0xFF333557),
|
|
|
- child: Container(
|
|
|
- height: 38,
|
|
|
- width: 160,
|
|
|
- decoration: BoxDecoration(
|
|
|
- gradient: LinearGradient(
|
|
|
- begin: Alignment.topRight,
|
|
|
- colors: [Colors.black12, Colors.black38],
|
|
|
- )),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: <Widget>[
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.only(right: 8),
|
|
|
- child: Image.asset(
|
|
|
- 'images/icon_shipin.png',
|
|
|
- width: 20,
|
|
|
- )),
|
|
|
- Text('上传图片或视频', style: titleStyle)
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- onPressed: () {
|
|
|
- getFilePath();
|
|
|
- },
|
|
|
- ),
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.only(top: 12),
|
|
|
- child: Text(
|
|
|
- '不上传则自动使用官方默认视频',
|
|
|
- style: TextStyle(
|
|
|
- color: Color(0xFF9BA0AE), fontSize: 13),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
+ )),
|
|
|
+ onWillPop: () {
|
|
|
+ Toast.hide();
|
|
|
+ Navigator.pop(context);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _bottomWidget() {
|
|
|
+ if (widget.roomFlag == '1')
|
|
|
+ return Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+ height: 10,
|
|
|
+ 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) {
|
|
|
+ editRoomInfo['gameHouseId'] = value;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ height: 1,
|
|
|
+ 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: 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['gameHousePassword'] = value;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ else {
|
|
|
+ return Container();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
showPicker(BuildContext context) {
|
|
|
@@ -208,4 +553,52 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
});
|
|
|
}).showModal(this.context);
|
|
|
}
|
|
|
+
|
|
|
+ showNumPicker(Map info) {
|
|
|
+ List _list = [];
|
|
|
+ print(info['minNumber']);
|
|
|
+ print(info['maxNumber']);
|
|
|
+ for (var i = info['minNumber']; i <= info['maxNumber']; i = i + 5) {
|
|
|
+ _list.add(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ String PickerData = json.encode(_list);
|
|
|
+ new Picker(
|
|
|
+ confirmText: '确定',
|
|
|
+ cancelText: "取消",
|
|
|
+ adapter: PickerDataAdapter<String>(
|
|
|
+ pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
+ changeToFirst: true,
|
|
|
+ textAlign: TextAlign.left,
|
|
|
+ columnPadding: const EdgeInsets.all(8.0),
|
|
|
+ onConfirm: (Picker picker, List value) {
|
|
|
+ print(value);
|
|
|
+ setState(() {
|
|
|
+ editRoomInfo['playerNumber'] = _list[value[0]];
|
|
|
+ });
|
|
|
+ }).showModal(this.context);
|
|
|
+ }
|
|
|
+
|
|
|
+ showLevelPicker(BuildContext context) {
|
|
|
+ List _list = [];
|
|
|
+ for (var item in levelList) {
|
|
|
+ _list.add(item['levelName']);
|
|
|
+ }
|
|
|
+ print(json.encode(_list));
|
|
|
+ String PickerData = json.encode(_list);
|
|
|
+ new Picker(
|
|
|
+ confirmText: '确定',
|
|
|
+ cancelText: "取消",
|
|
|
+ adapter: PickerDataAdapter<String>(
|
|
|
+ pickerdata: new JsonDecoder().convert(PickerData)),
|
|
|
+ changeToFirst: true,
|
|
|
+ textAlign: TextAlign.left,
|
|
|
+ columnPadding: const EdgeInsets.all(8.0),
|
|
|
+ onConfirm: (Picker picker, List value) {
|
|
|
+ setState(() {
|
|
|
+ editRoomInfo['houseLevel'] = levelList[value[0]]['id'];
|
|
|
+ editRoomInfo['playerNumber'] = levelList[value[0]]['minNumber'];
|
|
|
+ });
|
|
|
+ }).showModal(this.context);
|
|
|
+ }
|
|
|
}
|