SystemUIOverlays
This commit is contained in:
parent
2c9d4626d9
commit
05189114d2
|
@ -76,7 +76,7 @@ VPN->代理->分流, 这三个功能如果同时设置, 您会在您手机的VPN
|
|||
### 开发环境准备
|
||||
|
||||
- [golang](https://golang.org/) (1.16以上版本)
|
||||
- [flutter](https://flutter.dev/) (2.5.3)(flutter不同版本api差异较大,建议使用同样版本)
|
||||
- [flutter](https://flutter.dev/) (2.5.3)(flutter不同版本api差异较大,建议使用临近的版本)
|
||||
|
||||
### 环境配置
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ android {
|
|||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "niuhuan.pikapika"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 31
|
||||
targetSdkVersion 30
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/// 全屏操作
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
@ -15,7 +17,6 @@ enum FullScreenUI {
|
|||
const _propertyName = "fullScreenUI";
|
||||
late FullScreenUI fullScreenUI;
|
||||
|
||||
|
||||
Future<void> initFullScreenUI() async {
|
||||
fullScreenUI = _fullScreenUIFromString(await method.loadProperty(
|
||||
_propertyName,
|
||||
|
@ -67,21 +68,25 @@ void switchFullScreenUI() {
|
|||
list.clear();
|
||||
break;
|
||||
}
|
||||
print(fullScreenUI);
|
||||
SystemChrome.setEnabledSystemUIOverlays(list);
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
SystemChrome.setEnabledSystemUIOverlays(list);
|
||||
}
|
||||
}
|
||||
|
||||
Widget fullScreenUISetting() {
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, void Function(void Function()) setState) {
|
||||
return ListTile(
|
||||
title: Text("全屏UI"),
|
||||
subtitle: Text(currentFullScreenUIName()),
|
||||
onTap: () async {
|
||||
await chooseFullScreenUI(context);
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, void Function(void Function()) setState) {
|
||||
return ListTile(
|
||||
title: Text("全屏UI"),
|
||||
subtitle: Text(currentFullScreenUIName()),
|
||||
onTap: () async {
|
||||
await chooseFullScreenUI(context);
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -216,8 +217,13 @@ class _ComicReaderScreenState extends State<ComicReaderScreen> {
|
|||
|
||||
Future _onFullScreenChange(bool fullScreen) async {
|
||||
setState(() {
|
||||
SystemChrome.setEnabledSystemUIOverlays(
|
||||
fullScreen ? [] : SystemUiOverlay.values);
|
||||
if (fullScreen) {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
SystemChrome.setEnabledSystemUIOverlays([]);
|
||||
}
|
||||
} else {
|
||||
switchFullScreenUI();
|
||||
}
|
||||
_fullScreen = fullScreen;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -198,8 +199,13 @@ class _DownloadReaderScreenState extends State<DownloadReaderScreen> {
|
|||
|
||||
Future _onFullScreenChange(bool fullScreen) async {
|
||||
setState(() {
|
||||
SystemChrome.setEnabledSystemUIOverlays(
|
||||
fullScreen ? [] : SystemUiOverlay.values);
|
||||
if (fullScreen) {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
SystemChrome.setEnabledSystemUIOverlays([]);
|
||||
}
|
||||
} else {
|
||||
switchFullScreenUI();
|
||||
}
|
||||
_fullScreen = fullScreen;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue