Commit 15d14148 authored by Jim's avatar Jim Committed by GitHub

Merge pull request #622 from sundayman/master

解决iOS hot restart 白屏
parents d8d8529e 73ccc45c
...@@ -179,11 +179,10 @@ static NSUInteger kInstanceCounter = 0; ...@@ -179,11 +179,10 @@ static NSUInteger kInstanceCounter = 0;
params:_params params:_params
uniqueId:self.uniqueIDString]; uniqueId:self.uniqueIDString];
//Save some first time page info. //Save some first time page info.
if(![FlutterBoostPlugin sharedInstance].fPagename){ [FlutterBoostPlugin sharedInstance].fPagename = _name;
[FlutterBoostPlugin sharedInstance].fPagename = _name; [FlutterBoostPlugin sharedInstance].fPageId = self.uniqueIDString;
[FlutterBoostPlugin sharedInstance].fPageId = self.uniqueIDString; [FlutterBoostPlugin sharedInstance].fParams = _params;
[FlutterBoostPlugin sharedInstance].fParams = _params;
}
[super viewWillAppear:animated]; [super viewWillAppear:animated];
[self.view setNeedsLayout]; [self.view setNeedsLayout];
......
...@@ -55,23 +55,34 @@ class FlutterBoost { ...@@ -55,23 +55,34 @@ class FlutterBoost {
static ContainerManagerState get containerManager => static ContainerManagerState get containerManager =>
_instance.containerManagerKey.currentState; _instance.containerManagerKey.currentState;
static void onPageStart() {
WidgetsBinding.instance.addPostFrameCallback((_) {
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo) {
if (pageInfo == null || pageInfo.isEmpty) return;
if (pageInfo.containsKey("name") &&
pageInfo.containsKey("params") &&
pageInfo.containsKey("uniqueId")) {
ContainerCoordinator.singleton.nativeContainerDidShow(
pageInfo["name"], pageInfo["params"], pageInfo["uniqueId"]);
}
});
});
}
static TransitionBuilder init( static TransitionBuilder init(
{TransitionBuilder builder, {TransitionBuilder builder,
PrePushRoute prePush, PrePushRoute prePush,
PostPushRoute postPush}) { PostPushRoute postPush}) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
WidgetsBinding.instance.addPostFrameCallback((_) { onPageStart();
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo) { } else if (Platform.isIOS) {
if (pageInfo == null || pageInfo.isEmpty) return; assert(() {
() async {
if (pageInfo.containsKey("name") && onPageStart();
pageInfo.containsKey("params") && }();
pageInfo.containsKey("uniqueId")) { return true;
ContainerCoordinator.singleton.nativeContainerDidShow( }());
pageInfo["name"], pageInfo["params"], pageInfo["uniqueId"]);
}
});
});
} }
return (BuildContext context, Widget child) { return (BuildContext context, Widget child) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment