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(); } public override bool updateShouldNotify(InheritedWidget oldWidget) { var result = theme.GetHashCode() != ((InheritedChatTheme) oldWidget).theme.GetHashCode(); return result; } } }