Browse Source

fix: force portrait orientation and update intro video players to maintain correct aspect ratio via FittedBox

develop
Ali Gopal Pour 1 week ago
parent
commit
ce723b8d1d
  1. 4
      ios/Runner/AppDelegate.swift
  2. 2
      ios/Runner/Info.plist
  3. 16
      lib/features/intro/presentation/ui/screens/intro_1_screen.dart
  4. 16
      lib/features/intro/presentation/ui/screens/intro_2_screen.dart
  5. 16
      lib/features/intro/presentation/ui/screens/intro_3_screen.dart
  6. 16
      lib/features/intro/presentation/ui/screens/intro_4_screen.dart
  7. 16
      lib/features/intro/presentation/ui/screens/intro_5_screen.dart

4
ios/Runner/AppDelegate.swift

@ -10,6 +10,10 @@ import UIKit
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return .portrait
}
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
} }

2
ios/Runner/Info.plist

@ -58,6 +58,8 @@
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>

16
lib/features/intro/presentation/ui/screens/intro_1_screen.dart

@ -9,16 +9,26 @@ class Intro1Screen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final controller = context.read<IntroBloc>().podController1;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand( return SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: context.widthScreen,
height: context.widthScreen / videoRatio,
child: PodVideoPlayer( child: PodVideoPlayer(
controller: context.read<IntroBloc>().podController1,
controller: controller,
overlayBuilder: (options) => const SizedBox.shrink(), overlayBuilder: (options) => const SizedBox.shrink(),
alwaysShowProgressBar: false, alwaysShowProgressBar: false,
videoAspectRatio: context.widthScreen / context.heightScreen,
frameAspectRatio: context.widthScreen / context.heightScreen,
videoAspectRatio: videoRatio,
frameAspectRatio: videoRatio,
backgroundColor: const Color(0XFF00154C), backgroundColor: const Color(0XFF00154C),
onLoading: (context) => const SizedBox.shrink(), onLoading: (context) => const SizedBox.shrink(),
), ),
),
),
); );
} }
} }

16
lib/features/intro/presentation/ui/screens/intro_2_screen.dart

@ -10,16 +10,26 @@ class Intro2Screen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final controller = context.read<IntroBloc>().podController2;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand( return SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: context.widthScreen,
height: context.widthScreen / videoRatio,
child: PodVideoPlayer( child: PodVideoPlayer(
controller: context.read<IntroBloc>().podController2,
controller: controller,
overlayBuilder: (options) => const SizedBox.shrink(), overlayBuilder: (options) => const SizedBox.shrink(),
alwaysShowProgressBar: false, alwaysShowProgressBar: false,
videoAspectRatio: context.widthScreen / context.heightScreen,
frameAspectRatio: context.widthScreen / context.heightScreen,
videoAspectRatio: videoRatio,
frameAspectRatio: videoRatio,
backgroundColor: MyColors.transparent, backgroundColor: MyColors.transparent,
onLoading: (context) => const SizedBox.shrink(), onLoading: (context) => const SizedBox.shrink(),
), ),
),
),
); );
} }
} }

16
lib/features/intro/presentation/ui/screens/intro_3_screen.dart

@ -10,16 +10,26 @@ class Intro3Screen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final controller = context.read<IntroBloc>().podController3;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand( return SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: context.widthScreen,
height: context.widthScreen / videoRatio,
child: PodVideoPlayer( child: PodVideoPlayer(
controller: context.read<IntroBloc>().podController3,
controller: controller,
overlayBuilder: (options) => const SizedBox.shrink(), overlayBuilder: (options) => const SizedBox.shrink(),
alwaysShowProgressBar: false, alwaysShowProgressBar: false,
videoAspectRatio: context.widthScreen / context.heightScreen,
frameAspectRatio: context.widthScreen / context.heightScreen,
videoAspectRatio: videoRatio,
frameAspectRatio: videoRatio,
backgroundColor: MyColors.transparent, backgroundColor: MyColors.transparent,
onLoading: (context) => const SizedBox.shrink(), onLoading: (context) => const SizedBox.shrink(),
), ),
),
),
); );
} }
} }

16
lib/features/intro/presentation/ui/screens/intro_4_screen.dart

@ -10,16 +10,26 @@ class Intro4Screen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final controller = context.read<IntroBloc>().podController4;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand( return SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: context.widthScreen,
height: context.widthScreen / videoRatio,
child: PodVideoPlayer( child: PodVideoPlayer(
controller: context.read<IntroBloc>().podController4,
controller: controller,
overlayBuilder: (options) => const SizedBox.shrink(), overlayBuilder: (options) => const SizedBox.shrink(),
alwaysShowProgressBar: false, alwaysShowProgressBar: false,
videoAspectRatio: context.widthScreen / context.heightScreen,
frameAspectRatio: context.widthScreen / context.heightScreen,
videoAspectRatio: videoRatio,
frameAspectRatio: videoRatio,
backgroundColor: MyColors.transparent, backgroundColor: MyColors.transparent,
onLoading: (context) => const SizedBox.shrink(), onLoading: (context) => const SizedBox.shrink(),
), ),
),
),
); );
} }
} }

16
lib/features/intro/presentation/ui/screens/intro_5_screen.dart

@ -10,16 +10,26 @@ class Intro5Screen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final controller = context.read<IntroBloc>().podController5;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand( return SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: context.widthScreen,
height: context.widthScreen / videoRatio,
child: PodVideoPlayer( child: PodVideoPlayer(
controller: context.read<IntroBloc>().podController5,
controller: controller,
overlayBuilder: (options) => const SizedBox.shrink(), overlayBuilder: (options) => const SizedBox.shrink(),
alwaysShowProgressBar: false, alwaysShowProgressBar: false,
videoAspectRatio: context.widthScreen / context.heightScreen,
frameAspectRatio: context.widthScreen / context.heightScreen,
videoAspectRatio: videoRatio,
frameAspectRatio: videoRatio,
backgroundColor: MyColors.transparent, backgroundColor: MyColors.transparent,
onLoading: (context) => const SizedBox.shrink(), onLoading: (context) => const SizedBox.shrink(),
), ),
),
),
); );
} }
} }
Loading…
Cancel
Save