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
09dfca6f
Unverified
Commit
09dfca6f
authored
Jul 17, 2020
by
chunhtai
Committed by
GitHub
Jul 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add static method to create material hero controller (#61662)
parent
14dcbb2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
app.dart
packages/flutter/lib/src/material/app.dart
+13
-6
app_test.dart
packages/flutter/test/material/app_test.dart
+9
-0
No files found.
packages/flutter/lib/src/material/app.dart
View file @
09dfca6f
...
...
@@ -536,6 +536,17 @@ class MaterialApp extends StatefulWidget {
@override
_MaterialAppState
createState
()
=>
_MaterialAppState
();
/// The [HeroController] used for Material page transitions.
///
/// Used by the [MaterialApp].
static
HeroController
createMaterialHeroController
()
{
return
HeroController
(
createRectTween:
(
Rect
begin
,
Rect
end
)
{
return
MaterialRectArcTween
(
begin:
begin
,
end:
end
);
},
);
}
}
class
_MaterialScrollBehavior
extends
ScrollBehavior
{
...
...
@@ -572,7 +583,7 @@ class _MaterialAppState extends State<MaterialApp> {
@override
void
initState
()
{
super
.
initState
();
_heroController
=
HeroController
(
createRectTween:
_createRectTween
);
_heroController
=
MaterialApp
.
createMaterialHeroController
(
);
}
@override
...
...
@@ -583,14 +594,10 @@ class _MaterialAppState extends State<MaterialApp> {
// old Navigator won't be disposed (and thus won't unregister with its
// observers) until after the new one has been created (because the
// Navigator has a GlobalKey).
_heroController
=
HeroController
(
createRectTween:
_createRectTween
);
_heroController
=
MaterialApp
.
createMaterialHeroController
(
);
}
}
RectTween
_createRectTween
(
Rect
begin
,
Rect
end
)
{
return
MaterialRectArcTween
(
begin:
begin
,
end:
end
);
}
// Combine the Localizations for Material with the ones contributed
// by the localizationsDelegates parameter, if any. Only the first delegate
// of a particular LocalizationsDelegate.type is loaded so the
...
...
packages/flutter/test/material/app_test.dart
View file @
09dfca6f
...
...
@@ -834,6 +834,15 @@ void main() {
expect
(
find
.
text
(
'regular page one'
),
findsNothing
);
expect
(
find
.
text
(
'regular page two'
),
findsNothing
);
});
testWidgets
(
'MaterialApp does create HeroController with the MaterialRectArcTween'
,
(
WidgetTester
tester
)
async
{
final
HeroController
controller
=
MaterialApp
.
createMaterialHeroController
();
final
Tween
<
Rect
>
tween
=
controller
.
createRectTween
(
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
10.0
,
10.0
),
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
20.0
,
20.0
)
);
expect
(
tween
,
isA
<
MaterialRectArcTween
>());
});
}
class
MockAccessibilityFeature
implements
AccessibilityFeatures
{
...
...
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