using ChatComponents; using Unity.UIWidgets.foundation; using Unity.UIWidgets.widgets; namespace UIWidgetsSample { internal class InheritedUser : InheritedWidget { /// Represents current logged in user. Used to determine message's author. public readonly User user; /// Creates [InheritedWidget] from a provided [types.User] class public InheritedUser( User user, Widget child, Key key = null ) : base(key, child) { this.user = user; } public static InheritedUser of(BuildContext context) { return context.dependOnInheritedWidgetOfExactType(); } public override bool updateShouldNotify(InheritedWidget oldWidget) { var result = user.id != ((InheritedUser) oldWidget).user.id; return result; } } }