您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
55 行
1.8 KiB
55 行
1.8 KiB
using Unity.UIWidgets.foundation;
|
|
|
|
namespace Unity.UIWidgets.widgets {
|
|
public class IconTheme : InheritedWidget {
|
|
public IconTheme(
|
|
Key key = null,
|
|
IconThemeData data = null,
|
|
Widget child = null
|
|
) : base(key: key, child: child) {
|
|
D.assert(data != null);
|
|
D.assert(child != null);
|
|
|
|
this.data = data;
|
|
}
|
|
|
|
public static Widget merge(
|
|
Key key = null,
|
|
IconThemeData data = null,
|
|
Widget child = null
|
|
) {
|
|
return new Builder(
|
|
builder: context => new IconTheme(
|
|
key: key,
|
|
data: _getInheritedIconThemeData(context).merge(data),
|
|
child: child
|
|
)
|
|
);
|
|
}
|
|
|
|
public readonly IconThemeData data;
|
|
|
|
public static IconThemeData of(BuildContext context) {
|
|
IconThemeData iconThemeData = _getInheritedIconThemeData(context);
|
|
return iconThemeData.isConcrete ? iconThemeData : IconThemeData.fallback().merge(iconThemeData);
|
|
}
|
|
|
|
static IconThemeData _getInheritedIconThemeData(BuildContext context) {
|
|
IconTheme iconTheme = (IconTheme) context.inheritFromWidgetOfExactType(typeof(IconTheme));
|
|
if (iconTheme != null) {
|
|
return iconTheme.data;
|
|
}
|
|
|
|
return IconThemeData.fallback();
|
|
}
|
|
|
|
public override bool updateShouldNotify(InheritedWidget oldWidget) {
|
|
return this.data != ((IconTheme) oldWidget).data;
|
|
}
|
|
|
|
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
|
base.debugFillProperties(properties);
|
|
properties.add(new DiagnosticsProperty<IconThemeData>("data", this.data, showName: false));
|
|
}
|
|
}
|
|
}
|