全局设置
Future<void> main() async {
await GetStorage.init();
// 初始化请求
DioHttp();
// 强制横屏
WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setPreferredOrientations(
[
DeviceOrientation.landscapeLeft, // 横屏 Landscape 模式
DeviceOrientation.landscapeRight,
],
);
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(
//配置透明的状态栏
statusBarColor: Colors.transparent,
// 设置主题为黑色,light:为白色
statusBarIconBrightness: Brightness.dark);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
runApp(const MyApp());
}
作者:南城温港
链接:https://juejin.cn/post/7381811719154712628
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。