-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.
Description
Relates to #118216.
This fix allowed users to supply values to appBarTheme.iconTheme and appBarTheme.actionsIconTheme, which would override any theme.iconButtonTheme also set in the theme.
However, this fix only applies to widgets that are directly IconButtons. If, for example, our app bar was defined with these theme overrides:
return Theme(
data: theme.copyWith(
iconButtonTheme: IconButtonThemeData(
style: IconButton.styleFrom(
foregroundColor: Colors.yellow,
),
),
appBarTheme: theme.appBarTheme.copyWith(
actionsIconTheme: actionTheme!.copyWith(color: Colors.blue),
iconTheme: leadingTheme!.copyWith(color: Colors.blue),
),
),
child: Scaffold(
appBar: AppBar(
actions: [
IconButton(
icon: Icon(Icons.favorite),
onPressed: () {},
),
BackButton(), // this takes actionsIconTheme color value as expected
],
leading: BackButton(), // this takes iconButtonTheme color value, not iconTheme
title: Text('title'),
),
body: body,
This is due to app_bar.dart checking for an exact widget type of IconButton before it applies the local theme override. So, it doesn't get applied to widgets like BackButton, or any other custom widget which contains an icon button.
Metadata
Metadata
Assignees
Labels
f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.
