Skip to content

Commit

Permalink
fix(flashcard): fixed empty instructions still showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
SethCohen committed Mar 26, 2023
1 parent f84d3df commit c25211b
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/lib/widgets/flashcard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class _FlashcardState extends State<Flashcard> {

@override
Widget build(BuildContext context) {
final bool isEmptyInstructions = widget.card.instructions == '';

return SizedBox(
width: 300, // TODO make responsive
child: Card(
Expand All @@ -38,7 +40,7 @@ class _FlashcardState extends State<Flashcard> {
_buildMediaControls(),
_buildFlashcardButtons(),
// TODO replace instructions with FAB over and on bottom right of image
_buildInstructions(),
if (!_isImageBlurred && !isEmptyInstructions) _buildInstructions()
],
),
),
Expand Down Expand Up @@ -120,22 +122,13 @@ class _FlashcardState extends State<Flashcard> {
);
}

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),
),
),
),
);
}
);
}

0 comments on commit c25211b

Please sign in to comment.