Resolves #508 show_name for enriry button card

This commit is contained in:
Yegor Vialov 2019-11-29 10:12:41 +00:00
parent 9897b6a44b
commit 890da650dc
3 changed files with 19 additions and 12 deletions

View File

@ -285,7 +285,9 @@ class CardWidget extends StatelessWidget {
return Card( return Card(
child: EntityModel( child: EntityModel(
entityWrapper: card.linkedEntityWrapper, entityWrapper: card.linkedEntityWrapper,
child: EntityButtonCardBody(), child: EntityButtonCardBody(
showName: card.showName,
),
handleTap: true handleTap: true
) )
); );

View File

@ -2,8 +2,10 @@ part of '../../main.dart';
class EntityButtonCardBody extends StatelessWidget { class EntityButtonCardBody extends StatelessWidget {
final bool showName;
EntityButtonCardBody({ EntityButtonCardBody({
Key key, Key key, this.showName: true,
}) : super(key: key); }) : super(key: key);
@override @override
@ -39,13 +41,16 @@ class EntityButtonCardBody extends StatelessWidget {
} }
Widget _buildName() { Widget _buildName() {
return EntityName( if (showName) {
padding: EdgeInsets.fromLTRB(Sizes.buttonPadding, 0.0, Sizes.buttonPadding, Sizes.rowPadding), return EntityName(
textOverflow: TextOverflow.ellipsis, padding: EdgeInsets.fromLTRB(Sizes.buttonPadding, 0.0, Sizes.buttonPadding, Sizes.rowPadding),
maxLines: 3, textOverflow: TextOverflow.ellipsis,
wordsWrap: true, maxLines: 3,
textAlign: TextAlign.center, wordsWrap: true,
fontSize: Sizes.nameFontSize, textAlign: TextAlign.center,
); fontSize: Sizes.nameFontSize,
);
}
return Container(width: 0, height: 0);
} }
} }

View File

@ -223,8 +223,8 @@ class HomeAssistant {
name: rawCardInfo["title"] ?? rawCardInfo["name"], name: rawCardInfo["title"] ?? rawCardInfo["name"],
type: rawCardInfo['type'] ?? CardType.ENTITIES, type: rawCardInfo['type'] ?? CardType.ENTITIES,
columnsCount: rawCardInfo['columns'] ?? 4, columnsCount: rawCardInfo['columns'] ?? 4,
showName: rawCardInfo['show_name'] ?? true, showName: (rawCardInfo['show_name'] ?? rawCard['show_name']) ?? true,
showState: rawCardInfo['show_state'] ?? true, showState: (rawCardInfo['show_state'] ?? rawCard['show_state']) ?? true,
showEmpty: (rawCardInfo['show_empty'] ?? rawCard['show_empty']) ?? true, showEmpty: (rawCardInfo['show_empty'] ?? rawCard['show_empty']) ?? true,
stateFilter: (rawCard['state_filter'] ?? rawCardInfo['state_filter']) ?? [], stateFilter: (rawCard['state_filter'] ?? rawCardInfo['state_filter']) ?? [],
states: rawCardInfo['states'], states: rawCardInfo['states'],