|
|
|
|
|
|
using Unity.UIWidgets.foundation; |
|
|
|
|
|
|
|
namespace Unity.UIWidgets.widgets { |
|
|
|
public class IconTheme : InheritedWidget { |
|
|
|
public class IconTheme : InheritedTheme { |
|
|
|
public IconTheme( |
|
|
|
Key key = null, |
|
|
|
IconThemeData data = null, |
|
|
|
|
|
|
|
|
|
|
public static IconThemeData of(BuildContext context) { |
|
|
|
IconThemeData iconThemeData = _getInheritedIconThemeData(context); |
|
|
|
return iconThemeData.isConcrete ? iconThemeData : IconThemeData.fallback().merge(iconThemeData); |
|
|
|
return iconThemeData.isConcrete ? iconThemeData : |
|
|
|
iconThemeData.copyWith( |
|
|
|
size: iconThemeData.size ?? IconThemeData.fallback().size, |
|
|
|
color: iconThemeData.color ?? IconThemeData.fallback().color, |
|
|
|
opacity: iconThemeData.opacity ?? IconThemeData.fallback().opacity |
|
|
|
); |
|
|
|
IconTheme iconTheme = (IconTheme) context.inheritFromWidgetOfExactType(typeof(IconTheme)); |
|
|
|
IconTheme iconTheme = (IconTheme) context.dependOnInheritedWidgetOfExactType<IconTheme>(); |
|
|
|
if (iconTheme != null) { |
|
|
|
return iconTheme.data; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|
|
|
base.debugFillProperties(properties); |
|
|
|
properties.add(new DiagnosticsProperty<IconThemeData>("data", data, showName: false)); |
|
|
|
data.debugFillProperties(properties); |
|
|
|
} |
|
|
|
|
|
|
|
public override Widget wrap(BuildContext context, Widget child) { |
|
|
|
IconTheme iconTheme = context.findAncestorWidgetOfExactType<IconTheme>(); |
|
|
|
return this == iconTheme ? child : new IconTheme(data: data, child: child); |
|
|
|
} |
|
|
|
} |
|
|
|
} |