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
a5a01532
Commit
a5a01532
authored
Jan 06, 2020
by
justin
Committed by
GitHub
Jan 06, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #556 from sundayman/master
解决iOS hot restart 白屏问题
parents
81925f8e
6c758ae6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
44 deletions
+49
-44
lib/flutter_boost.dart
lib/flutter_boost.dart
+49
-44
No files found.
lib/flutter_boost.dart
View file @
a5a01532
...
@@ -44,7 +44,6 @@ typedef void PostPushRoute(
...
@@ -44,7 +44,6 @@ typedef void PostPushRoute(
String
url
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
result
);
String
url
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
result
);
class
FlutterBoost
{
class
FlutterBoost
{
static
final
FlutterBoost
_instance
=
FlutterBoost
();
static
final
FlutterBoost
_instance
=
FlutterBoost
();
final
GlobalKey
<
ContainerManagerState
>
containerManagerKey
=
final
GlobalKey
<
ContainerManagerState
>
containerManagerKey
=
GlobalKey
<
ContainerManagerState
>();
GlobalKey
<
ContainerManagerState
>();
...
@@ -56,23 +55,14 @@ class FlutterBoost {
...
@@ -56,23 +55,14 @@ class FlutterBoost {
static
ContainerManagerState
get
containerManager
=>
static
ContainerManagerState
get
containerManager
=>
_instance
.
containerManagerKey
.
currentState
;
_instance
.
containerManagerKey
.
currentState
;
static
TransitionBuilder
init
(
static
void
onPageStart
()
{
{
TransitionBuilder
builder
,
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
PrePushRoute
prePush
,
singleton
.
channel
.
invokeMethod
<
Map
>(
'pageOnStart'
).
then
((
Map
pageInfo
)
{
PostPushRoute
postPush
})
{
if
(
Platform
.
isAndroid
){
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
){
singleton
.
channel
.
invokeMethod
<
Map
>(
'pageOnStart'
).
then
((
Map
pageInfo
){
if
(
pageInfo
==
null
||
pageInfo
.
isEmpty
)
return
;
if
(
pageInfo
==
null
||
pageInfo
.
isEmpty
)
return
;
if
(
pageInfo
.
containsKey
(
"name"
)
&&
if
(
pageInfo
.
containsKey
(
"name"
)
&&
pageInfo
.
containsKey
(
"params"
)
&&
pageInfo
.
containsKey
(
"params"
)
&&
pageInfo
.
containsKey
(
"uniqueId"
))
{
pageInfo
.
containsKey
(
"uniqueId"
))
{
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
pageInfo
[
"name"
],
pageInfo
[
"params"
],
pageInfo
[
"uniqueId"
]);
pageInfo
[
"name"
],
pageInfo
[
"params"
],
pageInfo
[
"uniqueId"
]);
}
}
...
@@ -80,6 +70,22 @@ class FlutterBoost {
...
@@ -80,6 +70,22 @@ class FlutterBoost {
});
});
}
}
static
TransitionBuilder
init
(
{
TransitionBuilder
builder
,
PrePushRoute
prePush
,
PostPushRoute
postPush
})
{
if
(
Platform
.
isAndroid
)
{
onPageStart
();
}
assert
(()
{
()
async
{
if
(
Platform
.
isIOS
)
{
onPageStart
();
}
}();
return
true
;
}());
return
(
BuildContext
context
,
Widget
child
)
{
return
(
BuildContext
context
,
Widget
child
)
{
assert
(
child
is
Navigator
,
'child must be Navigator, what is wrong?'
);
assert
(
child
is
Navigator
,
'child must be Navigator, what is wrong?'
);
...
@@ -102,7 +108,7 @@ class FlutterBoost {
...
@@ -102,7 +108,7 @@ class FlutterBoost {
BoostChannel
get
channel
=>
_boostChannel
;
BoostChannel
get
channel
=>
_boostChannel
;
FlutterBoost
(){
FlutterBoost
()
{
ContainerCoordinator
(
_boostChannel
);
ContainerCoordinator
(
_boostChannel
);
}
}
...
@@ -116,30 +122,29 @@ class FlutterBoost {
...
@@ -116,30 +122,29 @@ class FlutterBoost {
ContainerCoordinator
.
singleton
.
registerPageBuilders
(
builders
);
ContainerCoordinator
.
singleton
.
registerPageBuilders
(
builders
);
}
}
Future
<
Map
<
dynamic
,
dynamic
>>
open
(
String
url
,{
Map
<
dynamic
,
dynamic
>
urlParams
,
Map
<
dynamic
,
dynamic
>
exts
}){
Future
<
Map
<
dynamic
,
dynamic
>>
open
(
String
url
,
{
Map
<
dynamic
,
dynamic
>
urlParams
,
Map
<
dynamic
,
dynamic
>
exts
})
{
Map
<
dynamic
,
dynamic
>
properties
=
new
Map
<
dynamic
,
dynamic
>();
Map
<
dynamic
,
dynamic
>
properties
=
new
Map
<
dynamic
,
dynamic
>();
properties
[
"url"
]
=
url
;
properties
[
"url"
]
=
url
;
properties
[
"urlParams"
]
=
urlParams
;
properties
[
"urlParams"
]
=
urlParams
;
properties
[
"exts"
]
=
exts
;
properties
[
"exts"
]
=
exts
;
return
channel
.
invokeMethod
<
Map
<
dynamic
,
dynamic
>>(
return
channel
.
invokeMethod
<
Map
<
dynamic
,
dynamic
>>(
'openPage'
,
properties
);
'openPage'
,
properties
);
}
}
Future
<
bool
>
close
(
String
id
,
{
Map
<
dynamic
,
dynamic
>
result
,
Map
<
dynamic
,
dynamic
>
exts
}){
Future
<
bool
>
close
(
String
id
,
{
Map
<
dynamic
,
dynamic
>
result
,
Map
<
dynamic
,
dynamic
>
exts
})
{
assert
(
id
!=
null
);
assert
(
id
!=
null
);
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
Map
<
dynamic
,
dynamic
>
properties
=
new
Map
<
dynamic
,
dynamic
>();
Map
<
dynamic
,
dynamic
>
properties
=
new
Map
<
dynamic
,
dynamic
>();
if
(
exts
==
null
)
{
if
(
exts
==
null
)
{
exts
=
Map
<
dynamic
,
dynamic
>();
exts
=
Map
<
dynamic
,
dynamic
>();
}
}
exts
[
"params"
]
=
settings
.
params
;
exts
[
"params"
]
=
settings
.
params
;
if
(!
exts
.
containsKey
(
"animated"
))
{
if
(!
exts
.
containsKey
(
"animated"
))
{
exts
[
"animated"
]
=
true
;
exts
[
"animated"
]
=
true
;
}
}
...
@@ -155,28 +160,30 @@ class FlutterBoost {
...
@@ -155,28 +160,30 @@ class FlutterBoost {
return
channel
.
invokeMethod
<
bool
>(
'closePage'
,
properties
);
return
channel
.
invokeMethod
<
bool
>(
'closePage'
,
properties
);
}
}
Future
<
bool
>
closeCurrent
({
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
Future
<
bool
>
closeCurrent
(
{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
if
(
exts
==
null
)
{
if
(
exts
==
null
)
{
exts
=
Map
<
String
,
dynamic
>();
exts
=
Map
<
String
,
dynamic
>();
}
}
exts
[
"params"
]
=
settings
.
params
;
exts
[
"params"
]
=
settings
.
params
;
if
(!
exts
.
containsKey
(
"animated"
))
{
if
(!
exts
.
containsKey
(
"animated"
))
{
exts
[
"animated"
]
=
true
;
exts
[
"animated"
]
=
true
;
}
}
return
close
(
settings
.
uniqueId
,
result:
result
,
exts:
exts
);
return
close
(
settings
.
uniqueId
,
result:
result
,
exts:
exts
);
}
}
Future
<
bool
>
closeByContext
(
BuildContext
context
,{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
Future
<
bool
>
closeByContext
(
BuildContext
context
,
{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
if
(
exts
==
null
)
{
if
(
exts
==
null
)
{
exts
=
Map
<
String
,
dynamic
>();
exts
=
Map
<
String
,
dynamic
>();
}
}
exts
[
"params"
]
=
settings
.
params
;
exts
[
"params"
]
=
settings
.
params
;
if
(!
exts
.
containsKey
(
"animated"
))
{
if
(!
exts
.
containsKey
(
"animated"
))
{
exts
[
"animated"
]
=
true
;
exts
[
"animated"
]
=
true
;
}
}
return
close
(
settings
.
uniqueId
,
result:
result
,
exts:
exts
);
return
close
(
settings
.
uniqueId
,
result:
result
,
exts:
exts
);
}
}
///register for Container changed callbacks
///register for Container changed callbacks
...
@@ -191,6 +198,4 @@ class FlutterBoost {
...
@@ -191,6 +198,4 @@ class FlutterBoost {
///register callbacks for Navigators push & pop
///register callbacks for Navigators push & pop
VoidCallback
addBoostNavigatorObserver
(
BoostNavigatorObserver
observer
)
=>
VoidCallback
addBoostNavigatorObserver
(
BoostNavigatorObserver
observer
)
=>
_observersHolder
.
addObserver
<
BoostNavigatorObserver
>(
observer
);
_observersHolder
.
addObserver
<
BoostNavigatorObserver
>(
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