Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_boost_1.22.4
Commits
e82fa6fc
Commit
e82fa6fc
authored
Feb 15, 2020
by
Jim
Committed by
GitHub
Feb 15, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #597 from xujim/master
修正present问题并添加测试用例
parents
ec334dcd
d7d0f159
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
16 deletions
+52
-16
example/lib/simple_page_widgets.dart
example/lib/simple_page_widgets.dart
+27
-9
ios/Classes/Engine/FLBFlutterEngine.m
ios/Classes/Engine/FLBFlutterEngine.m
+7
-7
ios/Classes/container/FLBFlutterViewContainer.m
ios/Classes/container/FLBFlutterViewContainer.m
+18
-0
No files found.
example/lib/simple_page_widgets.dart
View file @
e82fa6fc
...
...
@@ -11,7 +11,12 @@ class FirstRouteWidget extends StatelessWidget {
title:
Text
(
'First Route'
),
),
body:
Center
(
child:
RaisedButton
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
RaisedButton
(
child:
Text
(
'Open second route'
),
onPressed:
()
{
print
(
"open second page!"
);
...
...
@@ -21,6 +26,19 @@ class FirstRouteWidget extends StatelessWidget {
});
},
),
RaisedButton
(
child:
Text
(
'Present second route'
),
onPressed:
()
{
print
(
"Present second page!"
);
FlutterBoost
.
singleton
.
open
(
"second"
,
urlParams:
{
"present"
:
true
}).
then
((
Map
value
)
{
print
(
"call me when page is finished. did recieve second route result
$value
"
);
});
},
),
],
),
),
);
}
...
...
ios/Classes/Engine/FLBFlutterEngine.m
View file @
e82fa6fc
...
...
@@ -53,10 +53,10 @@
}
else
{
[
_engine
runWithEntrypoint
:
nil
];
}
_dummy
=
[[
FLBFlutterViewContainer
alloc
]
initWithEngine
:
_engine
nibName:
nil
bundle:
nil
];
_dummy
.
name
=
kIgnoreMessageWithName
;
//
_dummy = [[FLBFlutterViewContainer alloc] initWithEngine:_engine
//
nibName:nil
//
bundle:nil];
//
_dummy.name = kIgnoreMessageWithName;
}
return
self
;
...
...
@@ -100,7 +100,7 @@
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
{
if
(
_engine
.
viewController
!=
vc
){
[(
FLBFlutterViewContainer
*
)
_engine
.
viewController
surfaceUpdated
:
NO
];
//
[(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
_engine
.
viewController
=
vc
;
}
}
...
...
@@ -114,8 +114,8 @@
-
(
void
)
prepareEngineIfNeeded
{
[(
FLBFlutterViewContainer
*
)
_engine
.
viewController
surfaceUpdated
:
NO
];
NSLog
(
@"[XDEBUG]---surface changed--reset-"
);
//
[(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
//
NSLog(@"[XDEBUG]---surface changed--reset-");
// [self detach];
}
...
...
ios/Classes/container/FLBFlutterViewContainer.m
View file @
e82fa6fc
...
...
@@ -51,6 +51,9 @@
if
(
self
=
[
super
initWithEngine
:
FLUTTER_APP
.
flutterProvider
.
engine
nibName:
_flbNibName
bundle:
_flbNibBundle
]){
//NOTES:在present页面时,默认是全屏,如此可以触发底层VC的页面事件。否则不会触发而导致异常
self
.
modalPresentationStyle
=
UIModalPresentationFullScreen
;
[
self
_setup
];
}
return
self
;
...
...
@@ -219,6 +222,13 @@ static NSUInteger kInstanceCounter = 0;
uniqueId:
self
.
uniqueIDString
];
[[[
UIApplication
sharedApplication
]
keyWindow
]
endEditing
:
YES
];
[
super
viewWillDisappear
:
animated
];
//NOTES:因为UIViewController在present view后dismiss其页面的view disappear会发生在下一个页面view appear之后,从而让当前engine持有的vc inactive,此处可驱使其重新resume
if
(
!
[
self
.
uniqueIDString
isEqualToString
:[(
FLBFlutterViewContainer
*
)
FLUTTER_VC
uniqueIDString
]])
{
[
FLUTTER_APP
resume
];
}
}
...
...
@@ -229,6 +239,14 @@ static NSUInteger kInstanceCounter = 0;
params:
_params
uniqueId:
self
.
uniqueIDString
];
[
super
viewDidDisappear
:
animated
];
//NOTES:因为UIViewController在present view后dismiss其页面的view disappear会发生在下一个页面view appear之后,导致当前engine持有的VC被surfaceUpdate(NO),从而销毁底层的raster。此处是考虑到这种情形,重建surface
if
(
FLUTTER_VC
.
beingPresented
||
self
.
beingDismissed
||
!
[
self
.
uniqueIDString
isEqualToString
:[(
FLBFlutterViewContainer
*
)
FLUTTER_VC
uniqueIDString
]])
{
[
FLUTTER_APP
resume
];
[(
FLBFlutterViewContainer
*
)
FLUTTER_VC
surfaceUpdated
:
YES
];
}
// instead of calling [super viewDidDisappear:animated];, call super's super
// struct objc_super target = {
// .super_class = class_getSuperclass([FlutterViewController class]),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment