Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class MultipleChoiceView extends StatelessWidget {
title: 'Transcript',
child: Transcript(
transcript: challenge.transcript,
isCollapsible: challenge.videoId != null,
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ReviewView extends StatelessWidget {
title: 'Transcript',
child: Transcript(
transcript: challenge.transcript,
isCollapsible: challenge.videoId != null,
),
),
],
Expand Down
43 changes: 27 additions & 16 deletions mobile-app/lib/ui/views/learn/widgets/transcript_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
);
}
}
}
Loading