Skip to content

Commit

Permalink
fix video player position in fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed Sep 21, 2024
1 parent e096ff1 commit a7b2783
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
3 changes: 2 additions & 1 deletion android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Expand All @@ -14,5 +14,6 @@
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>
</style>
</resources>
33 changes: 18 additions & 15 deletions lib/pages/video/video_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:kazumi/bean/appbar/sys_app_bar.dart';
Expand Down Expand Up @@ -39,13 +38,13 @@ class _VideoPageState extends State<VideoPage>
void initState() {
super.initState();
WakelockPlus.enable();
if (Platform.isIOS) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
systemNavigationBarDividerColor: Colors.black,
statusBarColor: Colors.black,
));
}
// if (Platform.isIOS) {
// SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
// systemNavigationBarColor: Colors.black,
// systemNavigationBarDividerColor: Colors.black,
// statusBarColor: Colors.black,
// ));
// }
videoPageController.currentEspisode = 1;
videoPageController.currentRoad = 0;
videoPageController.historyOffset = 0;
Expand All @@ -72,13 +71,13 @@ class _VideoPageState extends State<VideoPage>

@override
void dispose() {
if (Platform.isIOS) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
systemNavigationBarDividerColor: Colors.transparent,
statusBarColor: Colors.transparent,
));
}
// if (Platform.isIOS) {
// SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
// systemNavigationBarColor: Colors.transparent,
// systemNavigationBarDividerColor: Colors.transparent,
// statusBarColor: Colors.transparent,
// ));
// }
try {
playerController.mediaPlayer.dispose();
} catch (_) {}
Expand Down Expand Up @@ -111,6 +110,10 @@ class _VideoPageState extends State<VideoPage>
title: Text(videoPageController.title),
)),
body: SafeArea(
top: !videoPageController.androidFullscreen,
bottom: !videoPageController.androidFullscreen,
left: !videoPageController.androidFullscreen,
right: !videoPageController.androidFullscreen,
child: (Utils.isTablet() &&
MediaQuery.of(context).size.height <
MediaQuery.of(context).size.width)
Expand Down

0 comments on commit a7b2783

Please sign in to comment.