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
543a7e85
Unverified
Commit
543a7e85
authored
Mar 26, 2022
by
Alex Li
Committed by
GitHub
Mar 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
Android Q transition by default (#100812)
parent
e7f211eb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
255 additions
and
101 deletions
+255
-101
page.dart
packages/flutter/lib/src/material/page.dart
+12
-7
page_transitions_theme.dart
...ages/flutter/lib/src/material/page_transitions_theme.dart
+45
-44
bottom_navigation_bar_theme_test.dart
...utter/test/material/bottom_navigation_bar_theme_test.dart
+42
-18
data_table_test.dart
packages/flutter/test/material/data_table_test.dart
+14
-4
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+6
-1
page_test.dart
packages/flutter/test/material/page_test.dart
+83
-2
page_transitions_theme_test.dart
...es/flutter/test/material/page_transitions_theme_test.dart
+31
-16
user_accounts_drawer_header_test.dart
...utter/test/material/user_accounts_drawer_header_test.dart
+13
-7
heroes_test.dart
packages/flutter/test/widgets/heroes_test.dart
+8
-1
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 @
543a7e85
...
...
@@ -63,19 +63,24 @@ class MaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTransitionMixi
/// A mixin that provides platform-adaptive transitions for a [PageRoute].
///
/// {@template flutter.material.materialRouteTransitionMixin}
/// For Android, the entrance transition for the page slides the route upwards
/// and fades it in. The exit transition is the same, but in reverse.
///
/// The transition is adaptive to the platform and on iOS, the route slides in
/// from the right and exits in reverse. The route also shifts to the left in
/// parallax when another page enters to cover it. (These directions are flipped
/// in environments with a right-to-left reading direction.)
/// For Android, the entrance transition for the page zooms in and fades in
/// while the exiting page zooms out and fades out. The exit transition is similar,
/// but in reverse.
///
/// For iOS, the page slides in from the right and exits in reverse. The page
/// also shifts to the left in parallax when another page enters to cover it.
/// (These directions are flipped in environments with a right-to-left reading
/// direction.)
/// {@endtemplate}
///
/// See also:
///
/// * [PageTransitionsTheme], which defines the default page transitions used
/// by the [MaterialRouteTransitionMixin.buildTransitions].
/// * [ZoomPageTransitionsBuilder], which is the default page transition used
/// by the [PageTransitionsTheme].
/// * [CupertinoPageTransitionsBuilder], which is the default page transition
/// for iOS and macOS.
mixin
MaterialRouteTransitionMixin
<
T
>
on
PageRoute
<
T
>
{
/// Builds the primary contents of the route.
@protected
...
...
packages/flutter/lib/src/material/page_transitions_theme.dart
View file @
543a7e85
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/bottom_navigation_bar_theme_test.dart
View file @
543a7e85
...
...
@@ -151,13 +151,27 @@ void main() {
),
);
final
Finder
findACTransform
=
find
.
descendant
(
of:
find
.
byType
(
BottomNavigationBar
),
matching:
find
.
ancestor
(
of:
find
.
text
(
'AC'
),
matching:
find
.
byType
(
Transform
),
),
);
final
Finder
findAlarmTransform
=
find
.
descendant
(
of:
find
.
byType
(
BottomNavigationBar
),
matching:
find
.
ancestor
(
of:
find
.
text
(
'Alarm'
),
matching:
find
.
byType
(
Transform
),
),
);
final
TextStyle
selectedFontStyle
=
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'AC'
)).
text
.
style
!;
final
TextStyle
selectedIcon
=
_iconStyle
(
tester
,
Icons
.
ac_unit
);
final
TextStyle
unselectedIcon
=
_iconStyle
(
tester
,
Icons
.
access_alarm
);
expect
(
selectedFontStyle
.
fontSize
,
selectedFontStyle
.
fontSize
);
// Unselected label has a font size of 22 but is scaled down to be font size 21.
expect
(
tester
.
firstWidget
<
Transform
>(
find
.
ancestor
(
of:
find
.
text
(
'Alarm'
),
matching:
find
.
byType
(
Transform
))
).
transform
,
tester
.
firstWidget
<
Transform
>(
find
AlarmTransform
).
transform
,
equals
(
Matrix4
.
diagonal3
(
Vector3
.
all
(
unselectedTextStyle
.
fontSize
!
/
selectedTextStyle
.
fontSize
!))),
);
expect
(
selectedIcon
.
color
,
equals
(
selectedItemColor
));
...
...
@@ -179,14 +193,8 @@ void main() {
expect
(
_material
(
tester
).
elevation
,
equals
(
elevation
));
expect
(
_material
(
tester
).
color
,
equals
(
backgroundColor
));
final
Offset
selectedBarItem
=
tester
.
getCenter
(
find
.
ancestor
(
of:
find
.
text
(
'AC'
),
matching:
find
.
byType
(
Transform
))
);
final
Offset
unselectedBarItem
=
tester
.
getCenter
(
find
.
ancestor
(
of:
find
.
text
(
'Alarm'
),
matching:
find
.
byType
(
Transform
))
);
final
Offset
selectedBarItem
=
tester
.
getCenter
(
findACTransform
);
final
Offset
unselectedBarItem
=
tester
.
getCenter
(
findAlarmTransform
);
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
gesture
.
addPointer
();
addTearDown
(
gesture
.
removePointer
);
...
...
@@ -270,13 +278,27 @@ void main() {
),
);
Finder
findDescendantOfBottomNavigationBar
(
Finder
finder
)
{
return
find
.
descendant
(
of:
find
.
byType
(
BottomNavigationBar
),
matching:
finder
,
);
}
final
TextStyle
selectedFontStyle
=
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'AC'
)).
text
.
style
!;
final
TextStyle
selectedIcon
=
_iconStyle
(
tester
,
Icons
.
ac_unit
);
final
TextStyle
unselectedIcon
=
_iconStyle
(
tester
,
Icons
.
access_alarm
);
expect
(
selectedFontStyle
.
fontSize
,
selectedFontStyle
.
fontSize
);
// Unselected label has a font size of 22 but is scaled down to be font size 21.
expect
(
tester
.
firstWidget
<
Transform
>(
find
.
ancestor
(
of:
find
.
text
(
'Alarm'
),
matching:
find
.
byType
(
Transform
))).
transform
,
tester
.
firstWidget
<
Transform
>(
findDescendantOfBottomNavigationBar
(
find
.
ancestor
(
of:
find
.
text
(
'Alarm'
),
matching:
find
.
byType
(
Transform
),
),
),
).
transform
,
equals
(
Matrix4
.
diagonal3
(
Vector3
.
all
(
unselectedTextStyle
.
fontSize
!
/
selectedTextStyle
.
fontSize
!))),
);
expect
(
selectedIcon
.
color
,
equals
(
selectedItemColor
));
...
...
@@ -285,13 +307,11 @@ void main() {
expect
(
unselectedIcon
.
fontSize
,
equals
(
unselectedIconTheme
.
size
));
// There should not be any [Opacity] or [FadeTransition] widgets
// since showUnselectedLabels and showSelectedLabels are true.
final
Finder
findOpacity
=
find
.
descendant
(
of:
find
.
byType
(
BottomNavigationBar
),
matching:
find
.
byType
(
Opacity
),
final
Finder
findOpacity
=
findDescendantOfBottomNavigationBar
(
find
.
byType
(
Opacity
),
);
final
Finder
findFadeTransition
=
find
.
descendant
(
of:
find
.
byType
(
BottomNavigationBar
),
matching:
find
.
byType
(
FadeTransition
),
final
Finder
findFadeTransition
=
findDescendantOfBottomNavigationBar
(
find
.
byType
(
FadeTransition
),
);
expect
(
findOpacity
,
findsNothing
);
expect
(
findFadeTransition
,
findsNothing
);
...
...
@@ -299,8 +319,12 @@ void main() {
expect
(
_material
(
tester
).
color
,
equals
(
backgroundColor
));
final
Offset
barItem
=
tester
.
getCenter
(
find
.
ancestor
(
of:
find
.
text
(
'AC'
),
matching:
find
.
byType
(
Transform
))
findDescendantOfBottomNavigationBar
(
find
.
ancestor
(
of:
find
.
text
(
'AC'
),
matching:
find
.
byType
(
Transform
),
),
),
);
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
gesture
.
addPointer
();
...
...
packages/flutter/test/material/data_table_test.dart
View file @
543a7e85
...
...
@@ -467,7 +467,11 @@ void main() {
home:
Material
(
child:
buildTable
()),
));
// The `tester.widget` ensures that there is exactly one upward arrow.
Transform
transformOfArrow
=
tester
.
widget
<
Transform
>(
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
));
final
Finder
iconFinder
=
find
.
descendant
(
of:
find
.
byType
(
DataTable
),
matching:
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
),
);
Transform
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
identity
()),
...
...
@@ -479,7 +483,7 @@ void main() {
));
await
tester
.
pumpAndSettle
();
// The `tester.widget` ensures that there is exactly one upward arrow.
transformOfArrow
=
tester
.
widget
<
Transform
>(
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
)
);
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
rotationZ
(
math
.
pi
)),
...
...
@@ -515,7 +519,10 @@ void main() {
home:
Material
(
child:
buildTable
()),
));
// The `tester.widget` ensures that there is exactly one upward arrow.
final
Finder
iconFinder
=
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
);
final
Finder
iconFinder
=
find
.
descendant
(
of:
find
.
byType
(
DataTable
),
matching:
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
),
);
Transform
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
...
...
@@ -565,7 +572,10 @@ void main() {
home:
Material
(
child:
buildTable
()),
));
// The `tester.widget` ensures that there is exactly one upward arrow.
final
Finder
iconFinder
=
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
);
final
Finder
iconFinder
=
find
.
descendant
(
of:
find
.
byType
(
DataTable
),
matching:
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
),
);
Transform
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
...
...
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
543a7e85
...
...
@@ -102,7 +102,12 @@ void main() {
);
final
RenderBox
clipRect
=
tester
.
renderObject
(
find
.
byType
(
ClipRect
).
first
);
final
Transform
transform
=
tester
.
firstWidget
(
find
.
byType
(
Transform
));
final
Transform
transform
=
tester
.
firstWidget
(
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
// 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 @
543a7e85
...
...
@@ -10,10 +10,17 @@ import 'package:flutter_test/flutter_test.dart';
import
'../rendering/mock_canvas.dart'
;
void
main
(
)
{
testWidgets
(
'test page transition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'test page transition
(_FadeUpwardsPageTransition)
'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
const
Material
(
child:
Text
(
'Page 1'
)),
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
FadeUpwardsPageTransitionsBuilder
(),
},
),
),
routes:
<
String
,
WidgetBuilder
>{
'/next'
:
(
BuildContext
context
)
{
return
const
Material
(
child:
Text
(
'Page 2'
));
...
...
@@ -67,7 +74,7 @@ void main() {
expect
(
find
.
text
(
'Page 2'
),
findsNothing
);
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
testWidgets
(
'test page transition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'test page transition
(CupertinoPageTransition)
'
,
(
WidgetTester
tester
)
async
{
final
Key
page2Key
=
UniqueKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -148,6 +155,80 @@ void main() {
expect
(
widget1InitialTopLeft
==
widget1TransientTopLeft
,
true
);
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'test page transition (_ZoomPageTransition)'
,
(
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
(
MaterialApp
(
home:
const
Material
(
child:
Text
(
'Page 1'
)),
routes:
<
String
,
WidgetBuilder
>{
'/next'
:
(
BuildContext
context
)
{
return
const
Material
(
child:
Text
(
'Page 2'
));
},
},
),
);
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
pushNamed
(
'/next'
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
50
));
ScaleTransition
widget1Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 1'
));
ScaleTransition
widget2Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 2'
));
FadeTransition
widget2Opacity
=
_findForwardFadeTransition
(
find
.
text
(
'Page 2'
));
// Page 1 is enlarging, starts from 1.0.
expect
(
widget1Scale
.
scale
.
value
,
greaterThan
(
1.0
));
// Page 2 is enlarging from the value less than 1.0.
expect
(
widget2Scale
.
scale
.
value
,
lessThan
(
1.0
));
// Page 2 is becoming none transparent.
expect
(
widget2Opacity
.
opacity
.
value
,
lessThan
(
1.0
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
250
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
1
));
// 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:
100
));
widget1Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 1'
));
widget2Scale
=
_findForwardScaleTransition
(
find
.
text
(
'Page 2'
));
widget2Opacity
=
_findForwardFadeTransition
(
find
.
text
(
'Page 2'
));
// Page 1 is narrowing down, but still larger than 1.0.
expect
(
widget1Scale
.
scale
.
value
,
greaterThan
(
1.0
));
// Page 2 is smaller than 1.0.
expect
(
widget2Scale
.
scale
.
value
,
lessThan
(
1.0
));
// 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:
1
));
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
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
...
...
packages/flutter/test/material/page_transitions_theme_test.dart
View file @
543a7e85
...
...
@@ -13,15 +13,30 @@ void main() {
final
PageTransitionsTheme
theme
=
Theme
.
of
(
tester
.
element
(
find
.
text
(
'home'
))).
pageTransitionsTheme
;
expect
(
theme
.
builders
,
isNotNull
);
for
(
final
TargetPlatform
platform
in
TargetPlatform
.
values
)
{
if
(
platform
==
TargetPlatform
.
fuchsia
)
{
// No builder on Fuchsia.
continue
;
switch
(
platform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
expect
(
theme
.
builders
[
platform
],
isNotNull
,
reason:
'theme builder for
$platform
is null'
,
);
break
;
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
expect
(
theme
.
builders
[
platform
],
isNull
,
reason:
'theme builder for
$platform
is not null'
,
);
break
;
}
expect
(
theme
.
builders
[
platform
],
isNotNull
,
reason:
'theme builder for
$platform
is null'
);
}
});
testWidgets
(
'Default PageTransitionsTheme builds a Cuperti
on
PageTransition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Default PageTransitionsTheme builds a Cuperti
no
PageTransition'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
BuildContext
context
)
=>
Material
(
child:
TextButton
(
...
...
@@ -47,7 +62,7 @@ void main() {
expect
(
find
.
byType
(
CupertinoPageTransition
),
findsOneWidget
);
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'Default PageTransitionsTheme builds a _
FadeUpwards
PageTransition for android'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Default PageTransitionsTheme builds a _
Zoom
PageTransition for android'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
BuildContext
context
)
=>
Material
(
child:
TextButton
(
...
...
@@ -64,20 +79,20 @@ void main() {
),
);
Finder
find
FadeUpwards
PageTransition
()
{
Finder
find
Zoom
PageTransition
()
{
return
find
.
descendant
(
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
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'page b'
),
findsOneWidget
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
testWidgets
(
'PageTransitionsTheme override builds a _OpenUpwardsPageTransition'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -120,7 +135,7 @@ void main() {
expect
(
findOpenUpwardsPageTransition
(),
findsOneWidget
);
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
testWidgets
(
'PageTransitionsTheme override builds a _
ZoomPage
Transition'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'PageTransitionsTheme override builds a _
FadeUpwards
Transition'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
BuildContext
context
)
=>
Material
(
child:
TextButton
(
...
...
@@ -136,7 +151,7 @@ void main() {
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
ZoomPageTransitionsBuilder
(),
// creates a _ZoomPage
Transition
TargetPlatform
.
android
:
FadeUpwardsPageTransitionsBuilder
(),
// creates a _FadeUpwards
Transition
},
),
),
...
...
@@ -144,20 +159,20 @@ void main() {
),
);
Finder
find
Zoom
PageTransition
()
{
Finder
find
FadeUpwards
PageTransition
()
{
return
find
.
descendant
(
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
(
find
Zoom
PageTransition
(),
findsOneWidget
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'push'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'page b'
),
findsOneWidget
);
expect
(
find
Zoom
PageTransition
(),
findsOneWidget
);
expect
(
find
FadeUpwards
PageTransition
(),
findsOneWidget
);
},
variant:
TargetPlatformVariant
.
only
(
TargetPlatform
.
android
));
testWidgets
(
'_ZoomPageTransition only cause child widget built once'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/material/user_accounts_drawer_header_test.dart
View file @
543a7e85
...
...
@@ -70,6 +70,12 @@ Future<void> pumpTestWidget(
}
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
{
await
pumpTestWidget
(
tester
);
...
...
@@ -127,7 +133,7 @@ void main() {
testWidgets
(
'UserAccountsDrawerHeader icon rotation test'
,
(
WidgetTester
tester
)
async
{
await
pumpTestWidget
(
tester
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon is right side up.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
@@ -140,7 +146,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pump
();
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon has rotated 180 degrees.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
-
1.0
);
...
...
@@ -153,7 +159,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pump
();
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon has rotated 180 degrees back to the original position.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
@@ -178,7 +184,7 @@ void main() {
),
));
Transform
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon is right side up.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
@@ -189,7 +195,7 @@ void main() {
expect
(
tester
.
hasRunningAnimations
,
isFalse
);
expect
(
await
tester
.
pumpAndSettle
(),
1
);
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon has not rotated.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
@@ -198,7 +204,7 @@ void main() {
testWidgets
(
'UserAccountsDrawerHeader icon rotation test speeeeeedy'
,
(
WidgetTester
tester
)
async
{
await
pumpTestWidget
(
tester
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
Transform
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon is right side up.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
@@ -230,7 +236,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pump
();
transformWidget
=
tester
.
firstWidget
(
find
.
byType
(
Transform
)
);
transformWidget
=
tester
.
firstWidget
(
find
Transform
);
// Icon has rotated 180 degrees back to the original position.
expect
(
transformWidget
.
transform
.
getRotation
()[
0
],
1.0
);
...
...
packages/flutter/test/widgets/heroes_test.dart
View file @
543a7e85
...
...
@@ -728,7 +728,14 @@ Future<void> main() async {
testWidgets
(
'Hero pop transition interrupted by a push'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
),
MaterialApp
(
routes:
routes
,
theme:
ThemeData
(
pageTransitionsTheme:
const
PageTransitionsTheme
(
builders:
<
TargetPlatform
,
PageTransitionsBuilder
>{
TargetPlatform
.
android
:
FadeUpwardsPageTransitionsBuilder
(),
},
)),
),
);
// Pushes MaterialPageRoute '/two'.
...
...
packages/flutter_tools/test/integration.shard/overall_experience_test.dart
View file @
543a7e85
...
...
@@ -538,7 +538,7 @@ void main() {
matches
(
RegExp
(
r'^The specific RenderFlex in question is: RenderFlex#..... OVERFLOWING:$'
)),
startsWith
(
' creator: Row ← Test ← '
),
contains
(
' ← '
),
endsWith
(
'
←
⋯'
),
endsWith
(
' ⋯'
),
' parentData: <none> (can use size)'
,
' constraints: BoxConstraints(w=800.0, h=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