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
3d4a1723
Unverified
Commit
3d4a1723
authored
Apr 26, 2022
by
Jonah Williams
Committed by
GitHub
Apr 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[framework] Reland: use ImageFilter for zoom page transition (#102552)
parent
e1d21cf2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
2 deletions
+68
-2
page_transitions_theme.dart
...ages/flutter/lib/src/material/page_transitions_theme.dart
+10
-2
page_transitions_theme_test.dart
...es/flutter/test/material/page_transitions_theme_test.dart
+58
-0
No files found.
packages/flutter/lib/src/material/page_transitions_theme.dart
View file @
3d4a1723
...
...
@@ -318,7 +318,11 @@ class _ZoomEnterTransition extends StatelessWidget {
},
child:
FadeTransition
(
opacity:
fadeTransition
,
child:
ScaleTransition
(
scale:
scaleTransition
,
child:
child
),
child:
ScaleTransition
(
scale:
scaleTransition
,
filterQuality:
FilterQuality
.
low
,
child:
child
,
),
),
);
}
...
...
@@ -363,7 +367,11 @@ class _ZoomExitTransition extends StatelessWidget {
return
FadeTransition
(
opacity:
fadeTransition
,
child:
ScaleTransition
(
scale:
scaleTransition
,
child:
child
),
child:
ScaleTransition
(
scale:
scaleTransition
,
filterQuality:
FilterQuality
.
low
,
child:
child
,
),
);
}
}
...
...
packages/flutter/test/material/page_transitions_theme_test.dart
View file @
3d4a1723
...
...
@@ -5,6 +5,7 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
...
...
@@ -220,4 +221,61 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
builtCount
,
1
);
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
testWidgets
(
'_ZoomPageTransition uses a FilterQuality while animating'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
BuildContext
context
)
=>
Material
(
child:
TextButton
(
child:
const
Text
(
'push'
),
onPressed:
()
{
Navigator
.
of
(
context
).
pushNamed
(
'/b'
);
},
),
),
'/b'
:
(
BuildContext
context
)
=>
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
TextButton
(
child:
const
Text
(
'pop'
),
onPressed:
()
{
Navigator
.
pop
(
context
);
},
);
},
),
};
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
ZoomPageTransitionsBuilder
(),
// creates a _ZoomPageTransition
},
),
),
routes:
routes
,
),
);
expect
(
tester
.
layers
,
isNot
(
contains
(
isA
<
ImageFilterLayer
>())));
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
tester
.
layers
,
contains
(
isA
<
ImageFilterLayer
>()));
expect
(
tester
.
layers
.
whereType
<
ImageFilterLayer
>(),
hasLength
(
1
));
await
tester
.
pumpAndSettle
();
expect
(
tester
.
layers
,
isNot
(
contains
(
isA
<
ImageFilterLayer
>())));
await
tester
.
tap
(
find
.
text
(
'pop'
));
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
tester
.
layers
,
contains
(
isA
<
ImageFilterLayer
>()));
// exiting requires two different zooms.
expect
(
tester
.
layers
.
whereType
<
ImageFilterLayer
>(),
hasLength
(
2
));
await
tester
.
pumpAndSettle
();
expect
(
tester
.
layers
,
isNot
(
contains
(
isA
<
ImageFilterLayer
>())));
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
}
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