他没有定义参数'bottomSheetTheme'

时间:2019-09-19 14:12:14

标签: flutter themes

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.

0 个答案:

没有答案