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
8082f94d
Commit
8082f94d
authored
Jul 15, 2019
by
chenxiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加maybePop,使得willPopScope可用
parent
f6c10426
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
5 deletions
+35
-5
lib/container/boost_container.dart
lib/container/boost_container.dart
+35
-5
No files found.
lib/container/boost_container.dart
View file @
8082f94d
...
@@ -132,6 +132,8 @@ class BoostContainerState extends NavigatorState {
...
@@ -132,6 +132,8 @@ class BoostContainerState extends NavigatorState {
@override
@override
BoostContainer
get
widget
=>
super
.
widget
as
BoostContainer
;
BoostContainer
get
widget
=>
super
.
widget
as
BoostContainer
;
final
List
<
Route
<
dynamic
>>
routerHistory
=
<
Route
<
dynamic
>>[];
ContainerNavigatorObserver
findContainerNavigatorObserver
(
ContainerNavigatorObserver
findContainerNavigatorObserver
(
Navigator
navigator
)
{
Navigator
navigator
)
{
for
(
NavigatorObserver
observer
in
navigator
.
observers
)
{
for
(
NavigatorObserver
observer
in
navigator
.
observers
)
{
...
@@ -146,7 +148,7 @@ class BoostContainerState extends NavigatorState {
...
@@ -146,7 +148,7 @@ class BoostContainerState extends NavigatorState {
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
backPressedHandler
=
()
=>
p
op
();
backPressedHandler
=
()
=>
maybeP
op
();
}
}
@override
@override
...
@@ -160,6 +162,7 @@ class BoostContainerState extends NavigatorState {
...
@@ -160,6 +162,7 @@ class BoostContainerState extends NavigatorState {
void
dispose
()
{
void
dispose
()
{
findContainerNavigatorObserver
(
widget
)?.
removeBoostNavigatorObserver
(
findContainerNavigatorObserver
(
widget
)?.
removeBoostNavigatorObserver
(
FlutterBoost
.
containerManager
.
navigatorObserver
);
FlutterBoost
.
containerManager
.
navigatorObserver
);
routerHistory
.
clear
();
super
.
dispose
();
super
.
dispose
();
}
}
...
@@ -169,18 +172,43 @@ class BoostContainerState extends NavigatorState {
...
@@ -169,18 +172,43 @@ class BoostContainerState extends NavigatorState {
backPressedHandler
?.
call
();
backPressedHandler
?.
call
();
}
}
@override
Future
<
bool
>
maybePop
<
T
extends
Object
>([
T
result
])
async
{
final
Route
<
T
>
route
=
routerHistory
.
last
;
final
RoutePopDisposition
disposition
=
await
route
.
willPop
();
if
(
mounted
)
{
switch
(
disposition
)
{
case
RoutePopDisposition
.
pop
:
pop
(
result
);
return
true
;
break
;
case
RoutePopDisposition
.
doNotPop
:
return
false
;
break
;
case
RoutePopDisposition
.
bubble
:
pop
(
result
);
return
true
;
break
;
}
}
}
@override
@override
bool
pop
<
T
extends
Object
>([
T
result
])
{
bool
pop
<
T
extends
Object
>([
T
result
])
{
if
(
routerHistory
.
length
>
1
)
{
routerHistory
.
removeLast
();
}
if
(
canPop
())
{
if
(
canPop
())
{
return
super
.
pop
(
result
);
return
super
.
pop
(
result
);
}
else
{
}
else
{
if
(
T
is
Map
<
String
,
dynamic
>)
{
if
(
T
is
Map
<
String
,
dynamic
>)
{
FlutterBoost
.
singleton
.
close
(
uniqueId
,
result:
result
as
Map
<
String
,
dynamic
>);
FlutterBoost
.
singleton
}
else
{
.
close
(
uniqueId
,
result:
result
as
Map
<
String
,
dynamic
>);
}
else
{
FlutterBoost
.
singleton
.
close
(
uniqueId
);
FlutterBoost
.
singleton
.
close
(
uniqueId
);
}
}
}
}
return
false
;
return
false
;
}
}
...
@@ -194,6 +222,8 @@ class BoostContainerState extends NavigatorState {
...
@@ -194,6 +222,8 @@ class BoostContainerState extends NavigatorState {
Future
<
T
>
future
=
super
.
push
<
T
>(
newRoute
??
route
);
Future
<
T
>
future
=
super
.
push
<
T
>(
newRoute
??
route
);
routerHistory
.
add
(
route
);
if
(
FlutterBoost
.
containerManager
.
postPushRoute
!=
null
)
{
if
(
FlutterBoost
.
containerManager
.
postPushRoute
!=
null
)
{
FlutterBoost
.
containerManager
FlutterBoost
.
containerManager
.
postPushRoute
(
name
,
uniqueId
,
params
,
newRoute
??
route
,
future
);
.
postPushRoute
(
name
,
uniqueId
,
params
,
newRoute
??
route
,
future
);
...
...
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