From ce723b8d1dcc261bf8a5fd7e8dba61d32ed072c1 Mon Sep 17 00:00:00 2001 From: aligopalpour13 Date: Wed, 13 May 2026 14:51:49 +0330 Subject: [PATCH] fix: force portrait orientation and update intro video players to maintain correct aspect ratio via FittedBox --- ios/Runner/AppDelegate.swift | 4 +++ ios/Runner/Info.plist | 2 ++ .../ui/screens/intro_1_screen.dart | 26 +++++++++++++------ .../ui/screens/intro_2_screen.dart | 26 +++++++++++++------ .../ui/screens/intro_3_screen.dart | 26 +++++++++++++------ .../ui/screens/intro_4_screen.dart | 26 +++++++++++++------ .../ui/screens/intro_5_screen.dart | 26 +++++++++++++------ 7 files changed, 96 insertions(+), 40 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index c30b367..e3f5361 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -10,6 +10,10 @@ import UIKit return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { + return .portrait + } + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) } diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 145dbd5..9c2ba40 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -58,6 +58,8 @@ LaunchScreen UIMainStoryboardFile Main + UIRequiresFullScreen + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/lib/features/intro/presentation/ui/screens/intro_1_screen.dart b/lib/features/intro/presentation/ui/screens/intro_1_screen.dart index ae31cd1..9d275d5 100644 --- a/lib/features/intro/presentation/ui/screens/intro_1_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_1_screen.dart @@ -9,15 +9,25 @@ class Intro1Screen extends StatelessWidget { @override Widget build(BuildContext context) { + final controller = context.read().podController1; + final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16); + return SizedBox.expand( - child: PodVideoPlayer( - controller: context.read().podController1, - overlayBuilder: (options) => const SizedBox.shrink(), - alwaysShowProgressBar: false, - videoAspectRatio: context.widthScreen / context.heightScreen, - frameAspectRatio: context.widthScreen / context.heightScreen, - backgroundColor: const Color(0XFF00154C), - onLoading: (context) => const SizedBox.shrink(), + child: FittedBox( + fit: BoxFit.cover, + child: SizedBox( + width: context.widthScreen, + height: context.widthScreen / videoRatio, + child: PodVideoPlayer( + controller: controller, + overlayBuilder: (options) => const SizedBox.shrink(), + alwaysShowProgressBar: false, + videoAspectRatio: videoRatio, + frameAspectRatio: videoRatio, + backgroundColor: const Color(0XFF00154C), + onLoading: (context) => const SizedBox.shrink(), + ), + ), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_2_screen.dart b/lib/features/intro/presentation/ui/screens/intro_2_screen.dart index 36e110b..821e0e0 100644 --- a/lib/features/intro/presentation/ui/screens/intro_2_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_2_screen.dart @@ -10,15 +10,25 @@ class Intro2Screen extends StatelessWidget { @override Widget build(BuildContext context) { + final controller = context.read().podController2; + final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16); + return SizedBox.expand( - child: PodVideoPlayer( - controller: context.read().podController2, - overlayBuilder: (options) => const SizedBox.shrink(), - alwaysShowProgressBar: false, - videoAspectRatio: context.widthScreen / context.heightScreen, - frameAspectRatio: context.widthScreen / context.heightScreen, - backgroundColor: MyColors.transparent, - onLoading: (context) => const SizedBox.shrink(), + child: FittedBox( + fit: BoxFit.cover, + child: SizedBox( + width: context.widthScreen, + height: context.widthScreen / videoRatio, + child: PodVideoPlayer( + controller: controller, + overlayBuilder: (options) => const SizedBox.shrink(), + alwaysShowProgressBar: false, + videoAspectRatio: videoRatio, + frameAspectRatio: videoRatio, + backgroundColor: MyColors.transparent, + onLoading: (context) => const SizedBox.shrink(), + ), + ), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_3_screen.dart b/lib/features/intro/presentation/ui/screens/intro_3_screen.dart index 135b381..ee25038 100644 --- a/lib/features/intro/presentation/ui/screens/intro_3_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_3_screen.dart @@ -10,15 +10,25 @@ class Intro3Screen extends StatelessWidget { @override Widget build(BuildContext context) { + final controller = context.read().podController3; + final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16); + return SizedBox.expand( - child: PodVideoPlayer( - controller: context.read().podController3, - overlayBuilder: (options) => const SizedBox.shrink(), - alwaysShowProgressBar: false, - videoAspectRatio: context.widthScreen / context.heightScreen, - frameAspectRatio: context.widthScreen / context.heightScreen, - backgroundColor: MyColors.transparent, - onLoading: (context) => const SizedBox.shrink(), + child: FittedBox( + fit: BoxFit.cover, + child: SizedBox( + width: context.widthScreen, + height: context.widthScreen / videoRatio, + child: PodVideoPlayer( + controller: controller, + overlayBuilder: (options) => const SizedBox.shrink(), + alwaysShowProgressBar: false, + videoAspectRatio: videoRatio, + frameAspectRatio: videoRatio, + backgroundColor: MyColors.transparent, + onLoading: (context) => const SizedBox.shrink(), + ), + ), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_4_screen.dart b/lib/features/intro/presentation/ui/screens/intro_4_screen.dart index 61209d7..6ad7f20 100644 --- a/lib/features/intro/presentation/ui/screens/intro_4_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_4_screen.dart @@ -10,15 +10,25 @@ class Intro4Screen extends StatelessWidget { @override Widget build(BuildContext context) { + final controller = context.read().podController4; + final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16); + return SizedBox.expand( - child: PodVideoPlayer( - controller: context.read().podController4, - overlayBuilder: (options) => const SizedBox.shrink(), - alwaysShowProgressBar: false, - videoAspectRatio: context.widthScreen / context.heightScreen, - frameAspectRatio: context.widthScreen / context.heightScreen, - backgroundColor: MyColors.transparent, - onLoading: (context) => const SizedBox.shrink(), + child: FittedBox( + fit: BoxFit.cover, + child: SizedBox( + width: context.widthScreen, + height: context.widthScreen / videoRatio, + child: PodVideoPlayer( + controller: controller, + overlayBuilder: (options) => const SizedBox.shrink(), + alwaysShowProgressBar: false, + videoAspectRatio: videoRatio, + frameAspectRatio: videoRatio, + backgroundColor: MyColors.transparent, + onLoading: (context) => const SizedBox.shrink(), + ), + ), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_5_screen.dart b/lib/features/intro/presentation/ui/screens/intro_5_screen.dart index 57a61b8..fbd2a4c 100644 --- a/lib/features/intro/presentation/ui/screens/intro_5_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_5_screen.dart @@ -10,15 +10,25 @@ class Intro5Screen extends StatelessWidget { @override Widget build(BuildContext context) { + final controller = context.read().podController5; + final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16); + return SizedBox.expand( - child: PodVideoPlayer( - controller: context.read().podController5, - overlayBuilder: (options) => const SizedBox.shrink(), - alwaysShowProgressBar: false, - videoAspectRatio: context.widthScreen / context.heightScreen, - frameAspectRatio: context.widthScreen / context.heightScreen, - backgroundColor: MyColors.transparent, - onLoading: (context) => const SizedBox.shrink(), + child: FittedBox( + fit: BoxFit.cover, + child: SizedBox( + width: context.widthScreen, + height: context.widthScreen / videoRatio, + child: PodVideoPlayer( + controller: controller, + overlayBuilder: (options) => const SizedBox.shrink(), + alwaysShowProgressBar: false, + videoAspectRatio: videoRatio, + frameAspectRatio: videoRatio, + backgroundColor: MyColors.transparent, + onLoading: (context) => const SizedBox.shrink(), + ), + ), ), ); }