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. 26
      lib/features/intro/presentation/ui/screens/intro_1_screen.dart
  4. 26
      lib/features/intro/presentation/ui/screens/intro_2_screen.dart
  5. 26
      lib/features/intro/presentation/ui/screens/intro_3_screen.dart
  6. 26
      lib/features/intro/presentation/ui/screens/intro_4_screen.dart
  7. 26
      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)
}
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return .portrait
}
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}

2
ios/Runner/Info.plist

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

26
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<IntroBloc>().podController1;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand(
child: PodVideoPlayer(
controller: context.read<IntroBloc>().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(),
),
),
),
);
}

26
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<IntroBloc>().podController2;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand(
child: PodVideoPlayer(
controller: context.read<IntroBloc>().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(),
),
),
),
);
}

26
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<IntroBloc>().podController3;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand(
child: PodVideoPlayer(
controller: context.read<IntroBloc>().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(),
),
),
),
);
}

26
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<IntroBloc>().podController4;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand(
child: PodVideoPlayer(
controller: context.read<IntroBloc>().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(),
),
),
),
);
}

26
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<IntroBloc>().podController5;
final videoRatio = controller.videoPlayerValue?.aspectRatio ?? (9 / 16);
return SizedBox.expand(
child: PodVideoPlayer(
controller: context.read<IntroBloc>().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(),
),
),
),
);
}

Loading…
Cancel
Save