WIP Themes: climate controls and entity name

This commit is contained in:
Yegor Vialov
2020-04-04 12:00:15 +00:00
parent c40a496b6b
commit b8ba3c59e9
14 changed files with 104 additions and 93 deletions

View File

@ -5,18 +5,21 @@ class EntityName extends StatelessWidget {
final EdgeInsetsGeometry padding;
final TextOverflow textOverflow;
final bool wordsWrap;
final double fontSize;
final TextAlign textAlign;
final int maxLines;
final TextStyle textStyle;
const EntityName({Key key, this.maxLines, this.padding: const EdgeInsets.only(right: 10.0), this.textOverflow: TextOverflow.ellipsis, this.wordsWrap: true, this.fontSize: Sizes.nameFontSize, this.textAlign: TextAlign.left}) : super(key: key);
const EntityName({Key key, this.maxLines, this.padding: const EdgeInsets.only(right: 10.0), this.textOverflow: TextOverflow.ellipsis, this.textStyle, this.wordsWrap: true, this.textAlign: TextAlign.left}) : super(key: key);
@override
Widget build(BuildContext context) {
final EntityWrapper entityWrapper = EntityModel.of(context).entityWrapper;
TextStyle textStyle = TextStyle(fontSize: fontSize);
if (entityWrapper.entity.statelessType == StatelessEntityType.WEBLINK) {
textStyle = textStyle.apply(color: Colors.blue, decoration: TextDecoration.underline);
TextStyle tStyle;
if (textStyle == null) {
tStyle = Theme.of(context).textTheme.body1;
if (entityWrapper.entity.statelessType == StatelessEntityType.WEBLINK) {
tStyle = tStyle.apply(color: Colors.blue, decoration: TextDecoration.underline);
}
}
return Padding(
padding: padding,
@ -25,7 +28,7 @@ class EntityName extends StatelessWidget {
overflow: textOverflow,
softWrap: wordsWrap,
maxLines: maxLines,
style: textStyle,
style: tStyle,
textAlign: textAlign,
),
);