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 {
if (iconTheme != null) {
iconTheme = new IconThemeData(
opacity: opacity * iconTheme.clampedOpacity,
opacity: opacity * iconTheme.opacity,
color: iconTheme.color
);
}
......
......@@ -76,7 +76,7 @@ class Icon extends StatelessWidget {
if (icon == null)
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);
if (iconOpacity != 1.0)
iconColor = iconColor.withOpacity(iconColor.opacity * iconOpacity);
......
......@@ -12,23 +12,22 @@ import 'dart:ui' show Color, hashValues;
class IconThemeData {
/// Creates an icon theme data.
///
/// The given opacity applies to both explicit and default icon colors.
const IconThemeData({ this.color, this.opacity });
/// The opacity applies to both explicit and default icon colors. The value
/// is clamped between 0.0 and 1.0.
const IconThemeData({ this.color, double opacity: 1.0 }) : _opacity = opacity;
/// The default color for icons.
final Color color;
/// An opacity to apply to both explicit and default icon colors.
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);
double get opacity => (_opacity ?? 1.0).clamp(0.0, 1.0);
final double _opacity;
/// Linearly interpolate between two icon theme data objects.
static IconThemeData lerp(IconThemeData begin, IconThemeData end, double t) {
return new IconThemeData(
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> {
duration: kThemeChangeDuration,
child: new Baseline(
baseline: config.height - _kBaselineOffsetFromBottom,
baselineType: TextBaseline.alphabetic,
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