Fix icon_height parsing issue

This commit is contained in:
Yegor Vialov
2020-04-29 10:00:28 +03:00
committed by GitHub
parent 187e12dd79
commit 3ff55f181e

View File

@ -292,8 +292,8 @@ class ButtonCardData extends CardData {
showName = rawData['show_name'] ?? true; showName = rawData['show_name'] ?? true;
showIcon = rawData['show_icon'] ?? true; showIcon = rawData['show_icon'] ?? true;
stateColor = rawData['state_color'] ?? true; stateColor = rawData['state_color'] ?? true;
if (rawData.containsKey('icon_height')) { var rawHeight = rawData['icon_height'];
String rawHeight = rawData['icon_height']; if (rawHeight != null && rawHeight is String) {
if (rawHeight.contains('px')) { if (rawHeight.contains('px')) {
iconHeightPx = double.tryParse(rawHeight.replaceFirst('px', '')) ?? 0; iconHeightPx = double.tryParse(rawHeight.replaceFirst('px', '')) ?? 0;
} else if (rawHeight.contains('rem')) { } else if (rawHeight.contains('rem')) {
@ -507,4 +507,4 @@ class MediaControlCardData extends CardData {
} }
} }
} }