Commit 74dac2ed authored by 余玠's avatar 余玠

fix #625 on v1.12.13-hotfixes

parent 80d02b98
......@@ -21,6 +21,7 @@ class _MyAppState extends State<MyApp> {
'first': (pageName, params, _) => FirstRouteWidget(),
'firstFirst': (pageName, params, _) => FirstFirstRouteWidget(),
'second': (pageName, params, _) => SecondRouteWidget(),
'secondStateful': (pageName, params, _) => SecondStatefulRouteWidget(),
'tab': (pageName, params, _) => TabRouteWidget(),
'platformView': (pageName, params, _) => PlatformRouteWidget(),
'flutterFragment': (pageName, params, _) => FragmentRouteWidget(params),
......
......@@ -60,7 +60,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget>{
print("open natve page!");
FlutterBoost.singleton.open("native").then((Map value) {
print(
"call me when page is finished. did recieve second route result $value");
"call me when page is finished. did recieve native route result $value");
});
},
),
......@@ -85,6 +85,16 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget>{
},
),
RaisedButton(
child: Text('Present second stateful route'),
onPressed: () {
print("Present second stateful page!");
FlutterBoost.singleton.open("secondStateful",urlParams:<dynamic,dynamic>{"present":true}).then((Map value) {
print(
"call me when page is finished. did recieve second stateful route result $value");
});
},
),
RaisedButton(
child: Text('Present second route'),
onPressed: () {
......@@ -195,7 +205,44 @@ class _EmbededFirstRouteWidgetState extends State<EmbededFirstRouteWidget> {
}
@override
void dispose() {
print('[XDEBUG]:_EmbededFirstRouteWidgetState dispose called!');
print('[XDEBUG]:_EmbededFirstRouteWidgetState disposing~');
super.dispose();
}
}
class SecondStatefulRouteWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return _SecondStatefulRouteWidgetState();
}
}
class _SecondStatefulRouteWidgetState extends State<SecondStatefulRouteWidget>{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("SecondStateful Route"),
),
body: Center(
child: RaisedButton(
onPressed: () {
// Navigate back to first route when tapped.
BoostContainerSettings settings =
BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId,
result: <dynamic,dynamic>{"result": "data from second"});
},
child: Text('Go back with result!'),
),
),
);
}
@override
void dispose() {
print('[XDEBUG]:SecondStatefulRouteWidget disposing~');
super.dispose();
}
}
......@@ -557,6 +604,7 @@ class _PushWidgetState extends State<PushWidget> {
@override
void dispose() {
// TODO: implement dispose
print('[XDEBUG] - PushWidget is disposing~');
super.dispose();
_backPressedListenerUnsub?.call();
}
......
......@@ -232,8 +232,7 @@
NSString *oldName = params[@"oldName"];
NSString *newName = params[@"newName"];
if (oldName!=nil && [newName isEqualToString:@"default"]) {
FLBFlutterViewContainer *viewController = (FLBFlutterViewContainer *)self.flutterProvider.engine.viewController;
[viewController surfaceUpdated:NO];
[self.flutterProvider detach];
}
}
......
......@@ -108,6 +108,7 @@
- (void)detach
{
if(_engine.viewController != _dummy){
[(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
_engine.viewController = _dummy;
}
}
......
......@@ -157,23 +157,33 @@ static NSUInteger kInstanceCounter = 0;
}
- (void)willMoveToParentViewController:(UIViewController *)parent {
if (parent) {
if (parent && _name) {
//当VC将要被移动到Parent中的时候,才出发flutter层面的page init
[BoostMessageChannel didInitPageContainer:^(NSNumber *r) {}
pageName:_name
params:_params
uniqueId:[self uniqueIDString]];
}
[super willMoveToParentViewController:parent];
}
- (void)didMoveToParentViewController:(UIViewController *)parent {
if (!parent) {
//当VC被移出parent时,就通知flutter层销毁page
[self notifyWillDealloc];
}
[super didMoveToParentViewController:parent];
}
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
[super dismissViewControllerAnimated:flag completion:^(){
if (completion) {
completion();
}
//当VC被dismiss时,就通知flutter层销毁page
[self notifyWillDealloc];
[super dismissViewControllerAnimated:flag completion:completion];
}];
}
- (void)dealloc
......
......@@ -102,7 +102,7 @@ class ContainerCoordinator {
Map map = event;
final String type = map['type'];
Logger.log("onEvent $type");
Logger.log('onEvent $type');
switch (type) {
//Handler back key pressed event.
......@@ -242,7 +242,7 @@ class ContainerCoordinator {
ContainerLifeCycle.Appear);
Logger.log(
'native containner did show,\nmanager dump:\n${FlutterBoost.containerManager?.dump()}');
'native containner did show-$name,\nmanager dump:\n${FlutterBoost.containerManager?.dump()}');
return true;
}
......@@ -275,7 +275,7 @@ class ContainerCoordinator {
FlutterBoost.containerManager?.remove(pageId);
Logger.log(
'native containner dealloc, \n manager dump:\n${FlutterBoost.containerManager?.dump()}');
'native containner dealloc for $name, \n manager dump:\n${FlutterBoost.containerManager?.dump()}');
return true;
}
......
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