mod: 导航条沉浸
This commit is contained in:
@ -25,9 +25,6 @@ void main() async {
|
|||||||
.then((_) async {
|
.then((_) async {
|
||||||
await GStrorage.init();
|
await GStrorage.init();
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
await Request.setCookie();
|
|
||||||
await Data.init();
|
|
||||||
await GStrorage.lazyInit();
|
|
||||||
// 小白条、导航栏沉浸
|
// 小白条、导航栏沉浸
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
@ -35,6 +32,9 @@ void main() async {
|
|||||||
systemNavigationBarDividerColor: Colors.transparent,
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
));
|
));
|
||||||
|
await Request.setCookie();
|
||||||
|
Data.init();
|
||||||
|
GStrorage.lazyInit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
key: videoDetailController.scaffoldKey,
|
key: videoDetailController.scaffoldKey,
|
||||||
// fix 1px black line
|
// fix 1px black line
|
||||||
// backgroundColor: Colors.transparent,
|
// backgroundColor: Colors.transparent,
|
||||||
backgroundColor: Theme.of(context).colorScheme.background,
|
backgroundColor: Colors.black,
|
||||||
body: ExtendedNestedScrollView(
|
body: ExtendedNestedScrollView(
|
||||||
controller: _extendNestCtr,
|
controller: _extendNestCtr,
|
||||||
headerSliverBuilder:
|
headerSliverBuilder:
|
||||||
@ -162,11 +162,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
forceElevated: innerBoxIsScrolled,
|
forceElevated: innerBoxIsScrolled,
|
||||||
expandedHeight: videoHeight,
|
expandedHeight: videoHeight,
|
||||||
backgroundColor:
|
backgroundColor: Colors.black,
|
||||||
MediaQuery.of(Get.context!).platformBrightness ==
|
|
||||||
Brightness.dark
|
|
||||||
? Colors.black
|
|
||||||
: Theme.of(context).colorScheme.background,
|
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: Padding(
|
background: Padding(
|
||||||
padding: EdgeInsets.only(top: statusBarHeight),
|
padding: EdgeInsets.only(top: statusBarHeight),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
@ -48,12 +49,17 @@ Future<void> enterFullScreen() async {
|
|||||||
//退出全屏显示
|
//退出全屏显示
|
||||||
Future<void> exitFullScreen() async {
|
Future<void> exitFullScreen() async {
|
||||||
dynamic document;
|
dynamic document;
|
||||||
|
late SystemUiMode mode = SystemUiMode.edgeToEdge;
|
||||||
try {
|
try {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
document.exitFullscreen();
|
document.exitFullscreen();
|
||||||
} else if (Platform.isAndroid || Platform.isIOS) {
|
} else if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
if (Platform.isAndroid &&
|
||||||
|
(await DeviceInfoPlugin().androidInfo).version.sdkInt < 29) {
|
||||||
|
mode = SystemUiMode.manual;
|
||||||
|
}
|
||||||
await SystemChrome.setEnabledSystemUIMode(
|
await SystemChrome.setEnabledSystemUIMode(
|
||||||
SystemUiMode.manual,
|
mode,
|
||||||
overlays: SystemUiOverlay.values,
|
overlays: SystemUiOverlay.values,
|
||||||
);
|
);
|
||||||
await SystemChrome.setPreferredOrientations([]);
|
await SystemChrome.setPreferredOrientations([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user