Flutter沉浸式状态栏
void main() {
runApp(MyApp());
if (Platform.isAndroid) {
SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
}
Flutter修改状态栏字体颜色
使用AnnotatedRegion包裹Scaffold,可以使得状态栏颜色改变,有dark和light两种
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: Material(child:Scaffold(),),);
}
Flutter修改状态栏字体颜色
appBar: AppBar(
title: Text('input'),
brightness: Brightness.dark // Brightness.light
)
Flutter处理国际化多语言
- 首先要安装插件:Flutter i18n,建立res/values/strings_en.arb文件 编写键值对的JSON即可
- 修改main.dart文件如下:
Flutter intl 实现国际化
1.添加依赖
dependencies:
intl: ^0.16.1
flutter_localizations:
sdk: flutter
2.Android Studio 安装插件 Flutter Intl
3.初始化国际化香蜜
4.配置工程
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
locale: Locale("en"),
supportedLocales: S.delegate.supportedLocales,