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
38412781
Commit
38412781
authored
Jun 04, 2020
by
justin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v1.17.1-hotfixes'
parents
e2251dec
64f35f92
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
35 deletions
+57
-35
.travis.yml
.travis.yml
+1
-1
lib/container/boost_container.dart
lib/container/boost_container.dart
+51
-34
lib/container/boost_page_route.dart
lib/container/boost_page_route.dart
+5
-0
No files found.
.travis.yml
View file @
38412781
...
@@ -9,7 +9,7 @@ addons:
...
@@ -9,7 +9,7 @@ addons:
-
libstdc++6
-
libstdc++6
# - fonts-droid
# - fonts-droid
before_script
:
before_script
:
-
git clone https://github.com/flutter/flutter.git -b
v1.12.13-hotfixes
--depth
1
-
git clone https://github.com/flutter/flutter.git -b
flutter-1.17-candidate.3
--depth
1
-
./flutter/bin/flutter doctor
-
./flutter/bin/flutter doctor
script
:
script
:
-
./flutter/bin/flutter test --coverage --coverage-path=lcov.info
-
./flutter/bin/flutter test --coverage --coverage-path=lcov.info
...
...
lib/container/boost_container.dart
View file @
38412781
...
@@ -39,9 +39,9 @@ enum ContainerLifeCycle {
...
@@ -39,9 +39,9 @@ enum ContainerLifeCycle {
}
}
typedef
BoostContainerLifeCycleObserver
=
void
Function
(
typedef
BoostContainerLifeCycleObserver
=
void
Function
(
ContainerLifeCycle
state
,
ContainerLifeCycle
state
,
BoostContainerSettings
settings
,
BoostContainerSettings
settings
,
);
);
class
BoostContainer
extends
Navigator
{
class
BoostContainer
extends
Navigator
{
const
BoostContainer
({
const
BoostContainer
({
...
@@ -52,17 +52,17 @@ class BoostContainer extends Navigator {
...
@@ -52,17 +52,17 @@ class BoostContainer extends Navigator {
RouteFactory
onUnknownRoute
,
RouteFactory
onUnknownRoute
,
List
<
NavigatorObserver
>
observers
,
List
<
NavigatorObserver
>
observers
,
})
:
super
(
})
:
super
(
key:
key
,
key:
key
,
initialRoute:
initialRoute
,
initialRoute:
initialRoute
,
onGenerateRoute:
onGenerateRoute
,
onGenerateRoute:
onGenerateRoute
,
onUnknownRoute:
onUnknownRoute
,
onUnknownRoute:
onUnknownRoute
,
observers:
observers
,
observers:
observers
,
);
);
factory
BoostContainer
.
copy
(
factory
BoostContainer
.
copy
(
Navigator
navigator
,
[
Navigator
navigator
,
[
BoostContainerSettings
settings
=
const
BoostContainerSettings
(),
BoostContainerSettings
settings
=
const
BoostContainerSettings
(),
])
=>
])
=>
BoostContainer
(
BoostContainer
(
key:
GlobalKey
<
BoostContainerState
>(),
key:
GlobalKey
<
BoostContainerState
>(),
settings:
settings
,
settings:
settings
,
...
@@ -73,9 +73,9 @@ class BoostContainer extends Navigator {
...
@@ -73,9 +73,9 @@ class BoostContainer extends Navigator {
);
);
factory
BoostContainer
.
obtain
(
factory
BoostContainer
.
obtain
(
Navigator
navigator
,
Navigator
navigator
,
BoostContainerSettings
settings
,
BoostContainerSettings
settings
,
)
=>
)
=>
BoostContainer
(
BoostContainer
(
key:
GlobalKey
<
BoostContainerState
>(),
key:
GlobalKey
<
BoostContainerState
>(),
settings:
settings
,
settings:
settings
,
...
@@ -110,18 +110,20 @@ class BoostContainer extends Navigator {
...
@@ -110,18 +110,20 @@ class BoostContainer extends Navigator {
static
BoostContainerState
tryOf
(
BuildContext
context
)
{
static
BoostContainerState
tryOf
(
BuildContext
context
)
{
final
BoostContainerState
container
=
final
BoostContainerState
container
=
context
.
findAncestorStateOfType
<
BoostContainerState
>();
context
.
findAncestorStateOfType
<
BoostContainerState
>();
return
container
;
return
container
;
}
}
static
BoostContainerState
of
(
BuildContext
context
)
{
static
BoostContainerState
of
(
BuildContext
context
)
{
final
BoostContainerState
container
=
final
BoostContainerState
container
=
context
.
findAncestorStateOfType
<
BoostContainerState
>();
context
.
findAncestorStateOfType
<
BoostContainerState
>();
assert
(
container
!=
null
,
'not in flutter boost'
);
assert
(
container
!=
null
,
'not in flutter boost'
);
return
container
;
return
container
;
}
}
String
desc
()
=>
'{uniqueId=
${settings.uniqueId}
,name=
${settings.name}
}'
;
String
desc
()
=>
'{uniqueId=
${settings.uniqueId}
,name=
${settings.name}
}'
;
RouteListFactory
get
initialRoutes
=>
super
.
onGenerateInitialRoutes
;
}
}
class
BoostContainerState
extends
NavigatorState
{
class
BoostContainerState
extends
NavigatorState
{
...
@@ -161,6 +163,15 @@ class BoostContainerState extends NavigatorState {
...
@@ -161,6 +163,15 @@ class BoostContainerState extends NavigatorState {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
backPressedHandler
=
()
=>
maybePop
();
backPressedHandler
=
()
=>
maybePop
();
final
String
initRoute
=
widget
.
initialRoute
??
Navigator
.
defaultRouteName
;
if
(
initRoute
!=
null
&&
routerHistory
.
isEmpty
)
{
routerHistory
.
addAll
(
widget
.
initialRoutes
(
this
,
widget
.
initialRoute
??
Navigator
.
defaultRouteName
)
);
}
}
}
@override
@override
...
@@ -177,22 +188,28 @@ class BoostContainerState extends NavigatorState {
...
@@ -177,22 +188,28 @@ class BoostContainerState extends NavigatorState {
@override
@override
Future
<
bool
>
maybePop
<
T
extends
Object
>([
T
result
])
async
{
Future
<
bool
>
maybePop
<
T
extends
Object
>([
T
result
])
async
{
if
(
routerHistory
.
isEmpty
)
{
pop
(
result
);
return
true
;
}
final
Route
<
T
>
route
=
routerHistory
.
last
as
Route
<
T
>;
final
Route
<
T
>
route
=
routerHistory
.
last
as
Route
<
T
>;
final
RoutePopDisposition
disposition
=
await
route
.
willPop
();
final
RoutePopDisposition
disposition
=
await
route
.
willPop
();
if
(
mounted
)
{
if
(
mounted
)
{
switch
(
disposition
)
{
switch
(
disposition
)
{
case
RoutePopDisposition
.
pop
:
case
RoutePopDisposition
.
pop
:
pop
(
result
);
pop
(
result
);
return
true
;
return
true
;
break
;
break
;
case
RoutePopDisposition
.
doNotPop
:
case
RoutePopDisposition
.
doNotPop
:
return
false
;
return
false
;
break
;
break
;
case
RoutePopDisposition
.
bubble
:
case
RoutePopDisposition
.
bubble
:
pop
(
result
);
pop
(
result
);
return
true
;
return
true
;
break
;
break
;
}
}
}
}
return
false
;
return
false
;
}
}
...
@@ -238,10 +255,10 @@ class BoostContainerState extends NavigatorState {
...
@@ -238,10 +255,10 @@ class BoostContainerState extends NavigatorState {
VoidCallback
addLifeCycleObserver
(
BoostContainerLifeCycleObserver
observer
)
{
VoidCallback
addLifeCycleObserver
(
BoostContainerLifeCycleObserver
observer
)
{
return
FlutterBoost
.
singleton
.
addBoostContainerLifeCycleObserver
(
return
FlutterBoost
.
singleton
.
addBoostContainerLifeCycleObserver
(
(
(
ContainerLifeCycle
state
,
ContainerLifeCycle
state
,
BoostContainerSettings
settings
,
BoostContainerSettings
settings
,
)
{
)
{
if
(
settings
.
uniqueId
==
uniqueId
)
{
if
(
settings
.
uniqueId
==
uniqueId
)
{
observer
(
state
,
settings
);
observer
(
state
,
settings
);
}
}
...
...
lib/container/boost_page_route.dart
View file @
38412781
...
@@ -62,4 +62,9 @@ class BoostPageRoute<T> extends MaterialPageRoute<T> {
...
@@ -62,4 +62,9 @@ class BoostPageRoute<T> extends MaterialPageRoute<T> {
return
null
;
return
null
;
}
}
}
}
@override
Future
<
RoutePopDisposition
>
willPop
()
{
return
Future
<
RoutePopDisposition
>.
value
(
RoutePopDisposition
.
pop
);
}
}
}
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