Open g-apparence opened 1 year ago
Corrigé comme ceci :
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title;
final IconData icon;
final Color color;
final String routeName;
//final BuildContext context;
const MyAppBar({
Key? key,
required BuildContext context,
required this.title,
required this.icon,
required this.color,
required this.routeName,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return AppBar(
forceMaterialTransparency: true,...
Non vire toute les ref au BuildContext il en reste dans ton constructeur
don't pass context, Context are huge objects and should not be copied along the widget tree