From be560769ef8e61bcdc0bbd6ec84c68a08dc8a804 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Fri, 14 Dec 2018 16:57:11 +0200 Subject: [PATCH] Resolves #243 --- lib/ui_widgets/card_widget.dart | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/ui_widgets/card_widget.dart b/lib/ui_widgets/card_widget.dart index 2ff2412..2d52110 100644 --- a/lib/ui_widgets/card_widget.dart +++ b/lib/ui_widgets/card_widget.dart @@ -150,24 +150,33 @@ class CardWidget extends StatelessWidget { } Widget _buildMediaControlsCard(BuildContext context) { - return Card( - child: EntityModel( - entityWrapper: card.linkedEntityWrapper, - handleTap: null, - child: MediaPlayerWidget() - ) - ); + if (card.linkedEntityWrapper == null || card.linkedEntityWrapper.entity == null) { + return Container(width: 0, height: 0,); + } else { + return Card( + child: EntityModel( + entityWrapper: card.linkedEntityWrapper, + handleTap: null, + child: MediaPlayerWidget() + ) + ); + } } Widget _buildEntityButtonCard(BuildContext context) { - card.linkedEntityWrapper.displayName = card.name?.toUpperCase() ?? card.linkedEntityWrapper.displayName.toUpperCase(); - return Card( - child: EntityModel( - entityWrapper: card.linkedEntityWrapper, - child: ButtonEntityContainer(), - handleTap: true - ) - ); + if (card.linkedEntityWrapper == null || card.linkedEntityWrapper.entity == null) { + return Container(width: 0, height: 0,); + } else { + card.linkedEntityWrapper.displayName = card.name?.toUpperCase() ?? + card.linkedEntityWrapper.displayName.toUpperCase(); + return Card( + child: EntityModel( + entityWrapper: card.linkedEntityWrapper, + child: ButtonEntityContainer(), + handleTap: true + ) + ); + } } Widget _buildUnsupportedCard(BuildContext context) {