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
fb2cffb0
Unverified
Commit
fb2cffb0
authored
Mar 09, 2021
by
LongCatIsLooong
Committed by
GitHub
Mar 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Hero] toHero flightShuttleBuilder overrides fromHero flightShuttleBuilder (#77733)
parent
7b1aec70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
3 deletions
+99
-3
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+2
-2
heroes_test.dart
packages/flutter/test/widgets/heroes_test.dart
+97
-1
No files found.
packages/flutter/lib/src/widgets/heroes.dart
View file @
fb2cffb0
...
...
@@ -996,8 +996,8 @@ class HeroController extends NavigatorObserver {
fromHero:
fromHero
,
toHero:
toHero
,
createRectTween:
createRectTween
,
shuttleBuilder:
from
Hero
.
widget
.
flightShuttleBuilder
??
to
Hero
.
widget
.
flightShuttleBuilder
shuttleBuilder:
to
Hero
.
widget
.
flightShuttleBuilder
??
from
Hero
.
widget
.
flightShuttleBuilder
??
_defaultHeroFlightShuttleBuilder
,
isUserGestureTransition:
isUserGestureTransition
,
isDiverted:
existingFlight
!=
null
,
...
...
packages/flutter/test/widgets/heroes_test.dart
View file @
fb2cffb0
...
...
@@ -1612,7 +1612,7 @@ Future<void> main() async {
expect
(
tester
.
getTopLeft
(
find
.
byKey
(
firstKey
)).
dx
,
x0
);
});
testWidgets
(
'Can override flight shuttle'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Can override flight shuttle
in to hero
'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
ListView
(
...
...
@@ -1656,6 +1656,102 @@ Future<void> main() async {
expect
(
find
.
text
(
'baz'
),
findsOneWidget
);
});
testWidgets
(
'Can override flight shuttle in from hero'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
ListView
(
children:
<
Widget
>[
Hero
(
tag:
'a'
,
child:
const
Text
(
'foo'
),
flightShuttleBuilder:
(
BuildContext
flightContext
,
Animation
<
double
>
animation
,
HeroFlightDirection
flightDirection
,
BuildContext
fromHeroContext
,
BuildContext
toHeroContext
,
)
{
return
const
Text
(
'baz'
);
},
),
Builder
(
builder:
(
BuildContext
context
)
{
return
TextButton
(
child:
const
Text
(
'two'
),
onPressed:
()
=>
Navigator
.
push
<
void
>(
context
,
MaterialPageRoute
<
void
>(
builder:
(
BuildContext
context
)
{
return
const
Material
(
child:
Hero
(
tag:
'a'
,
child:
Text
(
'bar'
)),
);
},
)),
);
}),
],
),
),
));
await
tester
.
tap
(
find
.
text
(
'two'
));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
expect
(
find
.
text
(
'foo'
),
findsNothing
);
expect
(
find
.
text
(
'bar'
),
findsNothing
);
expect
(
find
.
text
(
'baz'
),
findsOneWidget
);
});
// Regression test for https://github.com/flutter/flutter/issues/77720.
testWidgets
(
"toHero's shuttle builder over fromHero's shuttle builder"
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
ListView
(
children:
<
Widget
>[
Hero
(
tag:
'a'
,
child:
const
Text
(
'foo'
),
flightShuttleBuilder:
(
BuildContext
flightContext
,
Animation
<
double
>
animation
,
HeroFlightDirection
flightDirection
,
BuildContext
fromHeroContext
,
BuildContext
toHeroContext
,
)
{
return
const
Text
(
'fromHero text'
);
},
),
Builder
(
builder:
(
BuildContext
context
)
{
return
TextButton
(
child:
const
Text
(
'two'
),
onPressed:
()
=>
Navigator
.
push
<
void
>(
context
,
MaterialPageRoute
<
void
>(
builder:
(
BuildContext
context
)
{
return
Material
(
child:
Hero
(
tag:
'a'
,
child:
const
Text
(
'bar'
),
flightShuttleBuilder:
(
BuildContext
flightContext
,
Animation
<
double
>
animation
,
HeroFlightDirection
flightDirection
,
BuildContext
fromHeroContext
,
BuildContext
toHeroContext
,
)
{
return
const
Text
(
'toHero text'
);
},
),
);
},
)),
);
}),
],
),
),
));
await
tester
.
tap
(
find
.
text
(
'two'
));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
expect
(
find
.
text
(
'foo'
),
findsNothing
);
expect
(
find
.
text
(
'bar'
),
findsNothing
);
expect
(
find
.
text
(
'fromHero text'
),
findsNothing
);
expect
(
find
.
text
(
'toHero text'
),
findsOneWidget
);
});
testWidgets
(
'Can override flight launch pads'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
...
...
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