import 'package:base_app/res/index.dart'; import 'package:base_app/res/strings.dart'; import 'package:base_app/utils/utils.dart'; import 'package:fluintl/fluintl.dart'; import 'package:flutter/material.dart'; class HeaderItem extends StatelessWidget { const HeaderItem( {this.margin, this.titleColor, this.leftIcon, this.titleId: Ids.titleRepos, this.title, this.extraId: Ids.more, this.extra, this.rightIcon, this.onTap, Key key}) : super(key: key); final EdgeInsetsGeometry margin; // 边距 final Color titleColor; // 标题颜色 final IconData leftIcon; // 左边的icon final String titleId; // 标题id, 对应Ids中的字典 final String title; // 标题 final String extraId; //其他文字id, 对应Ids中字典 final String extra; // 其他文字 final IconData rightIcon; // 右边的icon final GestureTapCallback onTap; // 点击事件 @override Widget build(BuildContext context) { return new Container( height: 56.0, margin: margin ?? EdgeInsets.only(top: 0.0), child: new ListTile( onTap: onTap, title: new Row( mainAxisSize: MainAxisSize.min, children: <Widget>[ new Icon( leftIcon ?? Icons.whatshot, color: titleColor ?? Colors.blueAccent, ), Gaps.hGap10, new Expanded( child: new Text( title ?? IntlUtil.getString(context, titleId), overflow: TextOverflow.ellipsis, style: TextStyle( color: titleColor ?? Colors.blueAccent, fontSize: Utils.getTitleFontSize( title ?? IntlUtil.getString(context, titleId))), )) ], ), trailing: new Row( mainAxisSize: MainAxisSize.min, children: <Widget>[ new Text( extra ?? IntlUtil.getString(context, extraId), style: TextStyle(color: Colors.grey, fontSize: 14), ), new Icon( rightIcon ?? Icons.keyboard_arrow_right, color: Colors.grey, ), ], )), decoration: new BoxDecoration( //new Border.all(width: 0.33, color: Colours.divider) border: new Border( bottom: new BorderSide(width: 0.33, color: Colours.divider))), ); } }