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
eb4bb013
Commit
eb4bb013
authored
Apr 01, 2020
by
余玠
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v1.12.13-hotfixes'
parents
43df447c
aef7e019
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
251 additions
and
36 deletions
+251
-36
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
...src/main/java/com/idlefish/flutterboost/FlutterBoost.java
+6
-11
example/ios/Runner/NativeViewController.m
example/ios/Runner/NativeViewController.m
+11
-0
example/lib/main.dart
example/lib/main.dart
+2
-0
example/lib/simple_page_widgets.dart
example/lib/simple_page_widgets.dart
+181
-8
ios/Classes/Boost/FLBFlutterApplicationInterface.h
ios/Classes/Boost/FLBFlutterApplicationInterface.h
+1
-0
ios/Classes/Boost/FLBFlutterProvider.h
ios/Classes/Boost/FLBFlutterProvider.h
+1
-1
ios/Classes/Engine/FLBFlutterApplication.m
ios/Classes/Engine/FLBFlutterApplication.m
+10
-1
ios/Classes/Engine/FLBFlutterEngine.m
ios/Classes/Engine/FLBFlutterEngine.m
+4
-2
ios/Classes/container/FLBFlutterViewContainer.m
ios/Classes/container/FLBFlutterViewContainer.m
+30
-10
lib/container/container_coordinator.dart
lib/container/container_coordinator.dart
+3
-3
lib/container/container_manager.dart
lib/container/container_manager.dart
+2
-0
No files found.
android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java
View file @
eb4bb013
...
@@ -16,12 +16,10 @@ import io.flutter.embedding.engine.dart.DartExecutor;
...
@@ -16,12 +16,10 @@ import io.flutter.embedding.engine.dart.DartExecutor;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.view.FlutterMain
;
import
io.flutter.view.FlutterMain
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
public
class
FlutterBoost
{
public
class
FlutterBoost
{
private
Platform
mPlatform
;
private
Platform
mPlatform
;
private
FlutterViewContainerManager
mManager
;
private
FlutterViewContainerManager
mManager
;
...
@@ -70,7 +68,6 @@ public class FlutterBoost {
...
@@ -70,7 +68,6 @@ public class FlutterBoost {
if
(
mPlatform
.
whenEngineStart
()
==
ConfigBuilder
.
ANY_ACTIVITY_CREATED
)
{
if
(
mPlatform
.
whenEngineStart
()
==
ConfigBuilder
.
ANY_ACTIVITY_CREATED
)
{
doInitialFlutter
();
doInitialFlutter
();
}
}
}
}
@Override
@Override
...
@@ -81,7 +78,7 @@ public class FlutterBoost {
...
@@ -81,7 +78,7 @@ public class FlutterBoost {
if
(
mCurrentActiveActivity
==
null
)
{
if
(
mCurrentActiveActivity
==
null
)
{
Debuger
.
log
(
"Application entry foreground"
);
Debuger
.
log
(
"Application entry foreground"
);
if
(
createEngine
()
!=
null
)
{
if
(
mEngine
!=
null
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"foreground"
);
map
.
put
(
"type"
,
"foreground"
);
channel
().
sendEvent
(
"lifecycle"
,
map
);
channel
().
sendEvent
(
"lifecycle"
,
map
);
...
@@ -113,7 +110,7 @@ public class FlutterBoost {
...
@@ -113,7 +110,7 @@ public class FlutterBoost {
if
(
mCurrentActiveActivity
==
activity
)
{
if
(
mCurrentActiveActivity
==
activity
)
{
Debuger
.
log
(
"Application entry background"
);
Debuger
.
log
(
"Application entry background"
);
if
(
createEngine
()
!=
null
)
{
if
(
mEngine
!=
null
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"background"
);
map
.
put
(
"type"
,
"background"
);
channel
().
sendEvent
(
"lifecycle"
,
map
);
channel
().
sendEvent
(
"lifecycle"
,
map
);
...
@@ -137,7 +134,7 @@ public class FlutterBoost {
...
@@ -137,7 +134,7 @@ public class FlutterBoost {
if
(
mCurrentActiveActivity
==
activity
)
{
if
(
mCurrentActiveActivity
==
activity
)
{
Debuger
.
log
(
"Application entry background"
);
Debuger
.
log
(
"Application entry background"
);
if
(
createEngine
()
!=
null
)
{
if
(
mEngine
!=
null
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"background"
);
map
.
put
(
"type"
,
"background"
);
channel
().
sendEvent
(
"lifecycle"
,
map
);
channel
().
sendEvent
(
"lifecycle"
,
map
);
...
@@ -158,9 +155,9 @@ public class FlutterBoost {
...
@@ -158,9 +155,9 @@ public class FlutterBoost {
}
}
public
void
doInitialFlutter
()
{
public
void
doInitialFlutter
()
{
if
(
mEngine
!=
null
)
{
return
;
if
(
mEngine
!=
null
)
return
;
}
if
(
mPlatform
.
lifecycleListener
!=
null
)
{
if
(
mPlatform
.
lifecycleListener
!=
null
)
{
mPlatform
.
lifecycleListener
.
beforeCreateEngine
();
mPlatform
.
lifecycleListener
.
beforeCreateEngine
();
...
@@ -182,7 +179,6 @@ public class FlutterBoost {
...
@@ -182,7 +179,6 @@ public class FlutterBoost {
);
);
flutterEngine
.
getDartExecutor
().
executeDartEntrypoint
(
entrypoint
);
flutterEngine
.
getDartExecutor
().
executeDartEntrypoint
(
entrypoint
);
}
}
...
@@ -318,7 +314,6 @@ public class FlutterBoost {
...
@@ -318,7 +314,6 @@ public class FlutterBoost {
private
FlutterEngine
createEngine
()
{
private
FlutterEngine
createEngine
()
{
if
(
mEngine
==
null
)
{
if
(
mEngine
==
null
)
{
FlutterMain
.
startInitialization
(
mPlatform
.
getApplication
());
FlutterMain
.
startInitialization
(
mPlatform
.
getApplication
());
FlutterShellArgs
flutterShellArgs
=
new
FlutterShellArgs
(
new
String
[
0
]);
FlutterShellArgs
flutterShellArgs
=
new
FlutterShellArgs
(
new
String
[
0
]);
...
...
example/ios/Runner/NativeViewController.m
View file @
eb4bb013
...
@@ -51,6 +51,13 @@
...
@@ -51,6 +51,13 @@
// [self.flutterContainer.view setNeedsLayout];
// [self.flutterContainer.view setNeedsLayout];
// [self.flutterContainer.view layoutIfNeeded];
// [self.flutterContainer.view layoutIfNeeded];
}
}
//NOTES: embed情景下必须实现!!!
-
(
void
)
didMoveToParentViewController
:(
UIViewController
*
)
parent
{
[
self
.
flutterContainer
didMoveToParentViewController
:
parent
];
[
super
didMoveToParentViewController
:
parent
];
}
/*
/*
#pragma mark - Navigation
#pragma mark - Navigation
...
@@ -61,4 +68,8 @@
...
@@ -61,4 +68,8 @@
}
}
*/
*/
-
(
void
)
dealloc
{
NSLog
(
@"dealloc native controller%p"
,
self
.
flutterContainer
);
}
@end
@end
example/lib/main.dart
View file @
eb4bb013
...
@@ -19,7 +19,9 @@ class _MyAppState extends State<MyApp> {
...
@@ -19,7 +19,9 @@ class _MyAppState extends State<MyApp> {
FlutterBoost
.
singleton
.
registerPageBuilders
({
FlutterBoost
.
singleton
.
registerPageBuilders
({
'embeded'
:
(
pageName
,
params
,
_
)=>
EmbededFirstRouteWidget
(),
'embeded'
:
(
pageName
,
params
,
_
)=>
EmbededFirstRouteWidget
(),
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'firstFirst'
:
(
pageName
,
params
,
_
)
=>
FirstFirstRouteWidget
(),
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
'secondStateful'
:
(
pageName
,
params
,
_
)
=>
SecondStatefulRouteWidget
(),
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'platformView'
:
(
pageName
,
params
,
_
)
=>
PlatformRouteWidget
(),
'platformView'
:
(
pageName
,
params
,
_
)
=>
PlatformRouteWidget
(),
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
...
...
example/lib/simple_page_widgets.dart
100755 → 100644
View file @
eb4bb013
...
@@ -3,7 +3,45 @@ import 'package:flutter/material.dart';
...
@@ -3,7 +3,45 @@ import 'package:flutter/material.dart';
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter_boost_example/platform_view.dart'
;
import
'package:flutter_boost_example/platform_view.dart'
;
class
FirstRouteWidget
extends
StatelessWidget
{
class
FirstRouteWidget
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
{
return
new
_FirstRouteWidgetState
();
}
}
class
_FirstRouteWidgetState
extends
State
<
FirstRouteWidget
>{
_FirstRouteWidgetState
();
@override
void
initState
()
{
print
(
'initState'
);
super
.
initState
();
}
@override
void
didChangeDependencies
()
{
print
(
'didChangeDependencies'
);
super
.
didChangeDependencies
();
}
@override
void
didUpdateWidget
(
FirstRouteWidget
oldWidget
)
{
print
(
'didUpdateWidget'
);
super
.
didUpdateWidget
(
oldWidget
);
}
@override
void
deactivate
()
{
print
(
'deactivate'
);
super
.
deactivate
();
}
@override
void
dispose
()
{
print
(
'[XDEBUG] - FirstRouteWidget is disposing~'
);
super
.
dispose
();
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
...
@@ -22,13 +60,22 @@ class FirstRouteWidget extends StatelessWidget {
...
@@ -22,13 +60,22 @@ class FirstRouteWidget extends StatelessWidget {
print
(
"open natve page!"
);
print
(
"open natve page!"
);
FlutterBoost
.
singleton
.
open
(
"native"
).
then
((
Map
value
)
{
FlutterBoost
.
singleton
.
open
(
"native"
).
then
((
Map
value
)
{
print
(
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
"
);
});
});
},
},
),
),
RaisedButton
(
RaisedButton
(
child:
Text
(
'Open second route'
),
child:
Text
(
'Open FF route'
),
onPressed:
()
{
print
(
"open FF page!"
);
FlutterBoost
.
singleton
.
open
(
"firstFirst"
).
then
((
Map
value
)
{
print
(
"call me when page is finished. did recieve FF route result
$value
"
);
});
},
),
RaisedButton
(
child:
Text
(
'Open second route1'
),
onPressed:
()
{
onPressed:
()
{
print
(
"open second page!"
);
print
(
"open second page!"
);
FlutterBoost
.
singleton
.
open
(
"second"
).
then
((
Map
value
)
{
FlutterBoost
.
singleton
.
open
(
"second"
).
then
((
Map
value
)
{
...
@@ -38,6 +85,16 @@ class FirstRouteWidget extends StatelessWidget {
...
@@ -38,6 +85,16 @@ class FirstRouteWidget extends StatelessWidget {
},
},
),
),
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
(
RaisedButton
(
child:
Text
(
'Present second route'
),
child:
Text
(
'Present second route'
),
onPressed:
()
{
onPressed:
()
{
...
@@ -54,14 +111,87 @@ class FirstRouteWidget extends StatelessWidget {
...
@@ -54,14 +111,87 @@ class FirstRouteWidget extends StatelessWidget {
);
);
}
}
}
}
class
FirstFirstRouteWidget
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
{
return
new
_FirstFirstRouteWidgetState
();
}
}
class
_FirstFirstRouteWidgetState
extends
State
<
FirstFirstRouteWidget
>{
_FirstFirstRouteWidgetState
();
@override
void
initState
()
{
print
(
'initState'
);
super
.
initState
();
}
@override
void
didChangeDependencies
()
{
print
(
'didChangeDependencies'
);
super
.
didChangeDependencies
();
}
@override
void
didUpdateWidget
(
FirstFirstRouteWidget
oldWidget
)
{
print
(
'didUpdateWidget'
);
super
.
didUpdateWidget
(
oldWidget
);
}
@override
void
deactivate
()
{
print
(
'deactivate'
);
super
.
deactivate
();
}
@override
void
dispose
()
{
print
(
'[XDEBUG] - FirstFirstRouteWidget is disposing~'
);
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'First Route'
),
),
body:
Center
(
child:
RaisedButton
(
child:
Text
(
'Open first route'
),
onPressed:
()
{
print
(
"open first page again!"
);
FlutterBoost
.
singleton
.
open
(
"first"
).
then
((
Map
value
){
print
(
"did recieve first route result"
);
print
(
"did recieve first route result
$value
"
);
});
},
),
),
);
}
}
class
EmbededFirstRouteWidget
extends
StatelessWidget
{
class
EmbededFirstRouteWidget
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
{
// TODO: implement createState
return
_EmbededFirstRouteWidgetState
();
}
}
class
_EmbededFirstRouteWidgetState
extends
State
<
EmbededFirstRouteWidget
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
print
(
'_EmbededFirstRouteWidgetState build called!'
);
return
Scaffold
(
return
Scaffold
(
body:
Center
(
body:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
child:
Text
(
'Open second route'
),
child:
Text
(
'Open second route
2
'
),
onPressed:
()
{
onPressed:
()
{
print
(
"open second page!"
);
print
(
"open second page!"
);
FlutterBoost
.
singleton
.
open
(
"second"
).
then
((
Map
value
)
{
FlutterBoost
.
singleton
.
open
(
"second"
).
then
((
Map
value
)
{
...
@@ -73,6 +203,48 @@ class EmbededFirstRouteWidget extends StatelessWidget {
...
@@ -73,6 +203,48 @@ class EmbededFirstRouteWidget extends StatelessWidget {
),
),
);
);
}
}
@override
void
dispose
()
{
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
();
}
}
}
class
SecondRouteWidget
extends
StatelessWidget
{
class
SecondRouteWidget
extends
StatelessWidget
{
...
@@ -111,7 +283,7 @@ class TabRouteWidget extends StatelessWidget {
...
@@ -111,7 +283,7 @@ class TabRouteWidget extends StatelessWidget {
onPressed:
()
{
onPressed:
()
{
FlutterBoost
.
singleton
.
open
(
"second"
);
FlutterBoost
.
singleton
.
open
(
"second"
);
},
},
child:
Text
(
'Open second route'
),
child:
Text
(
'Open second route
3
'
),
),
),
),
),
);
);
...
@@ -432,6 +604,7 @@ class _PushWidgetState extends State<PushWidget> {
...
@@ -432,6 +604,7 @@ class _PushWidgetState extends State<PushWidget> {
@override
@override
void
dispose
()
{
void
dispose
()
{
// TODO: implement dispose
// TODO: implement dispose
print
(
'[XDEBUG] - PushWidget is disposing~'
);
super
.
dispose
();
super
.
dispose
();
_backPressedListenerUnsub
?.
call
();
_backPressedListenerUnsub
?.
call
();
}
}
...
...
ios/Classes/Boost/FLBFlutterApplicationInterface.h
View file @
eb4bb013
...
@@ -66,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -66,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
onPageFinished
:(
void
(
^
)(
NSDictionary
*
))
resultCallback
onPageFinished
:(
void
(
^
)(
NSDictionary
*
))
resultCallback
completion
:(
void
(
^
)(
BOOL
))
completion
;
completion
:(
void
(
^
)(
BOOL
))
completion
;
-
(
void
)
attachToPreviousContainer
;
-
(
void
)
didInitPageContainer
:(
NSString
*
)
url
-
(
void
)
didInitPageContainer
:(
NSString
*
)
url
params
:(
NSDictionary
*
)
urlParams
params
:(
NSDictionary
*
)
urlParams
...
...
ios/Classes/Boost/FLBFlutterProvider.h
View file @
eb4bb013
...
@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol
FLBFlutterProvider
<
NSObject
>
@protocol
FLBFlutterProvider
<
NSObject
>
@required
@required
-
(
FlutterEngine
*
)
engine
;
-
(
FlutterEngine
*
)
engine
;
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
;
-
(
BOOL
)
atacheToViewController
:(
FlutterViewController
*
)
vc
;
-
(
void
)
detach
;
-
(
void
)
detach
;
-
(
void
)
prepareEngineIfNeeded
;
-
(
void
)
prepareEngineIfNeeded
;
-
(
void
)
pause
;
-
(
void
)
pause
;
...
...
ios/Classes/Engine/FLBFlutterApplication.m
View file @
eb4bb013
...
@@ -26,10 +26,12 @@
...
@@ -26,10 +26,12 @@
#import "FlutterBoost.h"
#import "FlutterBoost.h"
#import "FLBFlutterContainerManager.h"
#import "FLBFlutterContainerManager.h"
#import "FLBFlutterEngine.h"
#import "FLBFlutterEngine.h"
#import "FLBFlutterViewContainer.h"
@interface
FLBFlutterApplication
()
@interface
FLBFlutterApplication
()
@property
(
nonatomic
,
strong
)
FLBFlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
FLBFlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
id
<
FLBFlutterProvider
>
viewProvider
;
@property
(
nonatomic
,
strong
)
id
<
FLBFlutterProvider
>
viewProvider
;
@property
(
nonatomic
,
weak
,
readonly
)
FlutterViewController
*
previousViewController
;
@property
(
nonatomic
,
assign
)
BOOL
isRunning
;
@property
(
nonatomic
,
assign
)
BOOL
isRunning
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
pageResultCallbacks
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
pageResultCallbacks
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
callbackCache
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
callbackCache
;
...
@@ -156,6 +158,13 @@
...
@@ -156,6 +158,13 @@
return
self
.
flutterProvider
.
engine
.
viewController
;
return
self
.
flutterProvider
.
engine
.
viewController
;
}
}
-
(
void
)
attachToPreviousContainer
{
if
([
self
.
viewProvider
atacheToViewController
:
self
.
previousViewController
]){
[
self
.
previousViewController
.
view
setNeedsLayout
];
[(
FLBFlutterViewContainer
*
)
self
.
previousViewController
surfaceUpdated
:
YES
];
}
}
-
(
void
)
close
:(
NSString
*
)
uniqueId
-
(
void
)
close
:(
NSString
*
)
uniqueId
result
:(
NSDictionary
*
)
resultData
result
:(
NSDictionary
*
)
resultData
exts
:(
NSDictionary
*
)
exts
exts
:(
NSDictionary
*
)
exts
...
@@ -189,7 +198,7 @@
...
@@ -189,7 +198,7 @@
[
newParams
setObject
:
cid
?
cid
:
@"__default#0__"
forKey
:
kPageCallBackId
];
[
newParams
setObject
:
cid
?
cid
:
@"__default#0__"
forKey
:
kPageCallBackId
];
urlParams
=
newParams
;
urlParams
=
newParams
;
}
}
_previousViewController
=
[
self
flutterViewController
];
_callbackCache
[
cid
]
=
resultCallback
;
_callbackCache
[
cid
]
=
resultCallback
;
if
([
urlParams
[
@"present"
]
respondsToSelector
:
@selector
(
boolValue
)]
&&
[
urlParams
[
@"present"
]
boolValue
]
&&
[
self
.
platform
respondsToSelector
:
@selector
(
present
:
urlParams
:
exts
:
completion
:
)]){
if
([
urlParams
[
@"present"
]
respondsToSelector
:
@selector
(
boolValue
)]
&&
[
urlParams
[
@"present"
]
boolValue
]
&&
[
self
.
platform
respondsToSelector
:
@selector
(
present
:
urlParams
:
exts
:
completion
:
)]){
[
self
.
platform
present
:
url
[
self
.
platform
present
:
url
...
...
ios/Classes/Engine/FLBFlutterEngine.m
View file @
eb4bb013
...
@@ -97,17 +97,19 @@
...
@@ -97,17 +97,19 @@
arguments:
@{
@"type"
:
@"foreground"
}];
arguments:
@{
@"type"
:
@"foreground"
}];
}
}
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
-
(
BOOL
)
atacheToViewController
:(
FlutterViewController
*
)
vc
{
{
if
(
_engine
.
viewController
!=
vc
){
if
(
_engine
.
viewController
!=
vc
){
// [(FLBFlutterViewContainer *)_engine.viewController surfaceUpdated:NO];
_engine
.
viewController
=
vc
;
_engine
.
viewController
=
vc
;
return
YES
;
}
}
return
NO
;
}
}
-
(
void
)
detach
-
(
void
)
detach
{
{
if
(
_engine
.
viewController
!=
_dummy
){
if
(
_engine
.
viewController
!=
_dummy
){
[(
FLBFlutterViewContainer
*
)
_engine
.
viewController
surfaceUpdated
:
NO
];
_engine
.
viewController
=
_dummy
;
_engine
.
viewController
=
_dummy
;
}
}
}
}
...
...
ios/Classes/container/FLBFlutterViewContainer.m
View file @
eb4bb013
...
@@ -118,10 +118,6 @@
...
@@ -118,10 +118,6 @@
if
(
!
_name
&&
name
){
if
(
!
_name
&&
name
){
_name
=
name
;
_name
=
name
;
_params
=
params
;
_params
=
params
;
[
BoostMessageChannel
didInitPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
name
params:
params
uniqueId:
[
self
uniqueIDString
]];
}
}
}
}
...
@@ -160,9 +156,38 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -160,9 +156,38 @@ static NSUInteger kInstanceCounter = 0;
[
self
.
class
instanceCounterIncrease
];
[
self
.
class
instanceCounterIncrease
];
}
}
-
(
void
)
willMoveToParentViewController
:(
UIViewController
*
)
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
];
}];
}
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
[
self
notifyWillDealloc
];
[
NSNotificationCenter
.
defaultCenter
removeObserver
:
self
];
[
NSNotificationCenter
.
defaultCenter
removeObserver
:
self
];
}
}
...
@@ -262,11 +287,6 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -262,11 +287,6 @@ static NSUInteger kInstanceCounter = 0;
pageName:
_name
pageName:
_name
params:
_params
params:
_params
uniqueId:
self
.
uniqueIDString
];
uniqueId:
self
.
uniqueIDString
];
//如果当前不可见vc和engine所持有的vc一致。在FlutterVC在混合栈中是最后一张页面,如tab中的页面
// if (self == FLUTTER_VC)
// {
// [self surfaceUpdated:NO];
// }
[
super
bridge_viewDidDisappear
:
animated
];
[
super
bridge_viewDidDisappear
:
animated
];
}
}
...
...
lib/container/container_coordinator.dart
View file @
eb4bb013
...
@@ -102,7 +102,7 @@ class ContainerCoordinator {
...
@@ -102,7 +102,7 @@ class ContainerCoordinator {
Map
map
=
event
;
Map
map
=
event
;
final
String
type
=
map
[
'type'
];
final
String
type
=
map
[
'type'
];
Logger
.
log
(
"onEvent
$type
"
);
Logger
.
log
(
'onEvent
$type
'
);
switch
(
type
)
{
switch
(
type
)
{
//Handler back key pressed event.
//Handler back key pressed event.
...
@@ -242,7 +242,7 @@ class ContainerCoordinator {
...
@@ -242,7 +242,7 @@ class ContainerCoordinator {
ContainerLifeCycle
.
Appear
);
ContainerLifeCycle
.
Appear
);
Logger
.
log
(
Logger
.
log
(
'native containner did show,
\n
manager dump:
\n
${FlutterBoost.containerManager?.dump()}
'
);
'native containner did show
-
$name
,
\n
manager dump:
\n
${FlutterBoost.containerManager?.dump()}
'
);
return
true
;
return
true
;
}
}
...
@@ -275,7 +275,7 @@ class ContainerCoordinator {
...
@@ -275,7 +275,7 @@ class ContainerCoordinator {
FlutterBoost
.
containerManager
?.
remove
(
pageId
);
FlutterBoost
.
containerManager
?.
remove
(
pageId
);
Logger
.
log
(
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
;
return
true
;
}
}
...
...
lib/container/container_manager.dart
View file @
eb4bb013
...
@@ -183,9 +183,11 @@ class ContainerManagerState extends State<BoostContainerManager> {
...
@@ -183,9 +183,11 @@ class ContainerManagerState extends State<BoostContainerManager> {
if
(
SchedulerBinding
.
instance
.
schedulerPhase
==
if
(
SchedulerBinding
.
instance
.
schedulerPhase
==
SchedulerPhase
.
persistentCallbacks
)
{
SchedulerPhase
.
persistentCallbacks
)
{
SchedulerBinding
.
instance
.
addPostFrameCallback
((
Duration
duration
)
{
SchedulerBinding
.
instance
.
addPostFrameCallback
((
Duration
duration
)
{
Logger
.
log
(
'_refreshOverlayEntries in addPostFrameCallback'
);
_refreshOverlayEntries
();
_refreshOverlayEntries
();
});
});
}
else
{
}
else
{
Logger
.
log
(
'_refreshOverlayEntries in setState'
);
_refreshOverlayEntries
();
_refreshOverlayEntries
();
}
}
...
...
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