|
|
@@ -38,7 +38,7 @@ class _MatchPageState extends State<MatchPage> with WidgetsBindingObserver {
|
|
|
List<GameInfo> gameList = [];
|
|
|
String gameName = '全部游戏';
|
|
|
bool isFirst = true;
|
|
|
- FocusNode _focusNode=new FocusNode();
|
|
|
+ FocusNode _focusNode = new FocusNode();
|
|
|
|
|
|
void showPicker(BuildContext context) {
|
|
|
List<String> _list = [];
|
|
|
@@ -182,192 +182,221 @@ class _MatchPageState extends State<MatchPage> with WidgetsBindingObserver {
|
|
|
Widget build(BuildContext context) {
|
|
|
return WillPopScope(
|
|
|
child: GestureDetector(
|
|
|
- behavior: HitTestBehavior.translucent,
|
|
|
+ behavior: HitTestBehavior.translucent,
|
|
|
child: Scaffold(
|
|
|
- appBar: AppBar(
|
|
|
- title: Text('赛事'),
|
|
|
- centerTitle: true,
|
|
|
- leading: Material(
|
|
|
- color: Colors.transparent,
|
|
|
- child: Builder(
|
|
|
- builder: (context) => InkWell(
|
|
|
- onTap: () async {
|
|
|
- bool result = await Navigator.push(context, CupertinoPageRoute(builder: (context) => TipList()));
|
|
|
- if (result) {
|
|
|
- getUnreadMsg();
|
|
|
- }
|
|
|
- },
|
|
|
- child: Image.asset('images/home_icon_xiaoxi.png'),
|
|
|
- ),
|
|
|
+ appBar: AppBar(
|
|
|
+ title: Text('赛事'),
|
|
|
+ centerTitle: true,
|
|
|
+ leading: Material(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: Builder(
|
|
|
+ builder: (context) => InkWell(
|
|
|
+ onTap: () async {
|
|
|
+ bool result = await Navigator.push(context, CupertinoPageRoute(builder: (context) => TipList()));
|
|
|
+ if (result) {
|
|
|
+ getUnreadMsg();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: Image.asset('images/home_icon_xiaoxi.png'),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
+ actions: <Widget>[
|
|
|
+ Container(
|
|
|
+ width: 102,
|
|
|
+ padding: EdgeInsets.all(15),
|
|
|
+ child: LinearButton(
|
|
|
+ btntext: '发起比赛',
|
|
|
+ textColor: Color(0xFFA2423E),
|
|
|
+ btnHeight: 26.0,
|
|
|
+ colorList: [Color(0xFFFFE77C), Color(0xFFFFE77C)],
|
|
|
+ textSize: 12.0,
|
|
|
+ onTapHomeMenu: () => {Navigator.push(context, CupertinoPageRoute(builder: (context) => OpenRoom(roomFlag: '0')))},
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
),
|
|
|
- actions: <Widget>[
|
|
|
- Container(
|
|
|
- width: 102,
|
|
|
- padding: EdgeInsets.all(15),
|
|
|
- child: LinearButton(
|
|
|
- btntext: '发起比赛',
|
|
|
- textColor: Color(0xFFA2423E),
|
|
|
- btnHeight: 26.0,
|
|
|
- colorList: [Color(0xFFFFE77C), Color(0xFFFFE77C)],
|
|
|
- textSize: 12.0,
|
|
|
- onTapHomeMenu: () => {Navigator.push(context, CupertinoPageRoute(builder: (context) => OpenRoom(roomFlag: '0')))},
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- body: Container(
|
|
|
- color: Color(0xFF2E3049),
|
|
|
- height: double.infinity,
|
|
|
- width: double.infinity,
|
|
|
- child: RefreshIndicator(
|
|
|
- color: Theme.of(context).primaryColor,
|
|
|
- backgroundColor: Colors.white,
|
|
|
- displacement: 10,
|
|
|
- onRefresh: () async {
|
|
|
- await Future.delayed(const Duration(seconds: 1));
|
|
|
- gameId = 0;
|
|
|
- currentPage = 1;
|
|
|
- searchKey = '';
|
|
|
- getRoomInfo();
|
|
|
- // getBannerInfo();
|
|
|
- getGame();
|
|
|
- },
|
|
|
- child: CustomScrollView(
|
|
|
- physics: AlwaysScrollableScrollPhysics(),
|
|
|
- controller: _controller,
|
|
|
- slivers: <Widget>[
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: Container(
|
|
|
- width: double.infinity,
|
|
|
- height: 200,
|
|
|
- child: new Swiper(
|
|
|
- itemBuilder: (BuildContext context, int index) {
|
|
|
- return Image.network(
|
|
|
- bannerList[index].imageUrl,
|
|
|
- fit: BoxFit.fill,
|
|
|
- );
|
|
|
- },
|
|
|
- itemCount: bannerList.length,
|
|
|
- loop: false,
|
|
|
- autoplay: true,
|
|
|
- autoplayDelay: 5000,
|
|
|
- pagination: SwiperPagination()),
|
|
|
+ body: Container(
|
|
|
+ color: Color(0xFF2E3049),
|
|
|
+ height: double.infinity,
|
|
|
+ width: double.infinity,
|
|
|
+ child: RefreshIndicator(
|
|
|
+ color: Theme.of(context).primaryColor,
|
|
|
+ backgroundColor: Colors.white,
|
|
|
+ displacement: 10,
|
|
|
+ onRefresh: () async {
|
|
|
+ await Future.delayed(const Duration(seconds: 1));
|
|
|
+ gameId = 0;
|
|
|
+ currentPage = 1;
|
|
|
+ searchKey = '';
|
|
|
+ getRoomInfo();
|
|
|
+ // getBannerInfo();
|
|
|
+ getGame();
|
|
|
+ },
|
|
|
+ child: CustomScrollView(
|
|
|
+ physics: AlwaysScrollableScrollPhysics(),
|
|
|
+ controller: _controller,
|
|
|
+ slivers: <Widget>[
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: Container(
|
|
|
+ width: double.infinity,
|
|
|
+ height: 200,
|
|
|
+ child: new Swiper(
|
|
|
+ itemBuilder: (BuildContext context, int index) {
|
|
|
+ return Image.network(
|
|
|
+ bannerList[index].imageUrl,
|
|
|
+ fit: BoxFit.fill,
|
|
|
+ );
|
|
|
+ },
|
|
|
+ itemCount: bannerList.length,
|
|
|
+ loop: false,
|
|
|
+ autoplay: true,
|
|
|
+ autoplayDelay: 5000,
|
|
|
+ pagination: SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
|
|
|
+ Color activeColor = Color(0xFFD4504B);
|
|
|
+ Color color = Colors.white;
|
|
|
+ List<Widget> list = [];
|
|
|
+
|
|
|
+ int itemCount = config.itemCount;
|
|
|
+ int activeIndex = config.activeIndex;
|
|
|
+
|
|
|
+ for (int i = 0; i < itemCount; ++i) {
|
|
|
+ bool active = i == activeIndex;
|
|
|
+ list.add(
|
|
|
+ Container(
|
|
|
+ key: Key("pagination_$i"),
|
|
|
+ margin:EdgeInsets.symmetric(vertical: 3,horizontal: 2),
|
|
|
+ child: Container(
|
|
|
+ width: active ? 8 : 3,
|
|
|
+ height: 3,
|
|
|
+ decoration: BoxDecoration(color: active ? activeColor : color, borderRadius: BorderRadius.all(Radius.circular(3))),
|
|
|
+ )),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return Container(
|
|
|
+ margin: EdgeInsets.only(top: 186),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: list,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ })),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- SliverPersistentHeader(
|
|
|
- pinned: true, //是否固定在顶部
|
|
|
- floating: true,
|
|
|
- delegate: _SliverAppBarDelegate(
|
|
|
- minHeight: 60, //收起的高度
|
|
|
- maxHeight: 60, //展开的最大高度
|
|
|
- child: Container(
|
|
|
- color: Color(0xFF2E3049),
|
|
|
- height: 60,
|
|
|
- padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
|
|
+ SliverPersistentHeader(
|
|
|
+ pinned: true, //是否固定在顶部
|
|
|
+ floating: true,
|
|
|
+ delegate: _SliverAppBarDelegate(
|
|
|
+ minHeight: 60, //收起的高度
|
|
|
+ maxHeight: 60, //展开的最大高度
|
|
|
child: Container(
|
|
|
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(4))),
|
|
|
- child: Row(
|
|
|
- children: <Widget>[
|
|
|
- Container(
|
|
|
- width: 10,
|
|
|
- ),
|
|
|
- ImageIcon(
|
|
|
- AssetImage('images/home_icon_sousuo.png'),
|
|
|
- color: Color(0xFF727785),
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- flex: 1,
|
|
|
- child: Container(
|
|
|
- height: 34,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(100)),
|
|
|
+ color: Color(0xFF2E3049),
|
|
|
+ height: 60,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(4))),
|
|
|
+ child: Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+ width: 10,
|
|
|
+ ),
|
|
|
+ ImageIcon(
|
|
|
+ AssetImage('images/home_icon_sousuo.png'),
|
|
|
+ color: Color(0xFF727785),
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: Container(
|
|
|
+ height: 34,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(100)),
|
|
|
+ ),
|
|
|
+ child: ITextField(
|
|
|
+ hintText: '搜索竞赛房间',
|
|
|
+ inputBorder: InputBorder.none,
|
|
|
+ hintStyle: TextStyle(fontSize: 13, color: Color(0xFFB1B5C0), height: 1.2),
|
|
|
+ textStyle: TextStyle(color: Colors.black),
|
|
|
+ contentPadding: EdgeInsets.symmetric(vertical: 4, horizontal: 4),
|
|
|
+ fieldCallBack: (content) {
|
|
|
+ search(content);
|
|
|
+ _focusNode.unfocus();
|
|
|
+ },
|
|
|
+ focusNode: _focusNode,
|
|
|
+ counterStyle: TextStyle(color: Color(0xFF9BA0AE), fontSize: 0),
|
|
|
+ textInputAction: TextInputAction.search,
|
|
|
+ fileOnTap: () {
|
|
|
+ print('选择input');
|
|
|
+ if (_controller.position.pixels < 200) {
|
|
|
+ _controller.animateTo(200, duration: Duration(milliseconds: 300), curve: Curves.ease);
|
|
|
+ }
|
|
|
+ }),
|
|
|
),
|
|
|
- child: ITextField(
|
|
|
- hintText: '搜索竞赛房间',
|
|
|
- inputBorder: InputBorder.none,
|
|
|
- hintStyle: TextStyle(fontSize: 13, color: Color(0xFFB1B5C0), height: 1.2),
|
|
|
- textStyle: TextStyle(color: Colors.black),
|
|
|
- contentPadding: EdgeInsets.symmetric(vertical: 4, horizontal: 4),
|
|
|
- fieldCallBack: (content) {
|
|
|
- search(content);
|
|
|
- _focusNode.unfocus();
|
|
|
- },
|
|
|
- focusNode: _focusNode,
|
|
|
- counterStyle: TextStyle(color: Color(0xFF9BA0AE), fontSize: 0),
|
|
|
- textInputAction: TextInputAction.search,
|
|
|
- fileOnTap: () {
|
|
|
- print('选择input');
|
|
|
- if (_controller.position.pixels < 200) {
|
|
|
- _controller.animateTo(200, duration: Duration(milliseconds: 300), curve: Curves.ease);
|
|
|
- }
|
|
|
- }),
|
|
|
),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- width: 1,
|
|
|
- height: 10,
|
|
|
- color: Color(0xFFB1B5C0),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- width: 99,
|
|
|
- child: InkWell(
|
|
|
- onTap: () {
|
|
|
- showPicker(context);
|
|
|
- },
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: <Widget>[
|
|
|
- Expanded(
|
|
|
- flex: 1,
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.only(left: 5),
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- gameName,
|
|
|
- style: TextStyle(color: Color(0xFFB1B5C0)),
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
+ Container(
|
|
|
+ width: 1,
|
|
|
+ height: 10,
|
|
|
+ color: Color(0xFFB1B5C0),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ width: 99,
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ showPicker(context);
|
|
|
+ },
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: Container(
|
|
|
+ padding: EdgeInsets.only(left: 5),
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: Text(
|
|
|
+ gameName,
|
|
|
+ style: TextStyle(color: Color(0xFFB1B5C0)),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- Image.asset('images/icon_zhankai_huise.png'),
|
|
|
- Container(
|
|
|
- width: 5,
|
|
|
- )
|
|
|
- ],
|
|
|
- )))
|
|
|
+ Image.asset('images/icon_zhankai_huise.png'),
|
|
|
+ Container(
|
|
|
+ width: 5,
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ )))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )),
|
|
|
+ ),
|
|
|
+ SliverFixedExtentList(
|
|
|
+ itemExtent: houseList.isEmpty ? 300 : 90,
|
|
|
+ delegate: SliverChildBuilderDelegate((BuildContext context, int index) {
|
|
|
+ if (houseList.isEmpty) {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.only(top: 105),
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset('images/icon_kong.png'),
|
|
|
+ Text('暂时没有此房间哦~', style: TextStyle(fontSize: 14, color: Theme.of(context).primaryColor.withOpacity(0.3)))
|
|
|
],
|
|
|
),
|
|
|
- ),
|
|
|
- )),
|
|
|
- ),
|
|
|
- SliverFixedExtentList(
|
|
|
- itemExtent: houseList.isEmpty ? 300 : 90,
|
|
|
- delegate: SliverChildBuilderDelegate((BuildContext context, int index) {
|
|
|
- if (houseList.isEmpty) {
|
|
|
- return Container(
|
|
|
- padding: EdgeInsets.only(top: 105),
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- Image.asset('images/icon_kong.png'),
|
|
|
- Text('暂时没有此房间哦~', style: TextStyle(fontSize: 14, color: Theme.of(context).primaryColor.withOpacity(0.3)))
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
- } else if (index == houseList.length) {
|
|
|
- return Text('更多房间敬请期待...', style: TextStyle(color: Colors.grey, fontSize: 13, height: 3), textAlign: TextAlign.center);
|
|
|
- }
|
|
|
- return HouseItem(houseList[index], houseList[index].gameInfo);
|
|
|
- }, childCount: houseList.length + 1),
|
|
|
- )
|
|
|
- ],
|
|
|
+ );
|
|
|
+ } else if (index == houseList.length) {
|
|
|
+ return Text('更多房间敬请期待...', style: TextStyle(color: Colors.grey, fontSize: 13, height: 3), textAlign: TextAlign.center);
|
|
|
+ }
|
|
|
+ return HouseItem(houseList[index], houseList[index].gameInfo);
|
|
|
+ }, childCount: houseList.length + 1),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- )),
|
|
|
- onTap: (){
|
|
|
- _focusNode.unfocus();
|
|
|
- },
|
|
|
+ )),
|
|
|
+ onTap: () {
|
|
|
+ _focusNode.unfocus();
|
|
|
+ },
|
|
|
),
|
|
|
onWillPop: () {
|
|
|
if (isFirst) {
|