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

@ -18,7 +18,7 @@ class CardHeader extends StatelessWidget {
title: Text("$name",
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
style: new TextStyle(fontWeight: FontWeight.bold, fontSize: Sizes.largeFontSize)),
style: Theme.of(context).textTheme.headline),
);
} else {
result = new Container(width: 0.0, height: 0.0);

View File

@ -48,8 +48,7 @@ class EntityButtonCardBody extends StatelessWidget {
textOverflow: TextOverflow.ellipsis,
maxLines: 3,
wordsWrap: true,
textAlign: TextAlign.center,
fontSize: Sizes.nameFontSize,
textAlign: TextAlign.center
);
}
return Container(width: 0, height: 0);

View File

@ -126,7 +126,9 @@ class _GaugeCardBodyState extends State<GaugeCardBody> {
return Padding(
padding: EdgeInsets.only(bottom: fontSize),
child: EntityName(
fontSize: fontSize,
textStyle: Theme.of(context).textTheme.body1.copyWith(
fontSize: fontSize
),
maxLines: 1,
padding: EdgeInsets.all(0.0),
textAlign: TextAlign.center,

View File

@ -6,7 +6,6 @@ class GlanceCardEntityContainer extends StatelessWidget {
final bool showState;
final bool nameInTheBottom;
final double iconSize;
final double nameFontSize;
final bool wordsWrapInName;
GlanceCardEntityContainer({
@ -15,7 +14,6 @@ class GlanceCardEntityContainer extends StatelessWidget {
@required this.showState,
this.nameInTheBottom: false,
this.iconSize: Sizes.iconSize,
this.nameFontSize: Sizes.smallFontSize,
this.wordsWrapInName: false
}) : super(key: key);
@ -31,7 +29,7 @@ class GlanceCardEntityContainer extends StatelessWidget {
List<Widget> result = [];
if (!nameInTheBottom) {
if (showName) {
result.add(_buildName());
result.add(_buildName(context));
}
} else {
if (showState) {
@ -49,7 +47,7 @@ class GlanceCardEntityContainer extends StatelessWidget {
result.add(_buildState());
}
} else {
result.add(_buildName());
result.add(_buildName(context));
}
return Center(
@ -65,13 +63,13 @@ class GlanceCardEntityContainer extends StatelessWidget {
);
}
Widget _buildName() {
Widget _buildName(BuildContext context) {
return EntityName(
padding: EdgeInsets.only(bottom: Sizes.rowPadding),
textOverflow: TextOverflow.ellipsis,
wordsWrap: wordsWrapInName,
textAlign: TextAlign.center,
fontSize: nameFontSize,
textStyle: Theme.of(context).textTheme.caption,
);
}

View File

@ -73,7 +73,9 @@ class _LightCardBodyState extends State<LightCardBody> {
return Padding(
padding: EdgeInsets.only(bottom: fontSize),
child: EntityName(
fontSize: fontSize,
textStyle: Theme.of(context).textTheme.body1.copyWith(
fontSize: fontSize
),
maxLines: 1,
padding: EdgeInsets.all(0.0),
textAlign: TextAlign.center,