Add a warning about Icon.size to IconButton (#91051)
This commit is contained in:
parent
bb46cff96e
commit
50604c614e
@ -49,6 +49,26 @@ const double _kMinButtonSize = kMinInteractiveDimension;
|
||||
/// ** See code in examples/api/lib/material/icon_button/icon_button.0.dart **
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// ### Icon sizes
|
||||
///
|
||||
/// When creating an icon button with an [Icon], do not override the
|
||||
/// icon's size with its [Icon.size] parameter, use the icon button's
|
||||
/// [iconSize] parameter instead. For example do this:
|
||||
///
|
||||
/// ```dart
|
||||
/// IconButton(iconSize: 72, icon: Icon(Icons.favorite), ...)
|
||||
/// ```
|
||||
///
|
||||
/// Avoid doing this:
|
||||
///
|
||||
/// ```dart
|
||||
/// IconButton(icon: Icon(Icons.favorite, size: 72), ...)
|
||||
/// ```
|
||||
///
|
||||
/// If you do, the button's size will be based on the default icon
|
||||
/// size, not 72, which may produce unexpected layouts and clipping
|
||||
/// issues.
|
||||
///
|
||||
/// ### Adding a filled background
|
||||
///
|
||||
/// Icon buttons don't support specifying a background color or other
|
||||
|
Loading…
x
Reference in New Issue
Block a user