我想设置LicensePage除某些颜色之外的每个屏幕的背景颜色,因此我scaffoldBackbroundColor通过如下theme参数指定了。MaterialApp
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(scaffoldBackgroundColor: Colors.blue.shade200),
home: HomeScreen(),
);
}
}
Run Code Online (Sandbox Code Playgroud)
这也会更改许可证页面的背景颜色,因此为了将其改回白色,我尝试覆盖scaffoldBackbroundColor,但它不起作用。
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Theme(
data: Theme.of(context).copyWith(scaffoldBackgroundColor: Colors.white),
child: Center(
child: RaisedButton(
child: const Text('Show licenses'),
onPressed: () => showLicensePage(context: context),
),
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做?