From c25211bdc0548b311124672360f5b6311114100b Mon Sep 17 00:00:00 2001 From: SethCohen Date: Sat, 25 Mar 2023 23:19:57 -0400 Subject: [PATCH] fix(flashcard): fixed empty instructions still showing up --- src/lib/widgets/flashcard.dart | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/lib/widgets/flashcard.dart b/src/lib/widgets/flashcard.dart index 10251e1..654a30f 100644 --- a/src/lib/widgets/flashcard.dart +++ b/src/lib/widgets/flashcard.dart @@ -25,6 +25,8 @@ class _FlashcardState extends State { @override Widget build(BuildContext context) { + final bool isEmptyInstructions = widget.card.instructions == ''; + return SizedBox( width: 300, // TODO make responsive child: Card( @@ -38,7 +40,7 @@ class _FlashcardState extends State { _buildMediaControls(), _buildFlashcardButtons(), // TODO replace instructions with FAB over and on bottom right of image - _buildInstructions(), + if (!_isImageBlurred && !isEmptyInstructions) _buildInstructions() ], ), ), @@ -120,22 +122,13 @@ class _FlashcardState extends State { ); } - Widget _buildInstructions() { - final bool isEmptyInstructions = widget.card.instructions == ''; - - // TODO fix empty instructions still showing up - if (_isImageBlurred && isEmptyInstructions) { - return const SizedBox.shrink(); - } - - return Padding( - padding: const EdgeInsets.all(8.0), - child: SizedBox( - height: 100, - child: SingleChildScrollView( - child: Text(widget.card.instructions), + Widget _buildInstructions() => Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: 100, + child: SingleChildScrollView( + child: Text(widget.card.instructions), + ), ), - ), - ); - } + ); }