Commit a6532cc7 authored by Hans Muller's avatar Hans Muller

Remove IconThemeData.clampedOpacity (#3483)

* Remove IconThemeData.clampedOpacity
parent c167efca
...@@ -191,7 +191,7 @@ class AppBar extends StatelessWidget { ...@@ -191,7 +191,7 @@ class AppBar extends StatelessWidget {
if (iconTheme != null) { if (iconTheme != null) {
iconTheme = new IconThemeData( iconTheme = new IconThemeData(
opacity: opacity * iconTheme.clampedOpacity, opacity: opacity * iconTheme.opacity,
color: iconTheme.color color: iconTheme.color
); );
} }
......
...@@ -76,7 +76,7 @@ class Icon extends StatelessWidget { ...@@ -76,7 +76,7 @@ class Icon extends StatelessWidget {
if (icon == null) if (icon == null)
return new SizedBox(width: size, height: size); return new SizedBox(width: size, height: size);
final double iconOpacity = IconTheme.of(context)?.clampedOpacity ?? 1.0; final double iconOpacity = IconTheme.of(context)?.opacity ?? 1.0;
Color iconColor = color ?? _getDefaultColor(context); Color iconColor = color ?? _getDefaultColor(context);
if (iconOpacity != 1.0) if (iconOpacity != 1.0)
iconColor = iconColor.withOpacity(iconColor.opacity * iconOpacity); iconColor = iconColor.withOpacity(iconColor.opacity * iconOpacity);
......
...@@ -12,23 +12,22 @@ import 'dart:ui' show Color, hashValues; ...@@ -12,23 +12,22 @@ import 'dart:ui' show Color, hashValues;
class IconThemeData { class IconThemeData {
/// Creates an icon theme data. /// Creates an icon theme data.
/// ///
/// The given opacity applies to both explicit and default icon colors. /// The opacity applies to both explicit and default icon colors. The value
const IconThemeData({ this.color, this.opacity }); /// is clamped between 0.0 and 1.0.
const IconThemeData({ this.color, double opacity: 1.0 }) : _opacity = opacity;
/// The default color for icons. /// The default color for icons.
final Color color; final Color color;
/// An opacity to apply to both explicit and default icon colors. /// An opacity to apply to both explicit and default icon colors.
final double opacity; double get opacity => (_opacity ?? 1.0).clamp(0.0, 1.0);
final double _opacity;
/// Normalizes the given opacity to be between 0.0 and 1.0 (inclusive).
double get clampedOpacity => (opacity ?? 1.0).clamp(0.0, 1.0);
/// Linearly interpolate between two icon theme data objects. /// Linearly interpolate between two icon theme data objects.
static IconThemeData lerp(IconThemeData begin, IconThemeData end, double t) { static IconThemeData lerp(IconThemeData begin, IconThemeData end, double t) {
return new IconThemeData( return new IconThemeData(
color: Color.lerp(begin.color, end.color, t), color: Color.lerp(begin.color, end.color, t),
opacity: ui.lerpDouble(begin.clampedOpacity, end.clampedOpacity, t) opacity: ui.lerpDouble(begin.opacity, end.opacity, t)
); );
} }
......
...@@ -96,6 +96,7 @@ class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> { ...@@ -96,6 +96,7 @@ class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> {
duration: kThemeChangeDuration, duration: kThemeChangeDuration,
child: new Baseline( child: new Baseline(
baseline: config.height - _kBaselineOffsetFromBottom, baseline: config.height - _kBaselineOffsetFromBottom,
baselineType: TextBaseline.alphabetic,
child: buildChild() child: buildChild()
) )
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment