简体   繁体   中英

Deprecated warning on textTheme flutter

I am using flutter 2.5. I wrote following code which gives me deprecated warning in **textTheme** property.

return MaterialApp(
      // home: homePage(),
      themeMode: ThemeMode.light,
      theme: ThemeData(
        primarySwatch: Colors.purple,
        fontFamily: GoogleFonts.lato().fontFamily,
        appBarTheme: AppBarTheme(color: Colors.white,
        elevation: 0,
        iconTheme: IconThemeData(color: Colors.black),
        textTheme: Theme.of(context).textTheme
        )
      ),
      darkTheme:
          ThemeData(brightness: Brightness.dark, primarySwatch: Colors.red),
      debugShowCheckedModeBanner: false,
      initialRoute: MyRoutes.homeRoutes,
      routes: {
        "/": (context) => LoginPage(),
        MyRoutes.homeRoutes: (context) => homePage(),
        MyRoutes.loginRoutes: (context) => LoginPage(),
      },
    );

Some properties of TextTheme were deprecated and changed for another name in Flutter 1.13.8. Maybe you are using old text style properties:

You can find a list of the new properties here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM