diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index aad21e1c0..e952b032c 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -5,6 +5,7 @@ import 'package:PiliPlus/common/widgets/network_img_layer.dart'; import 'package:PiliPlus/common/widgets/tabs.dart'; import 'package:PiliPlus/pages/mine/controller.dart'; import 'package:PiliPlus/utils/app_scheme.dart'; +import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -186,9 +187,7 @@ class _MainAppState extends State value: SystemUiOverlayStyle( systemNavigationBarColor: Colors.transparent, systemNavigationBarIconBrightness: - Theme.of(context).brightness == Brightness.light - ? Brightness.dark - : Brightness.light, // 设置虚拟按键图标颜色 + Theme.of(context).brightness.reverse, // 设置虚拟按键图标颜色 ), child: Scaffold( resizeToAvoidBottomInset: false, diff --git a/lib/pages/video/detail/view_v.dart b/lib/pages/video/detail/view_v.dart index 433daa609..70a63d58d 100644 --- a/lib/pages/video/detail/view_v.dart +++ b/lib/pages/video/detail/view_v.dart @@ -28,6 +28,7 @@ import 'package:easy_debounce/easy_throttle.dart'; import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'; import 'package:floating/floating.dart'; import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_svg/svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -636,25 +637,42 @@ class _VideoDetailPageVState extends State : PreferredSize( preferredSize: Size.fromHeight(0), child: Obx( - () => Stack( - children: [ - AppBar( - backgroundColor: Colors.black, - toolbarHeight: 0, - ), - if (videoDetailController.scrollRatio.value != 0 && - videoDetailController.scrollCtr.offset != 0 && - context.orientation == Orientation.portrait) + () { + bool shouldShow = + videoDetailController.scrollRatio.value != 0 && + videoDetailController.scrollCtr.offset != 0 && + context.orientation == Orientation.portrait; + return Stack( + children: [ AppBar( - backgroundColor: Theme.of(context) - .colorScheme - .surface - .withOpacity( - videoDetailController.scrollRatio.value), + backgroundColor: Colors.black, toolbarHeight: 0, + systemOverlayStyle: shouldShow + ? null + : SystemUiOverlayStyle( + statusBarIconBrightness: Brightness.light, + systemNavigationBarIconBrightness: + Theme.of(context).brightness.reverse, + ), ), - ], - ), + if (shouldShow) + AppBar( + backgroundColor: Theme.of(context) + .colorScheme + .surface + .withOpacity( + videoDetailController.scrollRatio.value), + toolbarHeight: 0, + systemOverlayStyle: SystemUiOverlayStyle( + statusBarIconBrightness: + Theme.of(context).brightness.reverse, + systemNavigationBarIconBrightness: + Theme.of(context).brightness.reverse, + ), + ), + ], + ); + }, ), ), body: ExtendedNestedScrollView( diff --git a/lib/utils/extension.dart b/lib/utils/extension.dart index f364a36d4..f9bca916f 100644 --- a/lib/utils/extension.dart +++ b/lib/utils/extension.dart @@ -115,3 +115,8 @@ extension ColorExtension on Color { return Color.fromARGB(blendedAlpha, blendedRed, blendedGreen, blendedBlue); } } + +extension BrightnessExt on Brightness { + Brightness get reverse => + this == Brightness.light ? Brightness.dark : Brightness.light; +}