This file contains 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 CacheControl extends WidgetsBindingObserver { | |
CacheControl() { | |
WidgetsBinding.instance.addObserver(this); | |
} | |
void _cleanAllCache() { | |
// Cleans all cache. | |
} | |
@override |
This file contains 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
// Hide your app’s key window when your app will resign active. | |
— (void)applicationWillResignActive:(UIApplication *)application { | |
self.window.hidden = YES; | |
} | |
// Show your app’s key window when your app becomes active again. | |
— (void)applicationDidBecomeActive:(UIApplication *)application { | |
self.window.hidden = NO; | |
} |
This file contains 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
- (void)applicationWillResignActive:(UIApplication *)application { | |
UIView *__autoreleasing colorView = | |
[[UIView alloc] initWithFrame:self.window.frame]; | |
// Can be any integer you’re not using as a tag. | |
colorView.tag = 9999; | |
// Here we used white as the subview color. | |
colorView.backgroundColor = [UIColor whiteColor]; | |
[self.window addSubview:colorView]; | |
[self.window bringSubviewToFront:colorView]; |
This file contains 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 MyPage extends StatelessWidget { | |
final int accountId; | |
final int scopeId; | |
MyPage(this.accountId, this.scopeId); | |
Widget build(BuildContext context) { | |
return new MyWidget(accountId, scopeId); | |
} | |
} |
This file contains 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 MyInheritedWidget extends InheritedWidget { | |
final int accountId; | |
final int scopeId; | |
MyInheritedWidget(accountId, scopeId, child): super(child); | |
@override | |
bool updateShouldNotify(MyInheritedWidget old) => | |
accountId != old.accountId || scopeId != old.scopeId; | |
} |
This file contains 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 MyAppContext { | |
int teamId; | |
String teamName; | |
int studentId; | |
String studentName; | |
int classId; | |
... | |
} |
This file contains 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 TeamContext { | |
int teamId; | |
String teamName; | |
} | |
class StudentContext { | |
int studentId; | |
String studentName; | |
} | |
OlderNewer