Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5cf258c4
Commit
5cf258c4
authored
Nov 06, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1989 from abarth/fix_heroes
Heroes don't reverse any more
parents
10a4753f
70b14e8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
25 deletions
+53
-25
hero_controller.dart
packages/flutter/lib/src/widgets/hero_controller.dart
+45
-13
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+8
-5
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+0
-4
routes.dart
packages/flutter/lib/src/widgets/routes.dart
+0
-3
No files found.
packages/flutter/lib/src/widgets/hero_controller.dart
View file @
5cf258c4
...
...
@@ -20,9 +20,23 @@ class HeroPageRoute extends PageRoute {
})
:
super
(
builder:
builder
,
settings:
settings
);
final
HeroController
heroController
;
NavigatorState
_navigator
;
void
didPush
(
OverlayState
overlay
,
OverlayEntry
insertionPoint
)
{
super
.
didPush
(
overlay
,
insertionPoint
);
// TODO(abarth): Pass the NavigatorState explicitly.
if
(
overlay
!=
null
)
{
_navigator
=
Navigator
.
of
(
overlay
.
context
);
heroController
?.
didPush
(
_navigator
,
this
);
}
}
void
didMakeCurrent
()
{
heroController
?.
didMakeCurrent
(
this
);
void
didPop
(
dynamic
result
)
{
super
.
didPop
(
result
);
if
(
_navigator
!=
null
)
{
heroController
?.
didPop
(
_navigator
,
this
);
_navigator
=
null
;
}
}
}
...
...
@@ -32,29 +46,47 @@ class HeroController {
}
HeroParty
_party
;
PerformanceView
_performance
;
HeroPageRoute
_from
;
HeroPageRoute
_to
;
final
List
<
OverlayEntry
>
_overlayEntries
=
new
List
<
OverlayEntry
>();
void
didMakeCurrent
(
PageRoute
current
)
{
assert
(
current
!=
null
);
assert
(
current
.
performance
!=
null
);
if
(
_from
==
null
)
{
_from
=
current
;
return
;
void
didPush
(
NavigatorState
navigator
,
HeroPageRoute
route
)
{
assert
(
route
!=
null
);
assert
(
route
.
performance
!=
null
);
Route
from
=
navigator
.
currentRoute
;
if
(
from
is
HeroPageRoute
)
_from
=
from
;
_to
=
route
;
_performance
=
route
.
performance
;
_checkForHeroQuest
();
}
void
didPop
(
NavigatorState
navigator
,
HeroPageRoute
route
)
{
assert
(
route
!=
null
);
assert
(
route
.
performance
!=
null
);
Route
to
=
navigator
.
currentRoute
;
if
(
to
is
HeroPageRoute
)
{
_to
=
to
;
_from
=
route
;
_performance
=
route
.
performance
;
_checkForHeroQuest
();
}
_to
=
current
;
if
(
_from
!=
_to
)
{
current
.
offstage
=
current
.
performance
.
status
!=
PerformanceStatus
.
completed
;
}
void
_checkForHeroQuest
()
{
if
(
_from
!=
null
&&
_to
!=
null
&&
_from
!=
_to
)
{
_to
.
offstage
=
_to
.
performance
.
status
!=
PerformanceStatus
.
completed
;
scheduler
.
requestPostFrameCallback
(
_updateQuest
);
}
}
void
_handleQuestFinished
()
{
_removeHeroesFromOverlay
();
_from
=
_to
;
_from
=
null
;
_to
=
null
;
_performance
=
null
;
}
Rect
_getAnimationArea
(
BuildContext
context
)
{
...
...
@@ -97,7 +129,7 @@ class HeroController {
Map
<
Object
,
HeroHandle
>
heroesTo
=
Hero
.
of
(
context
,
mostValuableKeys
);
_to
.
offstage
=
false
;
PerformanceView
performance
=
_
to
.
performance
;
PerformanceView
performance
=
_performance
;
Curve
curve
=
Curves
.
ease
;
if
(
performance
.
status
==
PerformanceStatus
.
reverse
)
{
performance
=
new
ReversePerformance
(
performance
);
...
...
packages/flutter/lib/src/widgets/heroes.dart
View file @
5cf258c4
...
...
@@ -366,14 +366,17 @@ class HeroParty {
PerformanceView
_currentPerformance
;
void
_clearCurrentPerformance
()
{
_currentPerformance
?.
removeStatusListener
(
_handleUpdate
);
_currentPerformance
=
null
;
}
Iterable
<
Widget
>
getWidgets
(
BuildContext
context
,
PerformanceView
performance
)
sync
*
{
assert
(
performance
!=
null
||
_heroes
.
length
==
0
);
if
(
performance
!=
_currentPerformance
)
{
if
(
_currentPerformance
!=
null
)
_currentPerformance
.
removeStatusListener
(
_handleUpdate
);
_clearCurrentPerformance
();
_currentPerformance
=
performance
;
if
(
_currentPerformance
!=
null
)
_currentPerformance
.
addStatusListener
(
_handleUpdate
);
_currentPerformance
?.
addStatusListener
(
_handleUpdate
);
}
for
(
_HeroQuestState
hero
in
_heroes
)
yield
hero
.
build
(
context
,
performance
);
...
...
@@ -389,7 +392,7 @@ class HeroParty {
source
.
_resetChild
();
}
_heroes
.
clear
();
_c
urrentPerformance
=
null
;
_c
learCurrentPerformance
()
;
if
(
onQuestFinished
!=
null
)
onQuestFinished
();
}
...
...
packages/flutter/lib/src/widgets/navigator.dart
View file @
5cf258c4
...
...
@@ -9,7 +9,6 @@ abstract class Route {
List
<
OverlayEntry
>
get
overlayEntries
;
void
didPush
(
OverlayState
overlay
,
OverlayEntry
insertionPoint
);
void
didMakeCurrent
();
void
didPop
(
dynamic
result
);
}
...
...
@@ -95,13 +94,11 @@ class NavigatorState extends State<Navigator> {
_popAllEphemeralRoutes
();
route
.
didPush
(
overlay
,
_currentOverlay
);
_modal
.
add
(
route
);
route
.
didMakeCurrent
();
}
void
pushEphemeral
(
Route
route
)
{
route
.
didPush
(
overlay
,
_currentOverlay
);
_ephemeral
.
add
(
route
);
route
.
didMakeCurrent
();
}
void
_popAllEphemeralRoutes
()
{
...
...
@@ -114,7 +111,6 @@ class NavigatorState extends State<Navigator> {
void
pop
([
dynamic
result
])
{
_removeCurrentRoute
().
didPop
(
result
);
currentRoute
.
didMakeCurrent
();
}
Widget
build
(
BuildContext
context
)
{
...
...
packages/flutter/lib/src/widgets/routes.dart
View file @
5cf258c4
...
...
@@ -17,7 +17,6 @@ class StateRoute extends Route {
List
<
OverlayEntry
>
get
overlayEntries
=>
const
<
OverlayEntry
>[];
void
didPush
(
OverlayState
overlay
,
OverlayEntry
insertionPoint
)
{
}
void
didMakeCurrent
()
{
}
void
didPop
(
dynamic
result
)
{
if
(
onPop
!=
null
)
onPop
();
...
...
@@ -38,8 +37,6 @@ class OverlayRoute extends Route {
}
}
void
didMakeCurrent
()
{
}
void
didPop
(
dynamic
result
)
{
for
(
OverlayEntry
entry
in
_overlayEntries
)
entry
.
remove
();
...
...
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