Skip to content

Commit

Permalink
Revert "fix: YT video fullscreen (#1256)" (#1265)
Browse files Browse the repository at this point in the history
This reverts commit fffc6d8.
  • Loading branch information
Nirajn2311 authored May 17, 2024
1 parent cc0d6da commit ebde35e
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 186 deletions.
185 changes: 86 additions & 99 deletions mobile-app/lib/ui/views/learn/challenge/templates/odin/odin_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:freecodecamp/extensions/i18n_extension.dart';
import 'package:freecodecamp/models/learn/challenge_model.dart';
Expand Down Expand Up @@ -48,114 +47,102 @@ class OdinView extends StatelessWidget {
onPopInvoked: (bool didPop) {
model.learnService.updateProgressOnPop(context, block);
},
child: YoutubePlayerScaffold(
controller: controller,
enableFullScreenOnVerticalDrag: false,
autoFullScreen: false,
defaultOrientations: const [
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
fullscreenOrientations: const [
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
builder: (context, videoPlayer) => Scaffold(
appBar: AppBar(
title: Text(
'$currentChallengeNum of ${block.challenges.length} Questions',
),
child: Scaffold(
appBar: AppBar(
title: Text(
'$currentChallengeNum of ${block.challenges.length} Questions',
),
body: SafeArea(
bottom: false,
child: ListView(
padding: const EdgeInsets.all(12),
children: [
Center(
child: Text(
challenge.title,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: 'Inter',
),
),
body: SafeArea(
bottom: false,
child: ListView(
padding: const EdgeInsets.all(12),
children: [
Center(
child: Text(
challenge.title,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: 'Inter',
),
),
const SizedBox(height: 12),
if (challenge.videoId != null) ...[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
child: videoPlayer,
),
const SizedBox(height: 12),
if (challenge.videoId != null) ...[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
child: YoutubePlayer(
controller: controller,
enableFullScreenOnVerticalDrag: false,
),
const SizedBox(height: 12),
],
...parser.parse(
challenge.description,
),
if (challenge.assignments != null &&
challenge.assignments!.isNotEmpty) ...[
buildDivider(),
Text(
'Assignments',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: FontSize.xLarge.value,
fontWeight: FontWeight.bold,
fontFamily: 'Inter',
),
const SizedBox(height: 12),
],
...parser.parse(
challenge.description,
),
if (challenge.assignments != null &&
challenge.assignments!.isNotEmpty) ...[
buildDivider(),
Text(
'Assignments',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: FontSize.xLarge.value,
fontWeight: FontWeight.bold,
fontFamily: 'Inter',
),
const SizedBox(height: 8),
for (final (i, assignment)
in challenge.assignments!.indexed)
assignmentTile(assignment, i, model, context),
],
if (challenge.description.isNotEmpty) buildDivider(),
...parser.parse(
challenge.question!.text,
),
const SizedBox(height: 8),
for (var answerObj
in challenge.question!.answers.asMap().entries)
questionOption(answerObj, model, context),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size(0, 50),
backgroundColor:
const Color.fromRGBO(0x3b, 0x3b, 0x4f, 1),
side: const BorderSide(
width: 2,
color: Colors.white,
),
),
onPressed: model.currentChoice != -1 &&
model.assignmentStatus.every((element) => element)
? model.choiceStatus != null && model.choiceStatus!
? () => model.learnService.goToNextChallenge(
block.challenges.length,
challengesCompleted,
challenge,
block,
)
: () => model.checkOption(challenge)
: null,
child: Text(
model.choiceStatus != null
? model.choiceStatus!
? context.t.next_challenge
: context.t.try_again
: context.t.questions_check,
style: const TextStyle(fontSize: 20),
for (final (i, assignment)
in challenge.assignments!.indexed)
assignmentTile(assignment, i, model, context),
],
if (challenge.description.isNotEmpty) buildDivider(),
...parser.parse(
challenge.question!.text,
),
const SizedBox(height: 8),
for (var answerObj
in challenge.question!.answers.asMap().entries)
questionOption(answerObj, model, context),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size(0, 50),
backgroundColor:
const Color.fromRGBO(0x3b, 0x3b, 0x4f, 1),
side: const BorderSide(
width: 2,
color: Colors.white,
),
),
const SizedBox(height: 50),
],
),
onPressed: model.currentChoice != -1 &&
model.assignmentStatus.every((element) => element)
? model.choiceStatus != null && model.choiceStatus!
? () => model.learnService.goToNextChallenge(
block.challenges.length,
challengesCompleted,
challenge,
block,
)
: () => model.checkOption(challenge)
: null,
child: Text(
model.choiceStatus != null
? model.choiceStatus!
? context.t.next_challenge
: context.t.try_again
: context.t.questions_check,
style: const TextStyle(fontSize: 20),
),
),
const SizedBox(height: 50),
],
),
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:freecodecamp/extensions/i18n_extension.dart';
import 'package:freecodecamp/models/learn/challenge_model.dart';
import 'package:freecodecamp/models/learn/curriculum_model.dart';
Expand Down Expand Up @@ -46,97 +45,85 @@ class PythonView extends StatelessWidget {
onPopInvoked: (bool didPop) {
model.learnService.updateProgressOnPop(context, block);
},
child: YoutubePlayerScaffold(
controller: controller,
enableFullScreenOnVerticalDrag: false,
autoFullScreen: false,
defaultOrientations: const [
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
fullscreenOrientations: const [
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
builder: (context, videoPlayer) => Scaffold(
appBar: AppBar(
title: Text(
'$currentChallengeNum of ${block.challenges.length} Questions',
),
child: Scaffold(
appBar: AppBar(
title: Text(
'$currentChallengeNum of ${block.challenges.length} Questions',
),
body: SafeArea(
bottom: false,
child: ListView(
padding: const EdgeInsets.all(12),
children: [
Center(
child: Text(
challenge.title,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: 'Inter',
),
),
),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
body: SafeArea(
bottom: false,
child: ListView(
padding: const EdgeInsets.all(12),
children: [
Center(
child: Text(
challenge.title,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: 'Inter',
),
child: videoPlayer,
),
const SizedBox(height: 12),
...parser.parse(
challenge.description,
),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
if (challenge.description.isNotEmpty) buildDivider(),
...parser.parse(
challenge.question!.text,
child: YoutubePlayer(
controller: controller,
enableFullScreenOnVerticalDrag: false,
),
const SizedBox(height: 8),
for (var answerObj
in challenge.question!.answers.asMap().entries)
questionOption(answerObj, model, context),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size(0, 50),
backgroundColor:
const Color.fromRGBO(0x3b, 0x3b, 0x4f, 1),
side: const BorderSide(
width: 2,
color: Colors.white,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
),
const SizedBox(height: 12),
...parser.parse(
challenge.description,
),
if (challenge.description.isNotEmpty) buildDivider(),
...parser.parse(
challenge.question!.text,
),
const SizedBox(height: 8),
for (var answerObj
in challenge.question!.answers.asMap().entries)
questionOption(answerObj, model, context),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size(0, 50),
backgroundColor:
const Color.fromRGBO(0x3b, 0x3b, 0x4f, 1),
side: const BorderSide(
width: 2,
color: Colors.white,
),
onPressed: model.currentChoice != -1
? model.choiceStatus != null && model.choiceStatus!
? () => model.learnService.goToNextChallenge(
block.challenges.length,
challengesCompleted,
challenge,
block,
)
: () => model.checkOption(challenge)
: null,
child: Text(
model.choiceStatus != null
? model.choiceStatus!
? context.t.next_challenge
: context.t.try_again
: context.t.questions_check,
style: const TextStyle(fontSize: 20),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
),
const SizedBox(height: 50),
],
),
onPressed: model.currentChoice != -1
? model.choiceStatus != null && model.choiceStatus!
? () => model.learnService.goToNextChallenge(
block.challenges.length,
challengesCompleted,
challenge,
block,
)
: () => model.checkOption(challenge)
: null,
child: Text(
model.choiceStatus != null
? model.choiceStatus!
? context.t.next_challenge
: context.t.try_again
: context.t.questions_check,
style: const TextStyle(fontSize: 20),
),
),
const SizedBox(height: 50),
],
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions mobile-app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1701,10 +1701,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_android
sha256: dad3313c9ead95517bb1cae5e1c9d20ba83729d5a59e5e83c0a2d66203f27f91
sha256: f038ee2fae73b509dde1bc9d2c5a50ca92054282de17631a9a3d515883740934
url: "https://pub.dev"
source: hosted
version: "3.16.1"
version: "3.16.0"
webview_flutter_platform_interface:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit ebde35e

Please sign in to comment.