diff --git a/mobile-app/lib/ui/views/learn/challenge/templates/multiple_choice/multiple_choice_view.dart b/mobile-app/lib/ui/views/learn/challenge/templates/multiple_choice/multiple_choice_view.dart index 285d0ff01..b58795e60 100644 --- a/mobile-app/lib/ui/views/learn/challenge/templates/multiple_choice/multiple_choice_view.dart +++ b/mobile-app/lib/ui/views/learn/challenge/templates/multiple_choice/multiple_choice_view.dart @@ -72,6 +72,7 @@ class MultipleChoiceView extends StatelessWidget { title: 'Transcript', child: Transcript( transcript: challenge.transcript, + isCollapsible: challenge.videoId != null, ), ), ], diff --git a/mobile-app/lib/ui/views/learn/challenge/templates/python/python_view.dart b/mobile-app/lib/ui/views/learn/challenge/templates/python/python_view.dart index 0a2f63839..5879b3e7e 100644 --- a/mobile-app/lib/ui/views/learn/challenge/templates/python/python_view.dart +++ b/mobile-app/lib/ui/views/learn/challenge/templates/python/python_view.dart @@ -68,18 +68,20 @@ class PythonView extends StatelessWidget { ), ), const SizedBox(height: 12), - ChallengeCard( - title: 'Video', - child: YoutubePlayerWidget( - videoId: challenge.videoId!, + if (challenge.videoId != null) + ChallengeCard( + title: 'Video', + child: YoutubePlayerWidget( + videoId: challenge.videoId!, + ), ), - ), const SizedBox(height: 12), if (challenge.transcript.isNotEmpty) ...[ ChallengeCard( title: 'Transcript', child: Transcript( transcript: challenge.transcript, + isCollapsible: challenge.videoId != null, ), ), ], diff --git a/mobile-app/lib/ui/views/learn/challenge/templates/review/review_view.dart b/mobile-app/lib/ui/views/learn/challenge/templates/review/review_view.dart index 5339e15fd..dd59206de 100644 --- a/mobile-app/lib/ui/views/learn/challenge/templates/review/review_view.dart +++ b/mobile-app/lib/ui/views/learn/challenge/templates/review/review_view.dart @@ -60,6 +60,7 @@ class ReviewView extends StatelessWidget { title: 'Transcript', child: Transcript( transcript: challenge.transcript, + isCollapsible: challenge.videoId != null, ), ), ], diff --git a/mobile-app/lib/ui/views/learn/widgets/transcript_widget.dart b/mobile-app/lib/ui/views/learn/widgets/transcript_widget.dart index 106c698f3..2fccde628 100644 --- a/mobile-app/lib/ui/views/learn/widgets/transcript_widget.dart +++ b/mobile-app/lib/ui/views/learn/widgets/transcript_widget.dart @@ -5,29 +5,40 @@ class Transcript extends StatelessWidget { const Transcript({ super.key, required this.transcript, + this.isCollapsible = true, }); final String transcript; + final bool isCollapsible; @override Widget build(BuildContext context) { HTMLParser parser = HTMLParser(context: context); - return ExpansionTile( - backgroundColor: Colors.transparent, - collapsedBackgroundColor: Colors.transparent, - title: const Text('Tap to expand'), - shape: const RoundedRectangleBorder( - side: BorderSide.none, - borderRadius: BorderRadius.zero, - ), - collapsedShape: const RoundedRectangleBorder( - side: BorderSide.none, - borderRadius: BorderRadius.zero, - ), - children: [ - ...parser.parse(transcript), - ], - ); + if (isCollapsible) { + return ExpansionTile( + backgroundColor: Colors.transparent, + collapsedBackgroundColor: Colors.transparent, + title: const Text('Tap to expand'), + shape: const RoundedRectangleBorder( + side: BorderSide.none, + borderRadius: BorderRadius.zero, + ), + collapsedShape: const RoundedRectangleBorder( + side: BorderSide.none, + borderRadius: BorderRadius.zero, + ), + children: [ + ...parser.parse(transcript), + ], + ); + } else { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...parser.parse(transcript), + ], + ); + } } }