Flutter的最新版本从MaterialApp的最顶层隐含了ThemeData中的BottomSheetTheme。
升级后,我在导入类时遇到了问题。
我尝试flutter upgrade
并运行flutter pub get
。
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return InheritedDB(
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
bottomSheetTheme: BottomSheetThemeData(backgroundColor: Colors.transparent),
primaryColor: Colors.white,
primaryTextTheme: TextTheme(
title: TextStyle(
fontWeight: FontWeight.w600,
decoration: TextDecoration.none,
color: Colors.black,
fontSize: 50,
),
subtitle: TextStyle(
fontWeight: FontWeight.w100,
decoration: TextDecoration.none,
color: Colors.black87,
fontSize: 50,
),
headline: TextStyle(
fontWeight: FontWeight.w300,
decoration: TextDecoration.none,
color: Colors.black87,
fontSize: 50,
)),
),
home: HomePage(),
),
);
}
}
错误是:
The named parameter 'bottomSheetTheme' isn't defined.
Try correcting the name to an existing named parameter, or defining a new parameter with this name.