import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'dart:ui'; import 'package:cached_network_image/cached_network_image.dart'; import '../model/HouseInfo.dart'; import '../model/GameInfo.dart'; import '../pages/RoomInfo.dart'; import 'ScoreType.dart'; class HouseItem extends StatelessWidget { HouseItem({Key key, this.roomInfo, this.gameInfo}) : super(key: key); final HouseInfo roomInfo; final GameInfo gameInfo; @override @override Widget build(BuildContext context) { // if(roomInfo==null){ // return Container(); // } return Container( margin: EdgeInsets.symmetric(horizontal: 15), decoration: BoxDecoration( color: Color(0xFF363759), // gradient: LinearGradient( // colors: [Color(0xFF3F4261), Color(0xFF323456)], // begin: Alignment.topCenter, // end: Alignment.bottomCenter, // ), border: Border(bottom: BorderSide(color: Color(0xFF2F304B), width: 1))), child: Material( color: Colors.transparent, child: InkWell( child: Padding( padding: EdgeInsets.symmetric(vertical: 15), child: Row( children: [ Image.network( gameInfo.icon, width: 48, height: 48, ), Container( width: 10, ), Expanded( flex: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ LimitedBox( maxWidth: 170, child: Text( roomInfo.houseName, style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Container(width: 5,), ScoreType(roomInfo.scoreType) // roomInfo.houseLevel.icon != null // ? Container( // margin: EdgeInsets.only(left: 6), // child: Image.network(roomInfo.houseLevel.icon, width: 14), // ) // : null, // Container( // margin: EdgeInsets.only(left: 1), // child: Text( // roomInfo.houseLevel.levelName, // style: TextStyle(color: Color(0xFFF9D881), fontSize: 9), // )), ], ), Text( roomInfo.houseAbstract ?? '', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Color(0xFF9BA0AE)), maxLines: 2, overflow: TextOverflow.ellipsis, ) ], ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset(roomInfo.statusFlag==0?'images/icon_renshu_hong.png':'images/icon_renshu.png', width: 20), Text( (roomInfo.playerNumber != null ? roomInfo.playerNumber.toString() : '0') + '/' + roomInfo.maxNumber.toString(), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color:roomInfo.statusFlag==0? Theme.of(context).primaryColor: Color(0xFFB1B2C0)), ) ], ) ], ), ), onTap: () { Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(roomId: roomInfo.id.toString()))); }, ), ), ); } }