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