浏览代码

upgrade theme

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
9faeb501
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. 14
      com.unity.uiwidgets/Runtime/material/theme.cs

14
com.unity.uiwidgets/Runtime/material/theme.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {

static readonly ThemeData _kFallbackTheme = ThemeData.fallback();
public static ThemeData of(BuildContext context, bool shadowThemeOnly = false) {
_InheritedTheme inheritedTheme =
(_InheritedTheme) context.inheritFromWidgetOfExactType(typeof(_InheritedTheme));
_InheritedTheme inheritedTheme = context.dependOnInheritedWidgetOfExactType<_InheritedTheme>();
if (shadowThemeOnly) {
if (inheritedTheme == null || inheritedTheme.theme.isMaterialAppTheme) {
return null;

}
class _InheritedTheme : InheritedWidget {
class _InheritedTheme : InheritedTheme {
public _InheritedTheme(
Key key = null,
Theme theme = null,

public readonly Theme theme;
public override Widget wrap(BuildContext context, Widget child) {
_InheritedTheme ancestorTheme = context.findAncestorWidgetOfExactType<_InheritedTheme>();
return ReferenceEquals(this, ancestorTheme) ? child : new Theme(data: theme.data, child: child);
}
public override bool updateShouldNotify(InheritedWidget old) {
return theme.data != ((_InheritedTheme) old).theme.data;
}

bool isMaterialAppTheme = false,
Curve curve = null,
TimeSpan? duration = null,
VoidCallback onEnd = null,
) : base(key: key, curve: curve ?? Curves.linear, duration: duration ?? ThemeUtils.kThemeAnimationDuration) {
) : base(key: key, curve: curve ?? Curves.linear, duration: duration ?? ThemeUtils.kThemeAnimationDuration, onEnd: onEnd) {
D.assert(child != null);
D.assert(data != null);
this.data = data;

正在加载...
取消
保存