import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'dart:ui'; import '../model/HouseInfo.dart'; import '../model/GameInfo.dart'; import '../pages/RoomInfo.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( decoration: BoxDecoration( gradient: LinearGradient( colors: [Color(0xFF3F4261), Color(0xFF323456)], begin: Alignment.topCenter, end: Alignment.bottomCenter, ), border: Border(bottom: BorderSide(color: Colors.black, width: 1))), child: Material( color: Colors.transparent, child: InkWell( child: Padding( padding: EdgeInsets.all(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, ), ), 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('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: Color(0xFFB1B2C0)), ) ], ) ], ), ), onTap: () { Navigator.push(context, CupertinoPageRoute(builder: (context) => RoomInfo(roomId: roomInfo.id.toString()))); }, ), ), ); } }