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
5740f8d9
Commit
5740f8d9
authored
Sep 10, 2020
by
ColdPaleLight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support close page without close container
parent
e26ead11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
11 deletions
+42
-11
lib/container/boost_container.dart
lib/container/boost_container.dart
+4
-2
lib/flutter_boost.dart
lib/flutter_boost.dart
+38
-9
No files found.
lib/container/boost_container.dart
View file @
5740f8d9
...
...
@@ -135,6 +135,8 @@ class BoostContainerState extends NavigatorState {
final
List
<
Route
<
dynamic
>>
routerHistory
=
<
Route
<
dynamic
>>[];
bool
multipleRouteMode
=
false
;
ContainerNavigatorObserver
findContainerNavigatorObserver
(
Navigator
navigator
)
{
for
(
NavigatorObserver
observer
in
navigator
.
observers
)
{
...
...
@@ -202,9 +204,9 @@ class BoostContainerState extends NavigatorState {
}
else
{
if
(
T
is
Map
<
String
,
dynamic
>)
{
FlutterBoost
.
singleton
.
close
(
uniqueId
,
result:
result
as
Map
<
String
,
dynamic
>);
.
close
Internal
(
uniqueId
,
result:
result
as
Map
<
String
,
dynamic
>);
}
else
{
FlutterBoost
.
singleton
.
close
(
uniqueId
);
FlutterBoost
.
singleton
.
close
Internal
(
uniqueId
,
);
}
}
return
true
;
...
...
lib/flutter_boost.dart
View file @
5740f8d9
...
...
@@ -24,6 +24,7 @@
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'container/boost_container.dart'
;
import
'container/container_coordinator.dart'
;
...
...
@@ -144,9 +145,9 @@ class FlutterBoost {
Map
<
String
,
dynamic
>
exts
,
FlutterBoostRouteBuilder
routeBuilder
})
{
if
(!
ContainerCoordinator
.
singleton
.
isFlutterPageUrl
(
url
)){
return
open
(
url
,
urlParams:
urlParams
,
exts:
exts
);
}
//
if(!ContainerCoordinator.singleton.isFlutterPageUrl(url)){
//
return open(url, urlParams: urlParams, exts: exts);
//
}
String
uniqueId
=
'
${url}
_
${DateTime.now().millisecondsSinceEpoch}
'
;
...
...
@@ -155,18 +156,32 @@ class FlutterBoost {
final
Route
<
Map
<
dynamic
,
dynamic
>>
route
=
routeBuilder
!=
null
?
routeBuilder
(
page
)
:
PageRouteBuilder
<
Map
<
dynamic
,
dynamic
>>(
pageBuilder:
(
BuildContext
context
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
,)
=>
page
);
:
defaultRoute
(
page
);
FlutterBoost
.
containerManager
?.
onstageContainer
?.
multipleRouteMode
=
true
;
return
FlutterBoost
.
containerManager
?.
onstageContainer
?.
push
(
route
);
}
Route
<
Map
<
dynamic
,
dynamic
>>
defaultRoute
(
Widget
page
)
{
if
(
Platform
.
isIOS
)
{
return
CupertinoPageRoute
<
Map
<
dynamic
,
dynamic
>>
(
builder:
(
BuildContext
context
)
=>
page
);
}
return
MaterialPageRoute
<
Map
<
dynamic
,
dynamic
>>(
builder:
(
BuildContext
context
)
=>
page
);
// PageRouteBuilder<Map<dynamic, dynamic>>(
// pageBuilder: (BuildContext context,
// Animation<double> animation,
// Animation<double> secondaryAnimation,) =>
// page)
}
/**
* close flutter page but not close container
* close flutter page but not close container
if there has more than one page in contaienr
*/
bool
closeInCurrentContainer
<
T
extends
Object
>([
T
result
])
{
return
FlutterBoost
.
containerManager
?.
onstageContainer
?.
pop
(
result
);
...
...
@@ -174,6 +189,17 @@ class FlutterBoost {
Future
<
bool
>
close
(
String
id
,
{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
//判断当前onStage的容器是不是通过openInCurrentContainer打开过界面
if
(
FlutterBoost
.
containerManager
?.
onstageContainer
?.
multipleRouteMode
??
false
)
{
return
Future
.
value
(
closeInCurrentContainer
(
result
));
}
return
closeInternal
(
id
,
result:
result
,
exts:
exts
);
}
Future
<
bool
>
closeInternal
(
String
id
,
{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
assert
(
id
!=
null
);
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
...
...
@@ -199,8 +225,11 @@ class FlutterBoost {
properties
[
"exts"
]
=
exts
;
}
return
channel
.
invokeMethod
<
bool
>(
'closePage'
,
properties
);
}
Future
<
bool
>
closeCurrent
(
{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
})
{
BoostContainerSettings
settings
=
containerManager
?.
onstageSettings
;
...
...
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