今天发现一个问题,我页面在返回的时候,状态栏总是闪一下别的颜色,默认是闪白色,这个颜色设置的地方很好找,在
MaterialApp的theme中进行设置
可是我们发现这地方只能设置其他的颜色,不能设置白色,也不能设置透明,否则就会报错
那么如何设置这个颜色呢?可以在appbartheme 里面设置
return MaterialApp.router(
routeInformationProvider: router.routeInformationProvider,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
appBarTheme: const AppBarTheme(
backgroundColor: Colors.transparent
),
//primarySwatch: Colors.green,
),
builder: FlutterSmartDialog.init(),
//home: const SplashActivity(),
);
这样就不会闪烁啦,而且能随心所欲设置自己喜欢的颜色