import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_news/utils/sp_util.dart'; /// Description: 全局配置 /// Time : 07/05/2023 Wednesday /// Author : liuyuqi.gov@msn.cn class Config { static late String cachePath; // 设计稿尺寸 static const UI_W = 375.0; static const UI_H = 812.0; static Future init(Function() runApp) async { WidgetsFlutterBinding.ensureInitialized(); // cachePath= await getApplicationDocumentsDirectory().then((value) => value.path); await SpUtil.getInstance(); runApp(); SystemChrome.setPreferredOrientations( [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); // 状态栏透明(Android) var brightness = Platform.isAndroid ? Brightness.dark : Brightness.light; SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarBrightness: brightness, statusBarIconBrightness: brightness, )); } }