flutter 3.44 pre

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-14 21:48:25 +08:00
parent 3c6d4ef08c
commit cf2877b77c
34 changed files with 1173 additions and 329 deletions

View File

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