android patch

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-04 13:49:44 +08:00
parent 7b01c33657
commit f637771527
6 changed files with 16 additions and 602 deletions

View File

@@ -137,7 +137,7 @@ void main() async {
SmartDialog.config.toast = SmartConfigToast(displayType: .onlyRefresh);
if (PlatformUtils.isMobile) {
setEnabledSystemUIMode(.edgeToEdge);
SystemChrome.setEnabledSystemUIMode(.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,

View File

@@ -189,11 +189,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
final isResume = state == .resumed;
final ctr = videoDetailController.plPlayerController..visible = isResume;
if (isResume) {
// TODO: remove
// part of https://github.com/flutter/flutter/issues/186723
if (Platform.isAndroid && !showSystemBar_) {
setEnabledSystemUIMode(.immersiveSticky);
}
if (!ctr.showDanmaku) {
introController.startTimer();
ctr.showDanmaku = true;

View File

@@ -3,12 +3,7 @@ import 'dart:io' show Platform;
import 'package:PiliPlus/utils/device_utils.dart';
import 'package:flutter/services.dart'
show
SystemChrome,
MethodChannel,
SystemUiOverlay,
DeviceOrientation,
SystemUiMode;
show SystemChrome, MethodChannel, SystemUiOverlay, DeviceOrientation;
bool _isDesktopFullScreen = false;
@@ -74,7 +69,7 @@ Future<void>? hideSystemBar() {
return null;
}
_showSystemBar = false;
return setEnabledSystemUIMode(.immersiveSticky);
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
}
//退出全屏显示
@@ -83,35 +78,8 @@ Future<void>? showSystemBar() {
return null;
}
_showSystemBar = true;
return setEnabledSystemUIMode(
return SystemChrome.setEnabledSystemUIMode(
Platform.isAndroid && DeviceUtils.sdkInt < 29 ? .manual : .edgeToEdge,
overlays: SystemUiOverlay.values,
);
}
// TODO: remove
// https://github.com/flutter/flutter/issues/186723
Future<void> setEnabledSystemUIMode(
SystemUiMode mode, {
List<SystemUiOverlay>? overlays,
}) {
if (!Platform.isAndroid) {
return SystemChrome.setEnabledSystemUIMode(mode, overlays: overlays);
}
if (mode != SystemUiMode.manual) {
return const MethodChannel('PiliPlus').invokeMethod(
'SystemChrome.setEnabledSystemUIMode',
{'arguments': mode.toString()},
);
} else {
assert(mode == SystemUiMode.manual && overlays != null);
return const MethodChannel('PiliPlus').invokeMethod(
'SystemChrome.setEnabledSystemUIOverlays',
{'arguments': _stringify(overlays!)},
);
}
}
List<String> _stringify(List<dynamic> list) => <String>[
for (final dynamic item in list) item.toString(),
];

View File

@@ -100,3 +100,15 @@ foreach ($patch in $patches) {
Write-Host "$patch applied"
}
}
# TODO: remove
if ($platform.ToLower() -eq "android") {
git stash
git cherry-pick 625275cfae17b27c9049b0740a9ef67d626b3b1c -X ours
git reset --soft HEAD~1
git stash pop
git restore DEPS
"f84bd039a0692e5cab5383a8de29bc41151a4dfd" | Set-Content -Path .\bin\internal\engine.version
Remove-Item -Path ".\bin\cache" -Recurse -Force
flutter --version
}