| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter/cupertino.dart';
- import '../pages/RoomInfo.dart';
- class RommItem extends StatelessWidget {
- RommItem({this.roomInfo, this.hasBorder, this.isRage});
- final Map roomInfo;
- bool hasBorder = true;
- bool isRage = false;
- @override
- Widget build(BuildContext context) {
- ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
- Map houseLevelInfo =
- roomInfo["houseLevelInfo"].isNotEmpty ? roomInfo["houseLevelInfo"] : {};
- Map useRoomInfo=roomInfo.isNotEmpty?roomInfo:{};
- Map gameInfo=roomInfo.containsKey('gameInfo')?roomInfo['gameInfo']:{};
- Map imageInfo = {
- "黄金": Image.asset('images/dengji_icon_huangjin.png',
- width: ScreenUtil().setWidth(14)),
- "白银": Image.asset('images/dengji_icon_baiyin.png',
- width: ScreenUtil().setWidth(14)),
- "青铜": Image.asset('images/dengji_icon_qingtong.png',
- width: ScreenUtil().setWidth(14))
- };
- Map colorInfo = {
- "黄金": Color(0xFFF9D881),
- "白银": Color(0xFFAFCAD8),
- "青铜": Color(0xFFE18D50),
- };
-
- DecorationImage myIcon=DecorationImage(
- image: NetworkImage( gameInfo.containsKey('icon')?gameInfo["icon"]:''),
- fit: BoxFit.cover);
- return FlatButton(
- color: Color(0xFF464B6A),
- highlightColor: Color(0xFF35395E),
- textColor: Colors.white,
- padding: EdgeInsets.all(0),
- child: Container(
- padding: EdgeInsets.all(ScreenUtil().setWidth(15)),
- height: ScreenUtil().setWidth(78),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment
-
- .bottomRight,
- colors: [Color(0xFF35395E), Color(0xFF464B6A).withOpacity(0)],
- )),
- child: Row(
- children: <Widget>[
- Container(
- width: ScreenUtil().setWidth(48),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(2)),
- image:myIcon,
- ),
- ),
- Expanded(
- flex: 1,
- child: Container(
- margin: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- LimitedBox(
- maxWidth: ScreenUtil().setWidth(170),
- child: Text(
- roomInfo['houseName'],
- style: TextStyle(
- color: Colors.white,
- fontSize: 14,
- fontWeight: FontWeight.w500),
- maxLines:1,
- overflow:TextOverflow.ellipsis,
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 6),
- child: imageInfo[houseLevelInfo['levelName']],
- ),
- Container(
- margin: EdgeInsets.only(left: 1),
- child: Text(
- houseLevelInfo['levelName'],
- style: TextStyle(
- color: colorInfo[houseLevelInfo['levelName']],
- 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: <Widget>[
- Image.asset('images/icon_renshu.png', width: 20),
- Text((roomInfo.containsKey('playerNumber')?roomInfo['playerNumber'].toString():'0')+'/'+roomInfo['maxNumber'].toString(),
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w500,
- color: Color(0xFFB1B2C0)
- ),)
- ],
- )
- ],
- ),
- ),
- onPressed: () {
- Navigator.push(context,
- new CupertinoPageRoute(builder: (context) => new RoomInfo(
- roomId:roomInfo['id'].toString()
- )));
- },
- );
- }
- }
|