Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common/widgets/image_viewer/gallery_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class _GalleryViewerState extends State<GalleryViewer>
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
super.dispose();
if (_hideSystemBar) {
showSystemBar();
showSystemBar('gallery_dispose');
}
}

Expand Down
16 changes: 0 additions & 16 deletions lib/harmony_adapt/status_bar.dart

This file was deleted.

11 changes: 11 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ class MyApp extends StatelessWidget {
child: child,
);
}
// child = Stack(
// children: [
// child,
// const Center(
// child: ElevatedButton(
// onPressed: toggleSystemBar,
// child: Text('测试'),
// ),
// ),
// ],
// );
return child;
}

Expand Down
10 changes: 4 additions & 6 deletions lib/pages/video/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ import 'package:PiliPlus/utils/max_screen_size.dart';
import 'package:PiliPlus/utils/mobile_observer.dart';
import 'package:PiliPlus/utils/num_utils.dart';
import 'package:PiliPlus/utils/page_utils.dart';
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/storage_key.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:PiliPlus/utils/theme_utils.dart';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:floating/floating.dart';
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show SystemUiOverlayStyle;
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
Expand Down Expand Up @@ -387,7 +387,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
}

if (!videoDetailController.removeSafeArea) {
showSystemBar();
showSystemBar('video_page_portrait');
}

if (!videoDetailController.plPlayerController.isCloseAll) {
Expand Down Expand Up @@ -530,9 +530,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>

Widget get childWhenDisabled {
if (PlatformUtils.isMobile && mounted && isShowing && !isFullScreen) {
if (isPortrait) {
showSystemBar();
} else if (!videoDetailController.horizontalScreen) {
if (videoDetailController.horizontalScreen || videoDetailController.removeSafeArea) {
hideSystemBar();
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/plugin/pl_player/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ class PlPlayerController with BlockConfigMixin {
} else {
if (PlatformUtils.isMobile) {
if (!removeSafeArea) {
showSystemBar();
showSystemBar('controller_fullscreen_exit');
}
if (orientation == null && mode == .none) {
return;
Expand Down Expand Up @@ -1761,7 +1761,7 @@ class PlPlayerController with BlockConfigMixin {

_playerCount = 0;
if (removeSafeArea) {
showSystemBar();
showSystemBar('controller_dispose');
}
danmakuController = null;
_stopOrientationListener();
Expand Down
14 changes: 10 additions & 4 deletions lib/plugin/pl_player/utils/fullscreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:io' show Platform;

import 'package:PiliPlus/harmony_adapt/harmony_channel.dart';
import 'package:PiliPlus/harmony_adapt/status_bar.dart';
import 'package:PiliPlus/utils/device_utils.dart';
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:auto_orientation/auto_orientation.dart';
import 'package:flutter/foundation.dart' show debugPrint;
import 'package:flutter/services.dart'
show SystemChrome, MethodChannel, SystemUiOverlay, DeviceOrientation;
import 'package:os_type/os_type.dart';
Expand Down Expand Up @@ -113,19 +113,25 @@ Future<void>? hideSystemBar() {
return null;
}
_showSystemBar = false;
StatusBar.i.hidden = true; // 鸿蒙状态栏由原生侧控制
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
}

//退出全屏显示
Future<void>? showSystemBar() {
Future<void>? showSystemBar(String reason) {
if (_showSystemBar) {
return null;
}
_showSystemBar = true;
StatusBar.i.hidden = false; // 鸿蒙状态栏由原生侧控制
debugPrint('showSystemBar: $reason');
return SystemChrome.setEnabledSystemUIMode(
Platform.isAndroid && DeviceUtils.sdkInt < 29 ? .manual : .edgeToEdge,
overlays: SystemUiOverlay.values,
);
}

Future<void> toggleSystemBar() {
_showSystemBar = !_showSystemBar;
return SystemChrome.setEnabledSystemUIMode(
_showSystemBar ? .edgeToEdge : .immersiveSticky,
);
}
14 changes: 7 additions & 7 deletions lib/plugin/pl_player/view/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'package:PiliPlus/common/widgets/player_bar.dart';
import 'package:PiliPlus/common/widgets/progress_bar/audio_video_progress_bar.dart';
import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart';
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
import 'package:PiliPlus/harmony_adapt/status_bar.dart';
import 'package:PiliPlus/models/common/sponsor_block/action_type.dart';
import 'package:PiliPlus/models/common/sponsor_block/post_segment_model.dart';
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
Expand All @@ -44,6 +43,7 @@ import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
import 'package:PiliPlus/plugin/pl_player/models/gesture_type.dart';
import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
import 'package:PiliPlus/plugin/pl_player/models/video_fit_type.dart';
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
import 'package:PiliPlus/plugin/pl_player/widgets/app_bar_ani.dart';
import 'package:PiliPlus/plugin/pl_player/widgets/backward_seek.dart';
import 'package:PiliPlus/plugin/pl_player/widgets/bottom_control.dart';
Expand Down Expand Up @@ -72,8 +72,6 @@ import 'package:easy_debounce/easy_throttle.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:os_type/os_type.dart';
import 'package:screen_brightness_platform_interface/constant/plugin_channel.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'
show RenderProxyBox, SemanticsConfiguration;
Expand All @@ -84,6 +82,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:os_type/os_type.dart';
import 'package:screen_brightness_platform_interface/constant/plugin_channel.dart';
import 'package:screen_brightness_platform_interface/screen_brightness_platform_interface.dart';
import 'package:window_manager/window_manager.dart';

Expand Down Expand Up @@ -971,16 +971,16 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
mainAxisSize: .min,
children: [
if (isFullScreen)
SizedBox(
const SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: '切换状态栏隐藏',
style: const ButtonStyle(
style: ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.zero),
),
onPressed: StatusBar.i.toggleHide,
icon: const Icon(
onPressed: toggleSystemBar,
icon: Icon(
Icons.ad_units,
size: 19,
color: Colors.white,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
# update when release
version: 2.1.0+5573
version: 2.1.0+5579

environment:
sdk: ">=3.11.1"
Expand Down
Loading