您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
913 B
33 行
913 B
using Unity.UIWidgets.foundation;
|
|
using Unity.UIWidgets.widgets;
|
|
|
|
namespace UIWidgetsSample
|
|
{
|
|
public class InheritedL10n : InheritedWidget
|
|
{
|
|
/// Represents localized copy
|
|
public readonly ChatL10n l10n;
|
|
|
|
/// Creates [InheritedWidget] from a provided [ChatL10n] class
|
|
public InheritedL10n(
|
|
ChatL10n l10n,
|
|
Widget child,
|
|
Key key = null
|
|
) : base(key, child)
|
|
{
|
|
this.l10n = l10n;
|
|
}
|
|
|
|
public static InheritedL10n of(BuildContext context)
|
|
{
|
|
return context.dependOnInheritedWidgetOfExactType<InheritedL10n>();
|
|
}
|
|
|
|
public override bool updateShouldNotify(InheritedWidget oldWidget)
|
|
|
|
{
|
|
var test = ((InheritedL10n) oldWidget).l10n;
|
|
return l10n.GetHashCode() != ((InheritedL10n) oldWidget).l10n?.GetHashCode();
|
|
}
|
|
}
|
|
}
|