Skip to content

Commit 4bdf4ff

Browse files
fix(view): improve python and review views (#1586)
* fix(view): improve python and review views * fix(view): align challenge description in Python view for better readability --------- Co-authored-by: sembauke <[email protected]>
1 parent f9f4fdd commit 4bdf4ff

File tree

3 files changed

+29
-21
lines changed

3 files changed

+29
-21
lines changed

mobile-app/lib/ui/views/learn/challenge/templates/python/python_view.dart

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:freecodecamp/extensions/i18n_extension.dart';
33
import 'package:freecodecamp/models/learn/challenge_model.dart';
44
import 'package:freecodecamp/models/learn/curriculum_model.dart';
5+
import 'package:freecodecamp/ui/theme/fcc_theme.dart';
56
import 'package:freecodecamp/ui/views/learn/challenge/templates/python/python_viewmodel.dart';
67
import 'package:freecodecamp/ui/views/learn/utils/challenge_utils.dart';
78
import 'package:freecodecamp/ui/views/learn/widgets/challenge_card.dart';
@@ -34,37 +35,43 @@ class PythonView extends StatelessWidget {
3435
onViewModelReady: (model) => model.initChallenge(challenge),
3536
builder: (context, model, child) {
3637
return Scaffold(
38+
backgroundColor: FccColors.gray90,
3739
appBar: AppBar(
3840
title: Text(handleChallengeTitle(challenge, block)),
3941
),
4042
body: SafeArea(
4143
bottom: false,
4244
child: ListView(
4345
children: [
44-
Center(
45-
child: Text(
46-
challenge.title,
47-
textAlign: TextAlign.center,
48-
style: const TextStyle(
49-
fontSize: 20,
50-
fontWeight: FontWeight.bold,
46+
Container(
47+
margin: const EdgeInsets.all(8),
48+
child: Center(
49+
child: Text(
50+
challenge.title,
51+
textAlign: TextAlign.center,
52+
style: const TextStyle(
53+
fontSize: 20,
54+
fontWeight: FontWeight.bold,
55+
),
5156
),
5257
),
5358
),
5459
const SizedBox(height: 12),
5560
if (challenge.description.isNotEmpty)
5661
ChallengeCard(
5762
title: 'Description',
58-
child: Column(
59-
children: parser.parse(
60-
challenge.description,
63+
child: Align(
64+
alignment: Alignment.centerLeft,
65+
child: Column(
66+
children: parser.parse(
67+
challenge.description,
68+
),
6169
),
6270
),
6371
),
64-
Padding(
65-
padding: const EdgeInsets.symmetric(
66-
horizontal: 16,
67-
),
72+
const SizedBox(height: 12),
73+
ChallengeCard(
74+
title: 'Video',
6875
child: YoutubePlayerWidget(
6976
videoId: challenge.videoId!,
7077
),

mobile-app/lib/ui/views/learn/challenge/templates/review/review_view.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ class ReviewView extends StatelessWidget {
4949
),
5050
if (challenge.videoId != null) ...[
5151
const SizedBox(height: 12),
52-
Padding(
53-
padding: const EdgeInsets.symmetric(
54-
horizontal: 16,
55-
),
52+
ChallengeCard(
53+
title: 'Video',
5654
child: YoutubePlayerWidget(
5755
videoId: challenge.videoId!,
5856
),

mobile-app/lib/ui/views/learn/widgets/youtube_player_widget.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ class YoutubePlayerWidget extends StatelessWidget {
3232
},
3333
);
3434

35-
return YoutubePlayer(
36-
controller: controller,
37-
enableFullScreenOnVerticalDrag: false,
35+
return Padding(
36+
padding: const EdgeInsets.symmetric(vertical: 8.0),
37+
child: YoutubePlayer(
38+
controller: controller,
39+
enableFullScreenOnVerticalDrag: false,
40+
),
3841
);
3942
}
4043
}

0 commit comments

Comments
 (0)