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
afe58fba
Unverified
Commit
afe58fba
authored
Aug 19, 2021
by
Hans Muller
Committed by
GitHub
Aug 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Reland "Android Q transition by default (#82670)" (#88409)" (#88482)
parent
18e26301
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
199 deletions
+97
-199
page.dart
packages/flutter/lib/src/material/page.dart
+7
-8
page_transitions_theme.dart
...ages/flutter/lib/src/material/page_transitions_theme.dart
+42
-44
data_table_test.dart
packages/flutter/test/material/data_table_test.dart
+2
-2
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+1
-6
page_test.dart
packages/flutter/test/material/page_test.dart
+25
-106
page_transitions_theme_test.dart
...es/flutter/test/material/page_transitions_theme_test.dart
+11
-11
user_accounts_drawer_header_test.dart
...utter/test/material/user_accounts_drawer_header_test.dart
+7
-13
heroes_test.dart
packages/flutter/test/widgets/heroes_test.dart
+1
-8
overall_experience_test.dart
...tools/test/integration.shard/overall_experience_test.dart
+1
-1
No files found.
packages/flutter/lib/src/material/page.dart
View file @
afe58fba
...
@@ -63,14 +63,13 @@ class MaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTransitionMixi
...
@@ -63,14 +63,13 @@ class MaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTransitionMixi
/// A mixin that provides platform-adaptive transitions for a [PageRoute].
/// A mixin that provides platform-adaptive transitions for a [PageRoute].
///
///
/// {@template flutter.material.materialRouteTransitionMixin}
/// {@template flutter.material.materialRouteTransitionMixin}
/// For Android, the entrance transition for the page zooms in while the
/// For Android, the entrance transition for the page slides the route upwards
/// exiting page zooms and fades out. The exit transition is similar, but in
/// and fades it in. The exit transition is the same, but in reverse.
/// reverse.
///
///
/// The transition is adaptive to the platform and on iOS, the route slides in
/// For iOS, the page slides in from the right and exits in reverse. The page
/// from the right and exits in reverse. The route also shifts to the left in
/// also shifts to the left in parallax when another page enters to cover it.
/// parallax when another page enters to cover it. (These directions are flipped
/// (These directions are flipped in environments with a right-to-left reading
/// in environments with a right-to-left reading direction.)
/// direction.)
/// {@endtemplate}
/// {@endtemplate}
///
///
/// See also:
/// See also:
...
...
packages/flutter/lib/src/material/page_transitions_theme.dart
View file @
afe58fba
...
@@ -9,8 +9,7 @@ import 'colors.dart';
...
@@ -9,8 +9,7 @@ import 'colors.dart';
import
'theme.dart'
;
import
'theme.dart'
;
// Slides the page upwards and fades it in, starting from 1/4 screen
// Slides the page upwards and fades it in, starting from 1/4 screen
// below the top. The transition is intended to match the default for
// below the top.
// Android O.
class
_FadeUpwardsPageTransition
extends
StatelessWidget
{
class
_FadeUpwardsPageTransition
extends
StatelessWidget
{
_FadeUpwardsPageTransition
({
_FadeUpwardsPageTransition
({
Key
?
key
,
Key
?
key
,
...
@@ -147,7 +146,7 @@ class _OpenUpwardsPageTransition extends StatelessWidget {
...
@@ -147,7 +146,7 @@ class _OpenUpwardsPageTransition extends StatelessWidget {
}
}
// Zooms and fades a new page in, zooming out the previous page. This transition
// Zooms and fades a new page in, zooming out the previous page. This transition
// is designed to match the Android
Q
activity transition.
// is designed to match the Android
10
activity transition.
class
_ZoomPageTransition
extends
StatelessWidget
{
class
_ZoomPageTransition
extends
StatelessWidget
{
/// Creates a [_ZoomPageTransition].
/// Creates a [_ZoomPageTransition].
///
///
...
@@ -292,16 +291,16 @@ class _ZoomEnterTransition extends StatelessWidget {
...
@@ -292,16 +291,16 @@ class _ZoomEnterTransition extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
double
opacity
=
0
;
double
opacity
=
0
;
// The transition's scrim opacity only increases on the forward transition.
// The transition's scrim opacity only increases on the forward transition.
In the reverse
//
In the reverse
transition, the opacity should always be 0.0.
// transition, the opacity should always be 0.0.
//
//
// Therefore, we need to only apply the scrim opacity animation when
// Therefore, we need to only apply the scrim opacity animation when
the transition
//
the transition
is running forwards.
// is running forwards.
//
//
// The reason that we check that the animation's status is not `completed`
// The reason that we check that the animation's status is not `completed`
instead
//
instead of checking that it is `forward` is that this allows
//
of checking that it is `forward` is that this allows the interrupted reversal of the
//
the interrupted reversal of the forward transition to smoothly fade
//
forward transition to smoothly fade the scrim away. This prevents a disjointed
//
the scrim away. This prevents a disjointed
removal of the scrim.
// removal of the scrim.
if
(!
reverse
&&
animation
.
status
!=
AnimationStatus
.
completed
)
{
if
(!
reverse
&&
animation
.
status
!=
AnimationStatus
.
completed
)
{
opacity
=
_scrimOpacityTween
.
evaluate
(
animation
)!;
opacity
=
_scrimOpacityTween
.
evaluate
(
animation
)!;
}
}
...
@@ -318,14 +317,17 @@ class _ZoomEnterTransition extends StatelessWidget {
...
@@ -318,14 +317,17 @@ class _ZoomEnterTransition extends StatelessWidget {
return
AnimatedBuilder
(
return
AnimatedBuilder
(
animation:
animation
,
animation:
animation
,
builder:
(
BuildContext
context
,
Widget
?
child
)
{
builder:
(
BuildContext
context
,
Widget
?
child
)
{
return
Co
loredBox
(
return
Co
ntainer
(
color:
Colors
.
black
.
withOpacity
(
opacity
),
color:
Colors
.
black
.
withOpacity
(
opacity
),
child:
child
,
child:
child
,
);
);
},
},
child:
FadeTransition
(
child:
FadeTransition
(
opacity:
fadeTransition
,
opacity:
fadeTransition
,
child:
ScaleTransition
(
scale:
scaleTransition
,
child:
child
),
child:
ScaleTransition
(
scale:
scaleTransition
,
child:
child
,
),
),
),
);
);
}
}
...
@@ -372,7 +374,10 @@ class _ZoomExitTransition extends StatelessWidget {
...
@@ -372,7 +374,10 @@ class _ZoomExitTransition extends StatelessWidget {
return
FadeTransition
(
return
FadeTransition
(
opacity:
fadeTransition
,
opacity:
fadeTransition
,
child:
ScaleTransition
(
scale:
scaleTransition
,
child:
child
),
child:
ScaleTransition
(
scale:
scaleTransition
,
child:
child
,
),
);
);
}
}
}
}
...
@@ -386,12 +391,11 @@ class _ZoomExitTransition extends StatelessWidget {
...
@@ -386,12 +391,11 @@ class _ZoomExitTransition extends StatelessWidget {
///
///
/// See also:
/// See also:
///
///
/// * [FadeUpwardsPageTransitionsBuilder], which defines a page transition
/// * [FadeUpwardsPageTransitionsBuilder], which defines a default page transition.
/// that's similar to the one provided by Android O.
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// that's similar to the one provided by Android P.
/// that's similar to the one provided by Android P.
/// * [ZoomPageTransitionsBuilder], which defines
the default page transition
/// * [ZoomPageTransitionsBuilder], which defines
a page transition similar
/// t
hat's similar to the one provided in Android Q
.
/// t
o the one provided in Android 10
.
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
/// transition that matches native iOS page transitions.
abstract
class
PageTransitionsBuilder
{
abstract
class
PageTransitionsBuilder
{
...
@@ -415,19 +419,18 @@ abstract class PageTransitionsBuilder {
...
@@ -415,19 +419,18 @@ abstract class PageTransitionsBuilder {
);
);
}
}
/// Used by [PageTransitionsTheme] to define a vertically fading
/// Used by [PageTransitionsTheme] to define a default [MaterialPageRoute] page
/// [MaterialPageRoute] page transition animation that looks like
/// transition animation.
/// the default page transition used on Android O.
///
///
/// The animation fades the new page in while translating it upwards,
/// The
default
animation fades the new page in while translating it upwards,
/// starting from about 25% below the top of the screen.
/// starting from about 25% below the top of the screen.
///
///
/// See also:
/// See also:
///
///
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// that's similar to the one provided by Android P.
/// that's similar to the one provided by Android P.
/// * [ZoomPageTransitionsBuilder], which defines
the default page transition
/// * [ZoomPageTransitionsBuilder], which defines
a page transition similar
/// t
hat's similar to the one provided in Android Q
.
/// t
o the one provided in Android 10
.
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
/// transition that matches native iOS page transitions.
class
FadeUpwardsPageTransitionsBuilder
extends
PageTransitionsBuilder
{
class
FadeUpwardsPageTransitionsBuilder
extends
PageTransitionsBuilder
{
...
@@ -452,10 +455,9 @@ class FadeUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
...
@@ -452,10 +455,9 @@ class FadeUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
///
///
/// See also:
/// See also:
///
///
/// * [FadeUpwardsPageTransitionsBuilder], which defines a page transition
/// * [FadeUpwardsPageTransitionsBuilder], which defines a default page transition.
/// that's similar to the one provided by Android O.
/// * [ZoomPageTransitionsBuilder], which defines a page transition similar
/// * [ZoomPageTransitionsBuilder], which defines the default page transition
/// to the one provided in Android 10.
/// that's similar to the one provided in Android Q.
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
/// transition that matches native iOS page transitions.
class
OpenUpwardsPageTransitionsBuilder
extends
PageTransitionsBuilder
{
class
OpenUpwardsPageTransitionsBuilder
extends
PageTransitionsBuilder
{
...
@@ -481,19 +483,18 @@ class OpenUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
...
@@ -481,19 +483,18 @@ class OpenUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
/// Used by [PageTransitionsTheme] to define a zooming [MaterialPageRoute] page
/// Used by [PageTransitionsTheme] to define a zooming [MaterialPageRoute] page
/// transition animation that looks like the default page transition used on
/// transition animation that looks like the default page transition used on
/// Android
Q
.
/// Android
10
.
///
///
/// See also:
/// See also:
///
///
/// * [FadeUpwardsPageTransitionsBuilder], which defines a page transition
/// * [FadeUpwardsPageTransitionsBuilder], which defines a default page transition.
/// that's similar to the one provided by Android O.
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
///
that's
similar to the one provided by Android P.
/// similar to the one provided by Android P.
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
/// transition that matches native iOS page transitions.
class
ZoomPageTransitionsBuilder
extends
PageTransitionsBuilder
{
class
ZoomPageTransitionsBuilder
extends
PageTransitionsBuilder
{
/// Constructs a page transition animation that matches the transition used on
/// Constructs a page transition animation that matches the transition used on
/// Android
Q
.
/// Android
10
.
const
ZoomPageTransitionsBuilder
();
const
ZoomPageTransitionsBuilder
();
@override
@override
...
@@ -517,12 +518,11 @@ class ZoomPageTransitionsBuilder extends PageTransitionsBuilder {
...
@@ -517,12 +518,11 @@ class ZoomPageTransitionsBuilder extends PageTransitionsBuilder {
///
///
/// See also:
/// See also:
///
///
/// * [FadeUpwardsPageTransitionsBuilder], which defines a page transition
/// * [FadeUpwardsPageTransitionsBuilder], which defines a default page transition.
/// that's similar to the one provided by Android O.
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// that's similar to the one provided by Android P.
/// that's similar to the one provided by Android P.
/// * [ZoomPageTransitionsBuilder], which defines
the default page transition
/// * [ZoomPageTransitionsBuilder], which defines
a page transition similar
/// t
hat's similar to the one provided in Android Q
.
/// t
o the one provided in Android 10
.
class
CupertinoPageTransitionsBuilder
extends
PageTransitionsBuilder
{
class
CupertinoPageTransitionsBuilder
extends
PageTransitionsBuilder
{
/// Constructs a page transition animation that matches the iOS transition.
/// Constructs a page transition animation that matches the iOS transition.
const
CupertinoPageTransitionsBuilder
();
const
CupertinoPageTransitionsBuilder
();
...
@@ -554,12 +554,9 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
...
@@ -554,12 +554,9 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
///
///
/// * [ThemeData.pageTransitionsTheme], which defines the default page
/// * [ThemeData.pageTransitionsTheme], which defines the default page
/// transitions for the overall theme.
/// transitions for the overall theme.
/// * [FadeUpwardsPageTransitionsBuilder], which defines a page transition
/// * [FadeUpwardsPageTransitionsBuilder], which defines a default page transition.
/// that's similar to the one provided by Android O.
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// * [OpenUpwardsPageTransitionsBuilder], which defines a page transition
/// that's similar to the one provided by Android P.
/// that's similar to the one provided by Android P.
/// * [ZoomPageTransitionsBuilder], which defines the default page transition
/// that's similar to the one provided by Android Q.
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
/// transition that matches native iOS page transitions.
@immutable
@immutable
...
@@ -577,9 +574,9 @@ class PageTransitionsTheme with Diagnosticable {
...
@@ -577,9 +574,9 @@ class PageTransitionsTheme with Diagnosticable {
static
const
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
_defaultBuilders
=
<
TargetPlatform
,
PageTransitionsBuilder
>{
static
const
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
_defaultBuilders
=
<
TargetPlatform
,
PageTransitionsBuilder
>{
// Only have default transitions for mobile platforms
// Only have default transitions for mobile platforms
TargetPlatform
.
android
:
Zoom
PageTransitionsBuilder
(),
TargetPlatform
.
android
:
FadeUpwards
PageTransitionsBuilder
(),
TargetPlatform
.
iOS
:
CupertinoPageTransitionsBuilder
(),
TargetPlatform
.
iOS
:
CupertinoPageTransitionsBuilder
(),
TargetPlatform
.
fuchsia
:
Zoom
PageTransitionsBuilder
(),
TargetPlatform
.
fuchsia
:
FadeUpwards
PageTransitionsBuilder
(),
};
};
static
const
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
_defaultWebBuilders
=
<
TargetPlatform
,
PageTransitionsBuilder
>{
static
const
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
_defaultWebBuilders
=
<
TargetPlatform
,
PageTransitionsBuilder
>{
...
@@ -590,7 +587,8 @@ class PageTransitionsTheme with Diagnosticable {
...
@@ -590,7 +587,8 @@ class PageTransitionsTheme with Diagnosticable {
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
get
builders
=>
_builders
;
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
get
builders
=>
_builders
;
final
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
_builders
;
final
Map
<
TargetPlatform
,
PageTransitionsBuilder
>
_builders
;
/// Delegates to the builder for the current [ThemeData.platform].
/// Delegates to the builder for the current [ThemeData.platform]
/// or [FadeUpwardsPageTransitionsBuilder].
///
///
/// [MaterialPageRoute.buildTransitions] delegates to this method.
/// [MaterialPageRoute.buildTransitions] delegates to this method.
Widget
buildTransitions
<
T
>(
Widget
buildTransitions
<
T
>(
...
...
packages/flutter/test/material/data_table_test.dart
View file @
afe58fba
...
@@ -459,7 +459,7 @@ void main() {
...
@@ -459,7 +459,7 @@ void main() {
home:
Material
(
child:
buildTable
(
sortAscending:
true
)),
home:
Material
(
child:
buildTable
(
sortAscending:
true
)),
));
));
// The `tester.widget` ensures that there is exactly one upward arrow.
// The `tester.widget` ensures that there is exactly one upward arrow.
Transform
transformOfArrow
=
tester
.
firstW
idget
<
Transform
>(
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
));
Transform
transformOfArrow
=
tester
.
w
idget
<
Transform
>(
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
));
expect
(
expect
(
transformOfArrow
.
transform
.
getRotation
(),
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
identity
()),
equals
(
Matrix3
.
identity
()),
...
@@ -471,7 +471,7 @@ void main() {
...
@@ -471,7 +471,7 @@ void main() {
));
));
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
// The `tester.widget` ensures that there is exactly one upward arrow.
// The `tester.widget` ensures that there is exactly one upward arrow.
transformOfArrow
=
tester
.
firstW
idget
<
Transform
>(
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
));
transformOfArrow
=
tester
.
w
idget
<
Transform
>(
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
));
expect
(
expect
(
transformOfArrow
.
transform
.
getRotation
(),
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
rotationZ
(
math
.
pi
)),
equals
(
Matrix3
.
rotationZ
(
math
.
pi
)),
...
...
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
afe58fba
...
@@ -98,12 +98,7 @@ void main() {
...
@@ -98,12 +98,7 @@ void main() {
);
);
final
RenderBox
clipRect
=
tester
.
renderObject
(
find
.
byType
(
ClipRect
).
first
);
final
RenderBox
clipRect
=
tester
.
renderObject
(
find
.
byType
(
ClipRect
).
first
);
final
Transform
transform
=
tester
.
firstWidget
(
final
Transform
transform
=
tester
.
firstWidget
(
find
.
byType
(
Transform
));
find
.
descendant
(
of:
find
.
byType
(
FlexibleSpaceBar
),
matching:
find
.
byType
(
Transform
),
),
);
// The current (200) is half way between the min (100) and max (300) and the
// The current (200) is half way between the min (100) and max (300) and the
// lerp values used to calculate the scale are 1 and 1.5, so we check for 1.25.
// lerp values used to calculate the scale are 1 and 1.5, so we check for 1.25.
...
...
packages/flutter/test/material/page_test.dart
View file @
afe58fba
...
@@ -12,24 +12,6 @@ import '../rendering/mock_canvas.dart';
...
@@ -12,24 +12,6 @@ import '../rendering/mock_canvas.dart';
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'test page transition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'test page transition'
,
(
WidgetTester
tester
)
async
{
Iterable
<
T
>
_findWidgets
<
T
extends
Widget
>(
Finder
of
)
{
return
tester
.
widgetList
<
T
>(
find
.
ancestor
(
of:
of
,
matching:
find
.
byType
(
T
)),
);
}
FadeTransition
_findForwardFadeTransition
(
Finder
of
)
{
return
_findWidgets
<
FadeTransition
>(
of
).
where
(
(
FadeTransition
t
)
=>
t
.
opacity
.
status
==
AnimationStatus
.
forward
,
).
first
;
}
ScaleTransition
_findForwardScaleTransition
(
Finder
of
)
{
return
_findWidgets
<
ScaleTransition
>(
of
).
where
(
(
ScaleTransition
t
)
=>
t
.
scale
.
status
==
AnimationStatus
.
forward
,
).
first
;
}
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
const
Material
(
child:
Text
(
'Page 1'
)),
home:
const
Material
(
child:
Text
(
'Page 1'
)),
...
@@ -41,23 +23,27 @@ void main() {
...
@@ -41,23 +23,27 @@ void main() {
),
),
);
);
final
Offset
widget1TopLeft
=
tester
.
getTopLeft
(
find
.
text
(
'Page 1'
));
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pushNamed
(
'/next'
);
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pushNamed
(
'/next'
);
await
tester
.
pump
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
50
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
ScaleTransition
widget1Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 1'
));
FadeTransition
widget2Opacity
=
ScaleTransition
widget2Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 2'
));
tester
.
element
(
find
.
text
(
'Page 2'
)).
findAncestorWidgetOfExactType
<
FadeTransition
>()!;
FadeTransition
widget2Opacity
=
_findForwardFadeTransition
(
find
.
text
(
'Page 2'
));
Offset
widget2TopLeft
=
tester
.
getTopLeft
(
find
.
text
(
'Page 2'
));
final
Size
widget2Size
=
tester
.
getSize
(
find
.
text
(
'Page 2'
));
// Page 1 is enlarging, starts from 1.0.
// Android transition is vertical only.
expect
(
widget1Scale
.
scale
.
value
,
greaterThan
(
1.0
));
expect
(
widget1TopLeft
.
dx
==
widget2TopLeft
.
dx
,
true
);
// Page 2 is enlarging from the value less than 1.0.
// Page 1 is above page 2 mid-transition.
expect
(
widget2Scale
.
scale
.
value
,
lessThan
(
1.0
));
expect
(
widget1TopLeft
.
dy
<
widget2TopLeft
.
dy
,
true
);
// Page 2 is becoming none transparent.
// Animation begins 3/4 of the way up the page.
expect
(
widget2Opacity
.
opacity
.
value
,
lessThan
(
1.0
));
expect
(
widget2TopLeft
.
dy
<
widget2Size
.
height
/
4.0
,
true
);
// Animation starts with page 2 being near transparent.
expect
(
widget2Opacity
.
opacity
.
value
<
0.01
,
true
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
250
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
// Page 2 covers page 1.
// Page 2 covers page 1.
expect
(
find
.
text
(
'Page 1'
),
findsNothing
);
expect
(
find
.
text
(
'Page 1'
),
findsNothing
);
...
@@ -65,21 +51,18 @@ void main() {
...
@@ -65,21 +51,18 @@ void main() {
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pop
();
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pop
();
await
tester
.
pump
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
00
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
widget
1Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 1'
));
widget
2Opacity
=
widget2Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 2'
))
;
tester
.
element
(
find
.
text
(
'Page 2'
)).
findAncestorWidgetOfExactType
<
FadeTransition
>()!
;
widget2
Opacity
=
_findForwardFadeTransition
(
find
.
text
(
'Page 2'
));
widget2
TopLeft
=
tester
.
getTopLeft
(
find
.
text
(
'Page 2'
));
// Page 1 is narrowing down, but still larger than 1.0.
// Page 2 starts to move down.
expect
(
widget1Scale
.
scale
.
value
,
greaterThan
(
1.0
));
expect
(
widget1TopLeft
.
dy
<
widget2TopLeft
.
dy
,
true
);
// Page 2 is smaller than 1.0.
// Page 2 starts to lose opacity.
expect
(
widget2Scale
.
scale
.
value
,
lessThan
(
1.0
));
expect
(
widget2Opacity
.
opacity
.
value
<
1.0
,
true
);
// Page 2 is becoming transparent.
expect
(
widget2Opacity
.
opacity
.
value
,
lessThan
(
1.0
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
expect
(
find
.
text
(
'Page 1'
),
isOnstage
);
expect
(
find
.
text
(
'Page 1'
),
isOnstage
);
expect
(
find
.
text
(
'Page 2'
),
findsNothing
);
expect
(
find
.
text
(
'Page 2'
),
findsNothing
);
...
@@ -172,70 +155,6 @@ void main() {
...
@@ -172,70 +155,6 @@ void main() {
skip:
kIsWeb
,
// [intended] no default transitions on the web.
skip:
kIsWeb
,
// [intended] no default transitions on the web.
);
);
testWidgets
(
'test page transition with FadeUpwardsPageTransitionBuilder'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
FadeUpwardsPageTransitionsBuilder
(),
},
),
),
home:
const
Material
(
child:
Text
(
'Page 1'
)),
routes:
<
String
,
WidgetBuilder
>{
'/next'
:
(
BuildContext
context
)
{
return
const
Material
(
child:
Text
(
'Page 2'
));
},
},
),
);
final
Offset
widget1TopLeft
=
tester
.
getTopLeft
(
find
.
text
(
'Page 1'
));
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pushNamed
(
'/next'
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
FadeTransition
widget2Opacity
=
tester
.
element
(
find
.
text
(
'Page 2'
)).
findAncestorWidgetOfExactType
<
FadeTransition
>()!;
Offset
widget2TopLeft
=
tester
.
getTopLeft
(
find
.
text
(
'Page 2'
));
final
Size
widget2Size
=
tester
.
getSize
(
find
.
text
(
'Page 2'
));
// Android transition is vertical only.
expect
(
widget1TopLeft
.
dx
==
widget2TopLeft
.
dx
,
true
);
// Page 1 is above page 2 mid-transition.
expect
(
widget1TopLeft
.
dy
<
widget2TopLeft
.
dy
,
true
);
// Animation begins 3/4 of the way up the page.
expect
(
widget2TopLeft
.
dy
<
widget2Size
.
height
/
4.0
,
true
);
// Animation starts with page 2 being near transparent.
expect
(
widget2Opacity
.
opacity
.
value
<
0.01
,
true
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
// Page 2 covers page 1.
expect
(
find
.
text
(
'Page 1'
),
findsNothing
);
expect
(
find
.
text
(
'Page 2'
),
isOnstage
);
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pop
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
widget2Opacity
=
tester
.
element
(
find
.
text
(
'Page 2'
)).
findAncestorWidgetOfExactType
<
FadeTransition
>()!;
widget2TopLeft
=
tester
.
getTopLeft
(
find
.
text
(
'Page 2'
));
// Page 2 starts to move down.
expect
(
widget1TopLeft
.
dy
<
widget2TopLeft
.
dy
,
true
);
// Page 2 starts to lose opacity.
expect
(
widget2Opacity
.
opacity
.
value
<
1.0
,
true
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
300
));
expect
(
find
.
text
(
'Page 1'
),
isOnstage
);
expect
(
find
.
text
(
'Page 2'
),
findsNothing
);
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
testWidgets
(
'test fullscreen dialog transition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'test fullscreen dialog transition'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
MaterialApp
(
const
MaterialApp
(
...
...
packages/flutter/test/material/page_transitions_theme_test.dart
View file @
afe58fba
...
@@ -66,7 +66,7 @@ void main() {
...
@@ -66,7 +66,7 @@ void main() {
skip:
kIsWeb
,
// [intended] no default transitions on the web.
skip:
kIsWeb
,
// [intended] no default transitions on the web.
);
);
testWidgets
(
'Default PageTransitionsTheme builds a _
Zoom
PageTransition for android'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Default PageTransitionsTheme builds a _
FadeUpwards
PageTransition for android'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
BuildContext
context
)
=>
Material
(
'/'
:
(
BuildContext
context
)
=>
Material
(
child:
TextButton
(
child:
TextButton
(
...
@@ -83,20 +83,20 @@ void main() {
...
@@ -83,20 +83,20 @@ void main() {
),
),
);
);
Finder
find
Zoom
PageTransition
()
{
Finder
find
FadeUpwards
PageTransition
()
{
return
find
.
descendant
(
return
find
.
descendant
(
of:
find
.
byType
(
MaterialApp
),
of:
find
.
byType
(
MaterialApp
),
matching:
find
.
byWidgetPredicate
((
Widget
w
)
=>
'
${w.runtimeType}
'
==
'_
Zoom
PageTransition'
),
matching:
find
.
byWidgetPredicate
((
Widget
w
)
=>
'
${w.runtimeType}
'
==
'_
FadeUpwards
PageTransition'
),
);
);
}
}
expect
(
Theme
.
of
(
tester
.
element
(
find
.
text
(
'push'
))).
platform
,
debugDefaultTargetPlatformOverride
);
expect
(
Theme
.
of
(
tester
.
element
(
find
.
text
(
'push'
))).
platform
,
debugDefaultTargetPlatformOverride
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'page b'
),
findsOneWidget
);
expect
(
find
.
text
(
'page b'
),
findsOneWidget
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
},
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
),
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
),
skip:
kIsWeb
,
// [intended] no default transitions on the web.
skip:
kIsWeb
,
// [intended] no default transitions on the web.
...
@@ -145,7 +145,7 @@ void main() {
...
@@ -145,7 +145,7 @@ void main() {
skip:
kIsWeb
,
// [intended] no default transitions on the web.
skip:
kIsWeb
,
// [intended] no default transitions on the web.
);
);
testWidgets
(
'PageTransitionsTheme override builds a _
FadeUpwards
Transition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'PageTransitionsTheme override builds a _
ZoomPage
Transition'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
BuildContext
context
)
=>
Material
(
'/'
:
(
BuildContext
context
)
=>
Material
(
child:
TextButton
(
child:
TextButton
(
...
@@ -161,7 +161,7 @@ void main() {
...
@@ -161,7 +161,7 @@ void main() {
theme:
ThemeData
(
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
FadeUpwardsPageTransitionsBuilder
(),
// creates a _FadeUpwards
Transition
TargetPlatform
.
android
:
ZoomPageTransitionsBuilder
(),
// creates a _ZoomPage
Transition
},
},
),
),
),
),
...
@@ -169,20 +169,20 @@ void main() {
...
@@ -169,20 +169,20 @@ void main() {
),
),
);
);
Finder
find
FadeUpwards
PageTransition
()
{
Finder
find
Zoom
PageTransition
()
{
return
find
.
descendant
(
return
find
.
descendant
(
of:
find
.
byType
(
MaterialApp
),
of:
find
.
byType
(
MaterialApp
),
matching:
find
.
byWidgetPredicate
((
Widget
w
)
=>
'
${w.runtimeType}
'
==
'_
FadeUpwards
PageTransition'
),
matching:
find
.
byWidgetPredicate
((
Widget
w
)
=>
'
${w.runtimeType}
'
==
'_
Zoom
PageTransition'
),
);
);
}
}
expect
(
Theme
.
of
(
tester
.
element
(
find
.
text
(
'push'
))).
platform
,
debugDefaultTargetPlatformOverride
);
expect
(
Theme
.
of
(
tester
.
element
(
find
.
text
(
'push'
))).
platform
,
debugDefaultTargetPlatformOverride
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'page b'
),
findsOneWidget
);
expect
(
find
.
text
(
'page b'
),
findsOneWidget
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
},
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
),
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
),
skip:
kIsWeb
,
// [intended] no default transitions on the web.
skip:
kIsWeb
,
// [intended] no default transitions on the web.
...
...
packages/flutter/test/material/user_accounts_drawer_header_test.dart
View file @
afe58fba
...
@@ -70,12 +70,6 @@ Future<void> pumpTestWidget(
...
@@ -70,12 +70,6 @@ Future<void> pumpTestWidget(
}
}
void
main
(
)
{
void
main
(
)
{
// Find the exact transform which is the descendant of [UserAccountsDrawerHeader].
final
Finder
findTransform
=
find
.
descendant
(
of:
find
.
byType
(
UserAccountsDrawerHeader
),
matching:
find
.
byType
(
Transform
),
);
testWidgets
(
'UserAccountsDrawerHeader test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'UserAccountsDrawerHeader test'
,
(
WidgetTester
tester
)
async
{
await
pumpTestWidget
(
tester
);
await
pumpTestWidget
(
tester
);
...
@@ -133,7 +127,7 @@ void main() {
...
@@ -133,7 +127,7 @@ void main() {
testWidgets
(
'UserAccountsDrawerHeader icon rotation test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'UserAccountsDrawerHeader icon rotation test'
,
(
WidgetTester
tester
)
async
{
await
pumpTestWidget
(
tester
);
await
pumpTestWidget
(
tester
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon is right side up.
// Icon is right side up.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
@@ -146,7 +140,7 @@ void main() {
...
@@ -146,7 +140,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
await
tester
.
pump
();
await
tester
.
pump
();
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon has rotated 180 degrees.
// Icon has rotated 180 degrees.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
-
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
-
1.0
);
...
@@ -159,7 +153,7 @@ void main() {
...
@@ -159,7 +153,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
await
tester
.
pump
();
await
tester
.
pump
();
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon has rotated 180 degrees back to the original position.
// Icon has rotated 180 degrees back to the original position.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
@@ -184,7 +178,7 @@ void main() {
...
@@ -184,7 +178,7 @@ void main() {
),
),
));
));
Transform
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon is right side up.
// Icon is right side up.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
@@ -195,7 +189,7 @@ void main() {
...
@@ -195,7 +189,7 @@ void main() {
expect
(
tester
.
hasRunningAnimations
,
isFalse
);
expect
(
tester
.
hasRunningAnimations
,
isFalse
);
expect
(
await
tester
.
pumpAndSettle
(),
1
);
expect
(
await
tester
.
pumpAndSettle
(),
1
);
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon has not rotated.
// Icon has not rotated.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
@@ -204,7 +198,7 @@ void main() {
...
@@ -204,7 +198,7 @@ void main() {
testWidgets
(
'UserAccountsDrawerHeader icon rotation test speeeeeedy'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'UserAccountsDrawerHeader icon rotation test speeeeeedy'
,
(
WidgetTester
tester
)
async
{
await
pumpTestWidget
(
tester
);
await
pumpTestWidget
(
tester
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon is right side up.
// Icon is right side up.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
@@ -236,7 +230,7 @@ void main() {
...
@@ -236,7 +230,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
await
tester
.
pump
();
await
tester
.
pump
();
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
// Icon has rotated 180 degrees back to the original position.
// Icon has rotated 180 degrees back to the original position.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
packages/flutter/test/widgets/heroes_test.dart
View file @
afe58fba
...
@@ -728,14 +728,7 @@ Future<void> main() async {
...
@@ -728,14 +728,7 @@ Future<void> main() async {
testWidgets
(
'Hero pop transition interrupted by a push'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Hero pop transition interrupted by a push'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
routes:
routes
),
routes:
routes
,
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
FadeUpwardsPageTransitionsBuilder
(),
},
)),
),
);
);
// Pushes MaterialPageRoute '/two'.
// Pushes MaterialPageRoute '/two'.
...
...
packages/flutter_tools/test/integration.shard/overall_experience_test.dart
View file @
afe58fba
...
@@ -533,7 +533,7 @@ void main() {
...
@@ -533,7 +533,7 @@ void main() {
matches
(
RegExp
(
r'^The specific RenderFlex in question is: RenderFlex#..... OVERFLOWING:$'
)),
matches
(
RegExp
(
r'^The specific RenderFlex in question is: RenderFlex#..... OVERFLOWING:$'
)),
startsWith
(
' creator: Row ← Test ← '
),
startsWith
(
' creator: Row ← Test ← '
),
contains
(
' ← '
),
contains
(
' ← '
),
endsWith
(
'
⋯'
),
endsWith
(
'
←
⋯'
),
' parentData: <none> (can use size)'
,
' parentData: <none> (can use size)'
,
' constraints: BoxConstraints(w=800.0, h=600.0)'
,
' constraints: BoxConstraints(w=800.0, h=600.0)'
,
' size: Size(800.0, 600.0)'
,
' size: Size(800.0, 600.0)'
,
...
...
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