|
|
@@ -1,5 +1,6 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
|
+import 'package:cached_network_image/cached_network_image.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:file_picker/file_picker.dart';
|
|
|
import '../styles/colors.dart';
|
|
|
@@ -29,15 +30,9 @@ class OpenRoom extends StatefulWidget {
|
|
|
|
|
|
class OpenRoomState extends State<OpenRoom> {
|
|
|
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': 5,
|
|
|
- 'scoreType': 0
|
|
|
- };
|
|
|
+ Map<String, dynamic> editRoomInfo = {'gameId': 1, 'houseLevel': 1, 'maxNumber': 5, 'scoreType': 0};
|
|
|
List<GameInfo> gameList = [];
|
|
|
List<HouseLevel> levelList = [];
|
|
|
|
|
|
@@ -85,15 +80,11 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
// Toast.show(context, '请选择房间等级', 1500, 'info');
|
|
|
// return;
|
|
|
// }
|
|
|
- if (editRoomInfo['houseType'] == '1' &&
|
|
|
- (editRoomInfo['gameHouseId'] == null ||
|
|
|
- editRoomInfo['gameHouseId'] == '')) {
|
|
|
+ if (editRoomInfo['houseType'] == '1' && (editRoomInfo['gameHouseId'] == null || editRoomInfo['gameHouseId'] == '')) {
|
|
|
Toast.show(context, '请录入游戏房间号', 1500, 'info');
|
|
|
return;
|
|
|
}
|
|
|
- if (editRoomInfo['houseType'] == '1' &&
|
|
|
- (editRoomInfo['gameHousePassword'] == null ||
|
|
|
- editRoomInfo['gameHousePassword'] == '')) {
|
|
|
+ if (editRoomInfo['houseType'] == '1' && (editRoomInfo['gameHousePassword'] == null || editRoomInfo['gameHousePassword'] == '')) {
|
|
|
Toast.show(context, '请录入游戏房间密码', 1500, 'info');
|
|
|
return;
|
|
|
}
|
|
|
@@ -104,8 +95,7 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
chooseLevelInfo = item;
|
|
|
}
|
|
|
}
|
|
|
- if (StoreProvider.of<AppState>(context).state.userInfo.moneyCoin <
|
|
|
- chooseLevelInfo.entryCoin) {
|
|
|
+ if (StoreProvider.of<AppState>(context).state.userInfo.moneyCoin < chooseLevelInfo.entryCoin) {
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -133,10 +123,8 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
);
|
|
|
return;
|
|
|
}
|
|
|
- editRoomInfo['createUser'] =
|
|
|
- StoreProvider.of<AppState>(context).state.userInfo.id;
|
|
|
- editRoomInfo['userId'] =
|
|
|
- StoreProvider.of<AppState>(context).state.userInfo.id;
|
|
|
+ editRoomInfo['createUser'] = StoreProvider.of<AppState>(context).state.userInfo.id;
|
|
|
+ editRoomInfo['userId'] = StoreProvider.of<AppState>(context).state.userInfo.id;
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
Result res = await HttpManager.post('houseInfo/save', data: editRoomInfo);
|
|
|
Toast.hide();
|
|
|
@@ -147,10 +135,7 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
// });
|
|
|
Toast.show(context, '创建成功', 1500, 'success');
|
|
|
Future.delayed(Duration(milliseconds: 1500), () {
|
|
|
- Navigator.pushReplacement(
|
|
|
- context,
|
|
|
- CupertinoPageRoute(
|
|
|
- builder: (context) => RoomInfo(roomId: res.data.toString())));
|
|
|
+ Navigator.pushReplacement(context, CupertinoPageRoute(builder: (context) => RoomInfo(roomId: res.data.toString())));
|
|
|
});
|
|
|
} else {
|
|
|
Toast.show(context, res.error, 1500, 'info');
|
|
|
@@ -169,11 +154,8 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
gameList = _list;
|
|
|
if (res.data.length > 0) {
|
|
|
editRoomInfo['gameId'] = res.data[0]['id'];
|
|
|
- editRoomInfo['houseName'] =
|
|
|
- StoreProvider.of<AppState>(context).state.userInfo.nickname +
|
|
|
- '的' +
|
|
|
- res.data[0]['shortName'] +
|
|
|
- '房间';
|
|
|
+ String name = StoreProvider.of<AppState>(context).state.userInfo.nickname;
|
|
|
+ editRoomInfo['houseName'] = (name.length > 5 ? name.substring(0, 5) : name) + '的' + res.data[0]['shortName'] + '房间';
|
|
|
editRoomInfo['houseAbstract'] = res.data[0]['profile'] ?? '';
|
|
|
}
|
|
|
});
|
|
|
@@ -223,238 +205,223 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
|
|
|
return WillPopScope(
|
|
|
child: Scaffold(
|
|
|
- appBar: AppBar(
|
|
|
- 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>[
|
|
|
- ChooseContent(
|
|
|
- title: '选择游戏',
|
|
|
- val: chooseGameInfo.gameName,
|
|
|
- onTapHomeMenu: () {
|
|
|
- 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)
|
|
|
- ],
|
|
|
- ),
|
|
|
+ appBar: AppBar(
|
|
|
+ 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: Color(0xFF2E3049),
|
|
|
+ width: double.infinity,
|
|
|
+ height: double.infinity,
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ child: Container(
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ color: Color(0xFF1D1E2E),
|
|
|
+ height: 210,
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+ width: 160,
|
|
|
+ height: 38,
|
|
|
+ child: LinearButton(
|
|
|
+ radius:38.0,
|
|
|
+ colorList: [Color(0xFF3A3E61),Color(0xFF3A3E61)],
|
|
|
+ childWidget: 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: () {
|
|
|
+ onTapHomeMenu: () {
|
|
|
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;
|
|
|
- // },
|
|
|
- // ),
|
|
|
- // ),
|
|
|
- InputContent(
|
|
|
- title: '房间标题',
|
|
|
- value: editRoomInfo['houseName'],
|
|
|
- onTextChange: (value) {
|
|
|
- editRoomInfo['houseName'] = value;
|
|
|
- }),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
- height: 1,
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- ),
|
|
|
- //房间简介
|
|
|
- InputContent(
|
|
|
- title: '房间简介',
|
|
|
- value: editRoomInfo['houseAbstract'],
|
|
|
- onTextChange: (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(
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
- height: 1,
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- ),
|
|
|
- //房间等级
|
|
|
- // ChooseContent(
|
|
|
- // title: '房间等级',
|
|
|
- // chooseLevelInfo: chooseLevelInfo,
|
|
|
- // isLevel: true,
|
|
|
- // onTapHomeMenu: () {
|
|
|
- // showLevelPicker(context);
|
|
|
- // },
|
|
|
- // ),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
- height: 1,
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- ),
|
|
|
- //房间人数
|
|
|
- ChooseContent(
|
|
|
- title: '房卡人数',
|
|
|
- val: editRoomInfo['maxNumber'].toString() + '人次房卡',
|
|
|
- icon: Image.asset('images/icon_yiwen.png'),
|
|
|
- onTapHomeMenu: () {
|
|
|
- showNumPicker(context);
|
|
|
- },
|
|
|
- ),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
- height: 1,
|
|
|
- color: BG_SUB_COLOR,
|
|
|
- ),
|
|
|
- //房间人数
|
|
|
- ChooseContent(
|
|
|
- title: '胜利条件',
|
|
|
- val: editRoomInfo['scoreType'] == 0 ? '评分' : '吃鸡',
|
|
|
- onTapHomeMenu: () {
|
|
|
- showScoreType(context);
|
|
|
- },
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(top: 12),
|
|
|
+ child: Text(
|
|
|
+ editRoomInfo.containsKey('video') ? '已选择' : '不上传则自动使用官方默认视频',
|
|
|
+ style: TextStyle(color: Color(0xFF9BA0AE), fontSize: 13),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
),
|
|
|
- _bottomWidget(),
|
|
|
-
|
|
|
- ],
|
|
|
- ),
|
|
|
+ ),
|
|
|
+ //房间标题
|
|
|
+ // 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;
|
|
|
+ // },
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
+ ChooseContent(
|
|
|
+ title: '选择游戏',
|
|
|
+ val: chooseGameInfo.gameName,
|
|
|
+ onTapHomeMenu: () {
|
|
|
+ showPicker(context);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
+ height: 1,
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
+ ),
|
|
|
+ InputContent(
|
|
|
+ title: '房间标题',
|
|
|
+ value: editRoomInfo['houseName'],
|
|
|
+ onTextChange: (value) {
|
|
|
+ editRoomInfo['houseName'] = value;
|
|
|
+ }),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
+ height: 1,
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
+ ),
|
|
|
+ // //房间简介
|
|
|
+ // InputContent(
|
|
|
+ // title: '房间简介',
|
|
|
+ // value: editRoomInfo['houseAbstract'],
|
|
|
+ // onTextChange: (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;
|
|
|
+ // },
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
+
|
|
|
+ //房间等级
|
|
|
+ // ChooseContent(
|
|
|
+ // title: '房间等级',
|
|
|
+ // chooseLevelInfo: chooseLevelInfo,
|
|
|
+ // isLevel: true,
|
|
|
+ // onTapHomeMenu: () {
|
|
|
+ // showLevelPicker(context);
|
|
|
+ // },
|
|
|
+ // ),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
+ height: 1,
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
+ ),
|
|
|
+ //房间人数
|
|
|
+ ChooseContent(
|
|
|
+ title: '房卡人数',
|
|
|
+ val: editRoomInfo['maxNumber'].toString() + '人次房卡',
|
|
|
+ icon: Image.asset('images/icon_yiwen.png'),
|
|
|
+ onTapHomeMenu: () {
|
|
|
+ showNumPicker(context);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
+ height: 1,
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
+ ),
|
|
|
+ //房间人数
|
|
|
+ ChooseContent(
|
|
|
+ title: '胜利条件',
|
|
|
+ val: editRoomInfo['scoreType'] == 0 ? '评分' : '吃鸡',
|
|
|
+ onTapHomeMenu: () {
|
|
|
+ showScoreType(context);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ _bottomWidget(),
|
|
|
+ ],
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- floatingActionButton: Padding(
|
|
|
- padding: EdgeInsets.fromLTRB(15, 39, 15, 10),
|
|
|
- child: LinearButton(
|
|
|
- onTapHomeMenu: () {
|
|
|
- saveInfo();
|
|
|
- },
|
|
|
- childWidget: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: <Widget>[
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.only(right: 6),
|
|
|
- child: Image.asset('images/icon_renci.png'),
|
|
|
- ),
|
|
|
- Text(
|
|
|
- '×${editRoomInfo["maxNumber"]}' ,
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
- ),
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.only(left: 20),
|
|
|
- child: Text(
|
|
|
- '创建房间',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,),
|
|
|
+ ),
|
|
|
+ floatingActionButton: Padding(
|
|
|
+ padding: EdgeInsets.fromLTRB(15, 39, 15, 10),
|
|
|
+ child: LinearButton(
|
|
|
+ onTapHomeMenu: () {
|
|
|
+ saveInfo();
|
|
|
+ },
|
|
|
+ childWidget: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(right: 6),
|
|
|
+ child: Image.asset('images/icon_renci.png'),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ '×${editRoomInfo["maxNumber"]}',
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(left: 20),
|
|
|
+ child: Text(
|
|
|
+ '创建房间',
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
+ ),
|
|
|
onWillPop: () {
|
|
|
Toast.hide();
|
|
|
Navigator.pop(context);
|
|
|
@@ -537,19 +504,14 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
Picker(
|
|
|
confirmText: '确定',
|
|
|
cancelText: '取消',
|
|
|
- adapter: PickerDataAdapter<String>(
|
|
|
- pickerdata: JsonDecoder().convert(PickerData)),
|
|
|
+ adapter: PickerDataAdapter<String>(pickerdata: JsonDecoder().convert(PickerData)),
|
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
|
onConfirm: (Picker picker, List value) {
|
|
|
setState(() {
|
|
|
editRoomInfo['gameId'] = gameList[value[0]].id;
|
|
|
- editRoomInfo['houseName'] =
|
|
|
- StoreProvider.of<AppState>(context).state.userInfo.nickname +
|
|
|
- '的' +
|
|
|
- gameList[value[0]].shortName +
|
|
|
- '房间';
|
|
|
+ editRoomInfo['houseName'] = StoreProvider.of<AppState>(context).state.userInfo.nickname + '的' + gameList[value[0]].shortName + '房间';
|
|
|
editRoomInfo['houseAbstract'] = gameList[value[0]].profile ?? '';
|
|
|
});
|
|
|
}).showModal(this.context);
|
|
|
@@ -558,7 +520,7 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
void showNumPicker(BuildContext context) {
|
|
|
List _list = [];
|
|
|
List _listName = [];
|
|
|
- List _member=[5,10,15,20,25,50,100];
|
|
|
+ List _member = [5, 10, 15, 20, 25, 50, 100];
|
|
|
for (var item in _member) {
|
|
|
_list.add(item);
|
|
|
_listName.add(item.toString() + '人次房卡');
|
|
|
@@ -568,8 +530,7 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
Picker(
|
|
|
confirmText: '确定',
|
|
|
cancelText: '取消',
|
|
|
- adapter: PickerDataAdapter<String>(
|
|
|
- pickerdata: JsonDecoder().convert(pickerData)),
|
|
|
+ adapter: PickerDataAdapter<String>(pickerdata: JsonDecoder().convert(pickerData)),
|
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
|
@@ -586,8 +547,7 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
Picker(
|
|
|
confirmText: '确定',
|
|
|
cancelText: '取消',
|
|
|
- adapter: PickerDataAdapter<String>(
|
|
|
- pickerdata: JsonDecoder().convert(PickerData)),
|
|
|
+ adapter: PickerDataAdapter<String>(pickerdata: JsonDecoder().convert(PickerData)),
|
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
|
@@ -607,8 +567,7 @@ class OpenRoomState extends State<OpenRoom> {
|
|
|
Picker(
|
|
|
confirmText: '确定',
|
|
|
cancelText: '取消',
|
|
|
- adapter: PickerDataAdapter<String>(
|
|
|
- pickerdata: JsonDecoder().convert(PickerData)),
|
|
|
+ adapter: PickerDataAdapter<String>(pickerdata: JsonDecoder().convert(PickerData)),
|
|
|
changeToFirst: true,
|
|
|
textAlign: TextAlign.left,
|
|
|
columnPadding: const EdgeInsets.all(8.0),
|
|
|
@@ -624,15 +583,7 @@ typedef void 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.icon,
|
|
|
- this.onTapHomeMenu})
|
|
|
- : super(key: key);
|
|
|
+ ChooseContent({Key key, this.title, this.val, this.chooseLevelInfo, this.isLevel = false, this.icon, this.onTapHomeMenu}) : super(key: key);
|
|
|
final String title;
|
|
|
final String val;
|
|
|
final OnTapHomeMenu onTapHomeMenu;
|
|
|
@@ -655,32 +606,23 @@ class ChooseContent extends StatelessWidget {
|
|
|
? InkWell(
|
|
|
onTap: () {
|
|
|
//弹出
|
|
|
- RenderBox renderBox =
|
|
|
- anchorKey.currentContext.findRenderObject();
|
|
|
+ RenderBox renderBox = anchorKey.currentContext.findRenderObject();
|
|
|
var offset = renderBox.localToGlobal(Offset.zero);
|
|
|
print(offset.dx.toString() + ',' + offset.dy.toString());
|
|
|
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),
|
|
|
+ opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
|
|
|
child: child,
|
|
|
);
|
|
|
},
|
|
|
pageBuilder: (BuildContext context, _, __) {
|
|
|
- return FloatTextContent(
|
|
|
- dx: offset.dx, dy: offset.dy);
|
|
|
+ return FloatTextContent(dx: offset.dx, dy: offset.dy);
|
|
|
}));
|
|
|
},
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.all(9),
|
|
|
- child: icon,
|
|
|
- key: anchorKey))
|
|
|
+ child: Padding(padding: EdgeInsets.all(9), child: icon, key: anchorKey))
|
|
|
: Container(),
|
|
|
Expanded(
|
|
|
flex: 1,
|
|
|
@@ -700,24 +642,15 @@ class ChooseContent extends StatelessWidget {
|
|
|
),
|
|
|
Padding(
|
|
|
padding: EdgeInsets.only(left: 20, right: 2),
|
|
|
- child: Image.asset('images/icon_jinbi_da_bai.png',
|
|
|
- width: 20),
|
|
|
+ child: Image.asset('images/icon_jinbi_da_bai.png', width: 20),
|
|
|
),
|
|
|
Text(
|
|
|
'×' + (chooseLevelInfo.entryCoin ?? 0).toString(),
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 15,
|
|
|
- fontWeight: FontWeight.w500),
|
|
|
+ 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),
|
|
|
+ : Text(val ?? '', style: TextStyle(fontSize: 15, color: Colors.white, fontWeight: FontWeight.w500), textAlign: TextAlign.right),
|
|
|
),
|
|
|
Image.asset('images/icon_inter.png', width: 24)
|
|
|
],
|
|
|
@@ -729,8 +662,7 @@ class ChooseContent extends StatelessWidget {
|
|
|
}
|
|
|
|
|
|
class InputContent extends StatefulWidget {
|
|
|
- InputContent({Key key, this.title, this.value, this.onTextChange})
|
|
|
- : super(key: key);
|
|
|
+ InputContent({Key key, this.title, this.value, this.onTextChange}) : super(key: key);
|
|
|
final String title;
|
|
|
final String value;
|
|
|
final ValueChanged onTextChange;
|
|
|
@@ -757,21 +689,18 @@ class InputContentState extends State<InputContent> {
|
|
|
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),
|
|
|
+ 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)),
|
|
|
+ child: Text(widget.title, style: TextStyle(fontSize: 14, color: Colors.white)),
|
|
|
),
|
|
|
border: InputBorder.none,
|
|
|
counterStyle: TextStyle(fontSize: 0)),
|
|
|
@@ -802,13 +731,8 @@ class FloatTextContent extends StatelessWidget {
|
|
|
padding: EdgeInsets.all(10),
|
|
|
constraints: BoxConstraints(maxWidth: 241),
|
|
|
color: Color(0xFF3A3E61),
|
|
|
- child: Text(
|
|
|
- '房主可以选择不同人次的房卡进行开始比赛,同步消耗自己相应的参赛名额,比如选择50人次房卡,系统从我的账号上扣除50人次参赛名额,房间内最多可进入50人参加比赛',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 12,
|
|
|
- fontWeight: FontWeight.w400,
|
|
|
- decoration: TextDecoration.none)),
|
|
|
+ child: Text('房主可以选择不同人次的房卡进行开始比赛,同步消耗自己相应的参赛名额,比如选择50人次房卡,系统从我的账号上扣除50人次参赛名额,房间内最多可进入50人参加比赛',
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w400, decoration: TextDecoration.none)),
|
|
|
),
|
|
|
)
|
|
|
],
|