Last active
September 20, 2018 07:57
-
-
Save raveesh-me/a191ead0609810b04216af186b4075a1 to your computer and use it in GitHub Desktop.
UserInfoManager InheritedWidget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserInfoManager extends InheritedWidget { | |
final Key key; | |
final ManagedUserInfo managedUserInfo; | |
final Widget child; | |
final Function() refreshManagedUserInfo; | |
UserInfoManager( | |
{@required this.managedUserInfo, | |
@required this.child, | |
@required this.setManagedUserInfo, | |
this.key}) | |
: super(key: key, child: child); | |
@override | |
bool updateShouldNotify(UserInfoManager oldWidget) { | |
return oldWidget.managedUserInfo.appLoginState == | |
managedUserInfo.appLoginState; | |
} | |
static UserInfoManager of(BuildContext context) => | |
context.inheritFromWidgetOfExactType(UserInfoManager); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment