FlutterをアップグレードしたらAppBarが消えた?
AppleのPrivacy Manifest対応をするべく、色々ライブラリをアップグレードする中で、Flutterも3.19.0にアップグレードしました。すると、AppBarがなくなり、Floating Action Buttonも紫になってしまいました。あれれ。
直し方
ThemeDataに useMaterial3: false
を追加するだけで直りました。
main.dart
return MaterialApp(
title: 'Yamori memo',
theme: ThemeData(
primarySwatch: AppColors.mainBackColorMaterial,
appBarTheme: AppBarTheme(
//略
)),
),
textTheme: GoogleFonts.kiwiMaruTextTheme(
Theme.of(context).textTheme,
),
+ useMaterial3: false,
),
原因
3.10からの Material3対応 によって色が変わってしまったためのようです。
Flutterさんが推奨しているなら、Material Designに寄せたいですが、他に優先したいことがあるので、ひとまずこれでしのぎます。
参考
https://medium.com/flutter/whats-new-in-flutter-3-10-b21db2c38c73
https://zenn.dev/team_soda/articles/ee134cc5ff7368#colorscheme.fromimageprovider()
https://flutter.salon/flutter/material3color/
https://zenn.dev/enoiu/articles/6b754d37d5a272