systemUiOverlayStyle property

SystemUiOverlayStyle? get systemUiOverlayStyle
inherited

系统UI风格 从当前最近父类开始找

Implementation

SystemUiOverlayStyle? get systemUiOverlayStyle {
  final currentStackLocal = stackLocal;
  final stack = RouteKit.instance.stack;
  if (currentStackLocal > 0 && stack.length - 1 >= currentStackLocal) {
    // 获取上一个
    try {
      final previous = stack[currentStackLocal - 1].child;
      SystemUiOverlayStyle? style;
      if (previous is BaseStatelessPage) {
        style = previous.systemUiOverlayStyle;
      } else if (previous is BaseStatefulPage) {
        style = previous.states.first?.systemUiOverlayStyle;
      }
      if (style != null) return style;
    } catch (error, stack) {
      debugPrint("$error");
      debugPrint("$stack");
    }
  }
  // 默认
  return RouteKit.instance.appConfig.systemUiOverlayStyle ??
      const SystemUiOverlayStyle(
        statusBarBrightness: Brightness.dark,
        statusBarColor: Colors.transparent,
        statusBarIconBrightness: Brightness.light,
        systemNavigationBarColor: Colors.black,
      );
}