【问题标题】:Flutter app, Theme of AppBar deprecated title, used headline6 but not workFlutter 应用,AppBar 的主题已弃用标题,使用了 header6 但不起作用
【发布时间】:2021-11-19 10:28:47
【问题描述】:

使用 appBarTheme 时,headline6 升级版标题不可见。

appBarTheme: Theme.of(context).appBarTheme.copyWith(
              color: AppStyles.naturalBlackColor,
              brightness: Brightness.light,
              elevation: 0,
              textTheme: TextTheme(
                  headline6: TextStyle(
                      color: AppStyles.naturalBlackColor,
                      fontSize: 14,
                      fontWeight: FontWeight.w400)),
            );

【问题讨论】:

    标签: flutter dart themes title appbar


    【解决方案1】:

    你需要在材料应用中添加

    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
         
          theme: ThemeData.dark().copyWith(
            scaffoldBackgroundColor: darkBlue,
            appBarTheme:  Theme.of(context).appBarTheme.copyWith(
                  color: Colors.yellow,//your color
                  brightness: Brightness.light,
                  elevation: 0,
                  textTheme:const TextTheme(
                      headline6: TextStyle(
                          color: Colors.white,//your color
                          fontSize: 14,
                          fontWeight: FontWeight.w400)),
                )
          ),
          debugShowCheckedModeBanner: false,
          home: Scaffold(
            body: Center(
              child: MyWidget(),
            ),
          ),
        );
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-07-07
      • 2020-04-03
      • 2019-11-29
      • 2020-12-24
      • 2018-09-17
      • 1970-01-01
      • 2023-01-08
      • 2020-06-15
      • 1970-01-01
      相关资源
      最近更新 更多