Commit f3b50cf6 by tanghuan

setTitlebar指令,隐藏标题栏时,将状态栏设为透明背景

1 parent f5e5ece6
......@@ -5,6 +5,7 @@ import 'package:appframe/config/env_config.dart';
import 'package:appframe/config/locator.dart';
import 'package:appframe/config/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:shared_preferences/shared_preferences.dart';
......@@ -118,9 +119,20 @@ class WebPage extends StatelessWidget {
: null,
);
final child = state.showAppBar
? scaffold
: AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // 设置状态栏背景透明
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light,
),
child: scaffold,
);
// ios 不使用 PopScope
if (Platform.isIOS) {
return scaffold;
return child;
}
return PopScope(
......@@ -131,7 +143,7 @@ class WebPage extends StatelessWidget {
}
ctx.read<WebCubit>().handleBack();
},
child: scaffold,
child: child,
);
},
listener: (context, state) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!