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
0
Merge Requests
0
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
7db82c2d
Commit
7db82c2d
authored
Jan 16, 2020
by
yangwu.jia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.1.61-androidx-hotfixes' into feature/base_flutter_1.12_upgrade_for_androidx
parents
d8137e24
77df599a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
76 additions
and
92 deletions
+76
-92
example/lib/main.dart
example/lib/main.dart
+20
-0
ios/Classes/Boost/FLBFlutterApplicationInterface.h
ios/Classes/Boost/FLBFlutterApplicationInterface.h
+1
-0
ios/Classes/Boost/FlutterBoostPlugin.h
ios/Classes/Boost/FlutterBoostPlugin.h
+13
-2
ios/Classes/Boost/FlutterBoostPlugin.m
ios/Classes/Boost/FlutterBoostPlugin.m
+15
-1
ios/Classes/Engine/FLBFlutterApplication.m
ios/Classes/Engine/FLBFlutterApplication.m
+11
-0
ios/Classes/Engine/FLBFlutterEngine.m
ios/Classes/Engine/FLBFlutterEngine.m
+0
-8
lib/container/boost_container.dart
lib/container/boost_container.dart
+14
-28
lib/container/container_manager.dart
lib/container/container_manager.dart
+0
-51
lib/flutter_boost.dart
lib/flutter_boost.dart
+2
-2
No files found.
example/lib/main.dart
View file @
7db82c2d
...
@@ -29,6 +29,7 @@ class _MyAppState extends State<MyApp> {
...
@@ -29,6 +29,7 @@ class _MyAppState extends State<MyApp> {
return
FlutterRouteWidget
(
params:
params
);
return
FlutterRouteWidget
(
params:
params
);
},
},
});
});
FlutterBoost
.
singleton
.
addBoostNavigatorObserver
(
TestBoostNavigatorObserver
());
}
}
@override
@override
...
@@ -45,3 +46,22 @@ class _MyAppState extends State<MyApp> {
...
@@ -45,3 +46,22 @@ class _MyAppState extends State<MyApp> {
String
pageName
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
_
)
{
String
pageName
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
_
)
{
}
}
}
}
class
TestBoostNavigatorObserver
extends
NavigatorObserver
{
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didPush"
);
}
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didPop"
);
}
void
didRemove
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didRemove"
);
}
void
didReplace
({
Route
<
dynamic
>
newRoute
,
Route
<
dynamic
>
oldRoute
})
{
print
(
"flutterboost#didReplace"
);
}
}
ios/Classes/Boost/FLBFlutterApplicationInterface.h
View file @
7db82c2d
...
@@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
withEngine
:(
FlutterEngine
*
_Nullable
)
engine
withEngine
:(
FlutterEngine
*
_Nullable
)
engine
withPluginRegisterred
:(
BOOL
)
registerPlugin
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
-
(
FlutterViewController
*
)
flutterViewController
;
-
(
FlutterViewController
*
)
flutterViewController
;
...
...
ios/Classes/Boost/FlutterBoostPlugin.h
View file @
7db82c2d
...
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
+
(
instancetype
)
sharedInstance
;
+
(
instancetype
)
sharedInstance
;
/**
/**
* 初始化FlutterBoost混合栈环境。应在程序使用混合栈之前调用。如在AppDelegate中
* 初始化FlutterBoost混合栈环境。应在程序使用混合栈之前调用。如在AppDelegate中
。本函数默认需要flutter boost来注册所有插件。
*
*
* @param platform 平台层实现FLBPlatform的对象
* @param platform 平台层实现FLBPlatform的对象
* @param callback 启动之后回调
* @param callback 启动之后回调
...
@@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
/**
/**
* 初始化FlutterBoost混合栈环境。应在程序使用混合栈之前调用。如在AppDelegate中
* 初始化FlutterBoost混合栈环境。应在程序使用混合栈之前调用。如在AppDelegate中
。本函数默认需要flutter boost来注册所有插件。
*
*
* @param platform 平台层实现FLBPlatform的对象
* @param platform 平台层实现FLBPlatform的对象
* @param engine 外部实例化engine后传入
* @param engine 外部实例化engine后传入
...
@@ -50,6 +50,17 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -50,6 +50,17 @@ NS_ASSUME_NONNULL_BEGIN
engine
:(
FlutterEngine
*
_Nullable
)
engine
engine
:(
FlutterEngine
*
_Nullable
)
engine
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
/**
* 初始化FlutterBoost混合栈环境。应在程序使用混合栈之前调用。如在AppDelegate中。本函数可以控制是否需要flutter boost来注册所有插件
*
* @param platform 平台层实现FLBPlatform的对象
* @param engine 外部实例化engine后传入
* @param callback 启动之后回调
*/
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
engine
:(
FlutterEngine
*
_Nullable
)
engine
pluginRegisterred
:(
BOOL
)
registerPlugin
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
#pragma mark - Some properties.
#pragma mark - Some properties.
-
(
BOOL
)
isRunning
;
-
(
BOOL
)
isRunning
;
...
...
ios/Classes/Boost/FlutterBoostPlugin.m
View file @
7db82c2d
...
@@ -114,13 +114,26 @@
...
@@ -114,13 +114,26 @@
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
{
{
[
self
startFlutterWithPlatform
:
platform
engine
:
nil
onStart
:
callback
];
[
self
startFlutterWithPlatform
:
platform
engine:
nil
pluginRegisterred:
YES
onStart:
callback
];
}
}
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
engine
:(
FlutterEngine
*
_Nullable
)
engine
engine
:(
FlutterEngine
*
_Nullable
)
engine
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
;
{
{
[
self
startFlutterWithPlatform
:
platform
engine:
engine
pluginRegisterred:
YES
onStart:
callback
];
}
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
engine
:(
FlutterEngine
*
)
engine
pluginRegisterred
:(
BOOL
)
registerPlugin
onStart
:(
void
(
^
)(
FlutterEngine
*
_Nonnull
))
callback
{
static
dispatch_once_t
onceToken
;
static
dispatch_once_t
onceToken
;
__weak
__typeof__
(
self
)
weakSelf
=
self
;
__weak
__typeof__
(
self
)
weakSelf
=
self
;
dispatch_once
(
&
onceToken
,
^
{
dispatch_once
(
&
onceToken
,
^
{
...
@@ -129,6 +142,7 @@
...
@@ -129,6 +142,7 @@
self
.
application
=
[
self
->
_factory
createApplication
:
platform
];
self
.
application
=
[
self
->
_factory
createApplication
:
platform
];
[
self
.
application
startFlutterWithPlatform
:
platform
[
self
.
application
startFlutterWithPlatform
:
platform
withEngine:
engine
withEngine:
engine
withPluginRegisterred:
registerPlugin
onStart:
callback
];
onStart:
callback
];
});
});
}
}
...
...
ios/Classes/Engine/FLBFlutterApplication.m
View file @
7db82c2d
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLBPlatform
>
)
platform
withEngine
:(
FlutterEngine
*
_Nullable
)
engine
withEngine
:(
FlutterEngine
*
_Nullable
)
engine
withPluginRegisterred
:(
BOOL
)
registerPlugin
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
onStart
:(
void
(
^
)(
FlutterEngine
*
engine
))
callback
{
{
static
dispatch_once_t
onceToken
;
static
dispatch_once_t
onceToken
;
...
@@ -58,6 +59,16 @@
...
@@ -58,6 +59,16 @@
self
.
platform
=
platform
;
self
.
platform
=
platform
;
self
.
viewProvider
=
[[
FLBFlutterEngine
alloc
]
initWithPlatform
:
platform
engine
:
engine
];
self
.
viewProvider
=
[[
FLBFlutterEngine
alloc
]
initWithPlatform
:
platform
engine
:
engine
];
self
.
isRunning
=
YES
;
self
.
isRunning
=
YES
;
if
(
registerPlugin
){
Class
clazz
=
NSClassFromString
(
@"GeneratedPluginRegistrant"
);
FlutterEngine
*
myengine
=
[
self
.
viewProvider
engine
];
if
(
clazz
&&
myengine
)
{
if
([
clazz
respondsToSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)])
{
[
clazz
performSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)
withObject:
myengine
];
}
}
}
if
(
callback
)
callback
(
self
.
viewProvider
.
engine
);
if
(
callback
)
callback
(
self
.
viewProvider
.
engine
);
});
});
}
}
...
...
ios/Classes/Engine/FLBFlutterEngine.m
View file @
7db82c2d
...
@@ -57,14 +57,6 @@
...
@@ -57,14 +57,6 @@
nibName:
nil
nibName:
nil
bundle:
nil
];
bundle:
nil
];
_dummy
.
name
=
kIgnoreMessageWithName
;
_dummy
.
name
=
kIgnoreMessageWithName
;
Class
clazz
=
NSClassFromString
(
@"GeneratedPluginRegistrant"
);
if
(
clazz
)
{
if
([
clazz
respondsToSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)])
{
[
clazz
performSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)
withObject:
_engine
];
}
}
}
}
return
self
;
return
self
;
...
...
lib/container/boost_container.dart
View file @
7db82c2d
...
@@ -155,14 +155,11 @@ class BoostContainerState extends NavigatorState {
...
@@ -155,14 +155,11 @@ class BoostContainerState extends NavigatorState {
@override
@override
void
didUpdateWidget
(
Navigator
oldWidget
)
{
void
didUpdateWidget
(
Navigator
oldWidget
)
{
super
.
didUpdateWidget
(
oldWidget
);
super
.
didUpdateWidget
(
oldWidget
);
findContainerNavigatorObserver
(
oldWidget
)?.
removeBoostNavigatorObserver
(
FlutterBoost
.
containerManager
.
navigatorObserver
);
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
findContainerNavigatorObserver
(
widget
)?.
removeBoostNavigatorObserver
(
FlutterBoost
.
containerManager
.
navigatorObserver
);
routerHistory
.
clear
();
routerHistory
.
clear
();
super
.
dispose
();
super
.
dispose
();
}
}
...
@@ -261,63 +258,52 @@ class ContainerElement extends StatefulElement {
...
@@ -261,63 +258,52 @@ class ContainerElement extends StatefulElement {
}
}
class
ContainerNavigatorObserver
extends
NavigatorObserver
{
class
ContainerNavigatorObserver
extends
NavigatorObserver
{
BoostNavigatorObserver
observer
;
final
Set
<
BoostNavigatorObserver
>
_
boostObservers
=
static
final
Set
<
NavigatorObserver
>
boostObservers
=
Set
<
Boost
NavigatorObserver
>();
Set
<
NavigatorObserver
>();
ContainerNavigatorObserver
();
ContainerNavigatorObserver
();
factory
ContainerNavigatorObserver
.
bindContainerManager
()
=>
factory
ContainerNavigatorObserver
.
bindContainerManager
()
=>
ContainerNavigatorObserver
()
ContainerNavigatorObserver
();
..
addBoostNavigatorObserver
(
FlutterBoost
.
containerManager
.
navigatorObserver
);
VoidCallback
addBoostNavigatorObserver
(
Boost
NavigatorObserver
observer
)
{
VoidCallback
addBoostNavigatorObserver
(
NavigatorObserver
observer
)
{
_
boostObservers
.
add
(
observer
);
boostObservers
.
add
(
observer
);
return
()
=>
_
boostObservers
.
remove
(
observer
);
return
()
=>
boostObservers
.
remove
(
observer
);
}
}
void
removeBoostNavigatorObserver
(
Boost
NavigatorObserver
observer
)
{
void
removeBoostNavigatorObserver
(
NavigatorObserver
observer
)
{
_
boostObservers
.
remove
(
observer
);
boostObservers
.
remove
(
observer
);
}
}
@override
@override
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
for
(
BoostNavigatorObserver
observer
in
_
boostObservers
)
{
for
(
NavigatorObserver
observer
in
boostObservers
)
{
observer
.
didPush
(
route
,
previousRoute
);
observer
.
didPush
(
route
,
previousRoute
);
}
}
}
}
@override
@override
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
for
(
BoostNavigatorObserver
observer
in
_
boostObservers
)
{
for
(
NavigatorObserver
observer
in
boostObservers
)
{
observer
.
didPop
(
route
,
previousRoute
);
observer
.
didPop
(
route
,
previousRoute
);
}
}
}
}
@override
@override
void
didRemove
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
void
didRemove
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
for
(
BoostNavigatorObserver
observer
in
_
boostObservers
)
{
for
(
NavigatorObserver
observer
in
boostObservers
)
{
observer
.
didRemove
(
route
,
previousRoute
);
observer
.
didRemove
(
route
,
previousRoute
);
}
}
}
}
@override
@override
void
didReplace
({
Route
<
dynamic
>
newRoute
,
Route
<
dynamic
>
oldRoute
})
{
void
didReplace
({
Route
<
dynamic
>
newRoute
,
Route
<
dynamic
>
oldRoute
})
{
for
(
BoostNavigatorObserver
observer
in
_
boostObservers
)
{
for
(
NavigatorObserver
observer
in
boostObservers
)
{
observer
.
didReplace
(
newRoute:
newRoute
,
oldRoute:
oldRoute
);
observer
.
didReplace
(
newRoute:
newRoute
,
oldRoute:
oldRoute
);
}
}
}
}
}
}
class
BoostNavigatorObserver
{
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{}
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{}
void
didRemove
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{}
void
didReplace
({
Route
<
dynamic
>
newRoute
,
Route
<
dynamic
>
oldRoute
})
{}
}
lib/container/container_manager.dart
View file @
7db82c2d
...
@@ -62,8 +62,6 @@ class BoostContainerManager extends StatefulWidget {
...
@@ -62,8 +62,6 @@ class BoostContainerManager extends StatefulWidget {
class
ContainerManagerState
extends
State
<
BoostContainerManager
>
{
class
ContainerManagerState
extends
State
<
BoostContainerManager
>
{
final
GlobalKey
<
OverlayState
>
_overlayKey
=
GlobalKey
<
OverlayState
>();
final
GlobalKey
<
OverlayState
>
_overlayKey
=
GlobalKey
<
OverlayState
>();
final
List
<
BoostContainer
>
_offstage
=
<
BoostContainer
>[];
final
List
<
BoostContainer
>
_offstage
=
<
BoostContainer
>[];
final
ManagerNavigatorObserver
_navigatorObserver
=
ManagerNavigatorObserver
();
List
<
_ContainerOverlayEntry
>
_leastEntries
;
List
<
_ContainerOverlayEntry
>
_leastEntries
;
...
@@ -78,7 +76,6 @@ class ContainerManagerState extends State<BoostContainerManager> {
...
@@ -78,7 +76,6 @@ class ContainerManagerState extends State<BoostContainerManager> {
bool
get
foreground
=>
_foreground
;
bool
get
foreground
=>
_foreground
;
ManagerNavigatorObserver
get
navigatorObserver
=>
_navigatorObserver
;
//Number of containers.
//Number of containers.
int
get
containerCounts
=>
_offstage
.
length
;
int
get
containerCounts
=>
_offstage
.
length
;
...
@@ -347,51 +344,3 @@ class _ContainerOverlayEntry extends OverlayEntry {
...
@@ -347,51 +344,3 @@ class _ContainerOverlayEntry extends OverlayEntry {
}
}
}
}
class
ManagerNavigatorObserver
extends
BoostNavigatorObserver
{
BoostNavigatorObserver
observer
;
final
Set
<
BoostNavigatorObserver
>
_boostObservers
=
Set
<
BoostNavigatorObserver
>();
VoidCallback
addBoostNavigatorObserver
(
BoostNavigatorObserver
observer
)
{
_boostObservers
.
add
(
observer
);
return
()
=>
_boostObservers
.
remove
(
observer
);
}
void
removeBoostNavigatorObserver
(
BoostNavigatorObserver
observer
)
{
_boostObservers
.
remove
(
observer
);
}
@override
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
Logger
.
log
(
'ManagerNavigatorObserver didPush'
);
for
(
BoostNavigatorObserver
observer
in
_boostObservers
)
{
observer
.
didPush
(
route
,
previousRoute
);
}
}
@override
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
Logger
.
log
(
'ManagerNavigatorObserver didPop'
);
for
(
BoostNavigatorObserver
observer
in
_boostObservers
)
{
observer
.
didPop
(
route
,
previousRoute
);
}
}
@override
void
didRemove
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
Logger
.
log
(
'ManagerNavigatorObserver didRemove'
);
for
(
BoostNavigatorObserver
observer
in
_boostObservers
)
{
observer
.
didRemove
(
route
,
previousRoute
);
}
}
@override
void
didReplace
({
Route
<
dynamic
>
newRoute
,
Route
<
dynamic
>
oldRoute
})
{
Logger
.
log
(
'ManagerNavigatorObserver didReplace'
);
for
(
BoostNavigatorObserver
observer
in
_boostObservers
)
{
observer
.
didReplace
(
newRoute:
newRoute
,
oldRoute:
oldRoute
);
}
}
}
lib/flutter_boost.dart
View file @
7db82c2d
...
@@ -189,8 +189,8 @@ class FlutterBoost {
...
@@ -189,8 +189,8 @@ class FlutterBoost {
_observersHolder
.
addObserver
<
BoostContainerLifeCycleObserver
>(
observer
);
_observersHolder
.
addObserver
<
BoostContainerLifeCycleObserver
>(
observer
);
///register callbacks for Navigators push & pop
///register callbacks for Navigators push & pop
VoidCallback
addBoostNavigatorObserver
(
Boost
NavigatorObserver
observer
)
=>
void
addBoostNavigatorObserver
(
NavigatorObserver
observer
)
=>
_observersHolder
.
addObserver
<
BoostNavigatorObserver
>
(
observer
);
ContainerNavigatorObserver
.
boostObservers
.
add
(
observer
);
}
}
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