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
26d4e927
Unverified
Commit
26d4e927
authored
Feb 08, 2022
by
Viren Khatri
Committed by
GitHub
Feb 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removes Material (#96899)
parent
a6504ead
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
410 additions
and
528 deletions
+410
-528
elevated_button_test.dart
packages/flutter/test/material/elevated_button_test.dart
+78
-96
flat_button_test.dart
packages/flutter/test/material/flat_button_test.dart
+35
-49
floating_action_button_test.dart
...es/flutter/test/material/floating_action_button_test.dart
+3
-5
material_button_test.dart
packages/flutter/test/material/material_button_test.dart
+38
-50
outline_button_test.dart
packages/flutter/test/material/outline_button_test.dart
+51
-69
outlined_button_test.dart
packages/flutter/test/material/outlined_button_test.dart
+91
-111
raised_button_test.dart
packages/flutter/test/material/raised_button_test.dart
+25
-35
text_button_test.dart
packages/flutter/test/material/text_button_test.dart
+89
-113
No files found.
packages/flutter/test/material/elevated_button_test.dart
View file @
26d4e927
...
@@ -419,20 +419,18 @@ void main() {
...
@@ -419,20 +419,18 @@ void main() {
final
GlobalKey
childKey
=
GlobalKey
();
final
GlobalKey
childKey
=
GlobalKey
();
bool
hovering
=
false
;
bool
hovering
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
ElevatedButton
(
child:
ElevatedButton
(
autofocus:
true
,
autofocus:
true
,
onPressed:
()
{},
onPressed:
()
{},
onLongPress:
()
{},
onLongPress:
()
{},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
focusNode:
focusNode
,
focusNode:
focusNode
,
child:
SizedBox
(
key:
childKey
),
child:
SizedBox
(
key:
childKey
),
),
),
),
),
),
),
),
...
@@ -447,18 +445,16 @@ void main() {
...
@@ -447,18 +445,16 @@ void main() {
expect
(
hovering
,
isTrue
);
expect
(
hovering
,
isTrue
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
ElevatedButton
(
child:
ElevatedButton
(
focusNode:
focusNode
,
focusNode:
focusNode
,
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onPressed:
null
,
onPressed:
null
,
child:
SizedBox
(
key:
childKey
),
child:
SizedBox
(
key:
childKey
),
),
),
),
),
),
),
),
...
@@ -473,21 +469,19 @@ void main() {
...
@@ -473,21 +469,19 @@ void main() {
late
bool
hover
;
late
bool
hover
;
Widget
buildFrame
({
required
bool
enabled
})
{
Widget
buildFrame
({
required
bool
enabled
})
{
return
Material
(
return
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
ElevatedButton
(
child:
ElevatedButton
(
onPressed:
enabled
?
()
{
}
:
null
,
onPressed:
enabled
?
()
{
}
:
null
,
onHover:
(
bool
value
)
{
onHover:
(
bool
value
)
{
onHoverCount
+=
1
;
onHoverCount
+=
1
;
hover
=
value
;
hover
=
value
;
},
},
child:
const
Text
(
'ElevatedButton'
),
child:
const
Text
(
'ElevatedButton'
),
),
),
),
),
),
),
),
...
@@ -537,15 +531,13 @@ void main() {
...
@@ -537,15 +531,13 @@ void main() {
final
FocusNode
node
=
FocusNode
(
debugLabel:
'ElevatedButton Focus'
);
final
FocusNode
node
=
FocusNode
(
debugLabel:
'ElevatedButton Focus'
);
bool
gotFocus
=
false
;
bool
gotFocus
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
ElevatedButton
(
child:
ElevatedButton
(
focusNode:
node
,
focusNode:
node
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
SizedBox
(),
child:
const
SizedBox
(),
),
),
),
),
),
);
);
...
@@ -568,15 +560,13 @@ void main() {
...
@@ -568,15 +560,13 @@ void main() {
final
FocusNode
node
=
FocusNode
(
debugLabel:
'ElevatedButton Focus'
);
final
FocusNode
node
=
FocusNode
(
debugLabel:
'ElevatedButton Focus'
);
bool
gotFocus
=
false
;
bool
gotFocus
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
ElevatedButton
(
child:
ElevatedButton
(
focusNode:
node
,
focusNode:
node
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onPressed:
null
,
onPressed:
null
,
child:
const
SizedBox
(),
child:
const
SizedBox
(),
),
),
),
),
),
);
);
...
@@ -681,18 +671,16 @@ void main() {
...
@@ -681,18 +671,16 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
ElevatedButton
(
child:
ElevatedButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the semantics tree's rect and transform
// RaisedButton so that the semantics tree's rect and transform
// match the original version of this test.
// match the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
),
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
),
),
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
...
@@ -736,14 +724,12 @@ void main() {
...
@@ -736,14 +724,12 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
tapTargetSize
),
data:
ThemeData
(
materialTapTargetSize:
tapTargetSize
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
ElevatedButton
(
child:
ElevatedButton
(
key:
key
,
key:
key
,
style:
style
,
style:
style
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -763,11 +749,9 @@ void main() {
...
@@ -763,11 +749,9 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
ElevatedButton
(
child:
ElevatedButton
(
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
child:
const
Text
(
'button'
),
child:
const
Text
(
'button'
),
),
),
),
),
),
);
);
...
@@ -855,19 +839,17 @@ void main() {
...
@@ -855,19 +839,17 @@ void main() {
// horizontal padding is applied correctly later on
// horizontal padding is applied correctly later on
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
ElevatedButton
.
icon
(
child:
ElevatedButton
.
icon
(
key:
buttonKey
,
key:
buttonKey
,
style:
ButtonStyle
(
style:
ButtonStyle
(
padding:
MaterialStateProperty
.
all
<
EdgeInsets
>(
const
EdgeInsets
.
fromLTRB
(
16
,
5
,
10
,
12
)),
padding:
MaterialStateProperty
.
all
<
EdgeInsets
>(
const
EdgeInsets
.
fromLTRB
(
16
,
5
,
10
,
12
)),
),
),
onPressed:
()
{},
onPressed:
()
{},
icon:
const
Icon
(
Icons
.
add
),
icon:
const
Icon
(
Icons
.
add
),
label:
const
Text
(
label:
const
Text
(
'Hello'
,
'Hello'
,
key:
labelKey
,
key:
labelKey
,
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/flat_button_test.dart
View file @
26d4e927
...
@@ -395,11 +395,9 @@ void main() {
...
@@ -395,11 +395,9 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
FlatButton
(
child:
FlatButton
(
child:
Container
(),
child:
Container
(),
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
),
),
);
);
...
@@ -536,12 +534,10 @@ void main() {
...
@@ -536,12 +534,10 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -576,14 +572,12 @@ void main() {
...
@@ -576,14 +572,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(),
data:
const
MediaQueryData
(),
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -597,14 +591,12 @@ void main() {
...
@@ -597,14 +591,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -621,14 +613,12 @@ void main() {
...
@@ -621,14 +613,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -650,13 +640,11 @@ void main() {
...
@@ -650,13 +640,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
key:
key1
,
key:
key1
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -671,13 +659,11 @@ void main() {
...
@@ -671,13 +659,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
),
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
key:
key2
,
key:
key2
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/floating_action_button_test.dart
View file @
26d4e927
...
@@ -897,11 +897,9 @@ void main() {
...
@@ -897,11 +897,9 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
FloatingActionButton
(
child:
FloatingActionButton
(
focusNode:
focusNode
,
focusNode:
focusNode
,
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
),
),
);
);
...
...
packages/flutter/test/material/material_button_test.dart
View file @
26d4e927
...
@@ -431,14 +431,12 @@ void main() {
...
@@ -431,14 +431,12 @@ void main() {
const
Color
directSplashColor
=
Color
(
0xFF000011
);
const
Color
directSplashColor
=
Color
(
0xFF000011
);
const
Color
directHighlightColor
=
Color
(
0xFF000011
);
const
Color
directHighlightColor
=
Color
(
0xFF000011
);
Widget
buttonWidget
=
Material
(
Widget
buttonWidget
=
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
splashColor:
directSplashColor
,
splashColor:
directSplashColor
,
highlightColor:
directHighlightColor
,
highlightColor:
directHighlightColor
,
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
clipBehavior:
Clip
.
antiAlias
,
clipBehavior:
Clip
.
antiAlias
,
),
),
),
);
);
...
@@ -459,14 +457,16 @@ void main() {
...
@@ -459,14 +457,16 @@ void main() {
await
tester
.
pump
();
// start gesture
await
tester
.
pump
();
// start gesture
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
// wait for splash to be well under way
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
// wait for splash to be well under way
const
Rect
expectedClipRect
=
Rect
.
fromLTRB
(
356.0
,
282.0
,
444.0
,
318.0
);
// Painter is translated to the center by the Center widget and not
// the Material widget.
const
Rect
expectedClipRect
=
Rect
.
fromLTRB
(
0.0
,
0.0
,
88.0
,
36.0
);
final
Path
expectedClipPath
=
Path
()
final
Path
expectedClipPath
=
Path
()
..
addRRect
(
RRect
.
fromRectAndRadius
(
..
addRRect
(
RRect
.
fromRectAndRadius
(
expectedClipRect
,
expectedClipRect
,
const
Radius
.
circular
(
2.0
),
const
Radius
.
circular
(
2.0
),
));
));
expect
(
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
MaterialButton
))),
Material
.
of
(
tester
.
element
(
find
.
byType
(
InkWell
))),
paints
paints
..
clipPath
(
pathMatcher:
coversSameAreaAs
(
..
clipPath
(
pathMatcher:
coversSameAreaAs
(
expectedClipPath
,
expectedClipPath
,
...
@@ -479,12 +479,10 @@ void main() {
...
@@ -479,12 +479,10 @@ void main() {
const
Color
themeSplashColor1
=
Color
(
0xFF001100
);
const
Color
themeSplashColor1
=
Color
(
0xFF001100
);
const
Color
themeHighlightColor1
=
Color
(
0xFF001100
);
const
Color
themeHighlightColor1
=
Color
(
0xFF001100
);
buttonWidget
=
Material
(
buttonWidget
=
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
clipBehavior:
Clip
.
antiAlias
,
clipBehavior:
Clip
.
antiAlias
,
),
),
),
);
);
...
@@ -503,7 +501,7 @@ void main() {
...
@@ -503,7 +501,7 @@ void main() {
);
);
expect
(
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
MaterialButton
))),
Material
.
of
(
tester
.
element
(
find
.
byType
(
InkWell
))),
paints
paints
..
clipPath
(
pathMatcher:
coversSameAreaAs
(
..
clipPath
(
pathMatcher:
coversSameAreaAs
(
expectedClipPath
,
expectedClipPath
,
...
@@ -531,7 +529,7 @@ void main() {
...
@@ -531,7 +529,7 @@ void main() {
);
);
expect
(
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
MaterialButton
))),
Material
.
of
(
tester
.
element
(
find
.
byType
(
InkWell
))),
paints
paints
..
circle
(
color:
themeSplashColor2
)
..
circle
(
color:
themeSplashColor2
)
..
rect
(
color:
themeHighlightColor2
),
..
rect
(
color:
themeHighlightColor2
),
...
@@ -542,12 +540,10 @@ void main() {
...
@@ -542,12 +540,10 @@ void main() {
testWidgets
(
'MaterialButton has no clip by default'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'MaterialButton has no clip by default'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
buttonKey
=
GlobalKey
();
final
GlobalKey
buttonKey
=
GlobalKey
();
final
Widget
buttonWidget
=
Material
(
final
Widget
buttonWidget
=
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
key:
buttonKey
,
key:
buttonKey
,
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
);
);
...
@@ -583,12 +579,10 @@ void main() {
...
@@ -583,12 +579,10 @@ void main() {
// enabled button
// enabled button
await
tester
.
pumpWidget
(
Directionality
(
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
child:
const
Text
(
'Button'
),
child:
const
Text
(
'Button'
),
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
),
),
));
));
...
@@ -618,12 +612,10 @@ void main() {
...
@@ -618,12 +612,10 @@ void main() {
// disabled button
// disabled button
await
tester
.
pumpWidget
(
const
Directionality
(
await
tester
.
pumpWidget
(
const
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
onPressed:
null
,
// button is disabled
onPressed:
null
,
// button is disabled
child:
Text
(
'Button'
),
child:
Text
(
'Button'
),
),
),
),
),
),
));
));
...
@@ -724,13 +716,11 @@ void main() {
...
@@ -724,13 +716,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
key:
key1
,
key:
key1
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -745,13 +735,11 @@ void main() {
...
@@ -745,13 +735,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
),
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
MaterialButton
(
child:
MaterialButton
(
key:
key2
,
key:
key2
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/outline_button_test.dart
View file @
26d4e927
...
@@ -845,13 +845,11 @@ void main() {
...
@@ -845,13 +845,11 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlineButton
(
child:
OutlineButton
(
key:
buttonKey
,
key:
buttonKey
,
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -868,12 +866,10 @@ void main() {
...
@@ -868,12 +866,10 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlineButton
(
child:
OutlineButton
(
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -908,14 +904,12 @@ void main() {
...
@@ -908,14 +904,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(),
data:
const
MediaQueryData
(),
child:
Center
(
child:
Center
(
child:
OutlineButton
(
child:
OutlineButton
(
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -929,14 +923,12 @@ void main() {
...
@@ -929,14 +923,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -953,14 +945,12 @@ void main() {
...
@@ -953,14 +945,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
child:
Center
(
child:
Center
(
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -1043,13 +1033,11 @@ void main() {
...
@@ -1043,13 +1033,11 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlineButton
(
child:
OutlineButton
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
,
materialTapTargetSize:
MaterialTapTargetSize
.
padded
,
onPressed:
()
{},
onPressed:
()
{},
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
),
),
),
),
),
),
),
...
@@ -1061,13 +1049,11 @@ void main() {
...
@@ -1061,13 +1049,11 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlineButton
(
child:
OutlineButton
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
onPressed:
()
{},
onPressed:
()
{},
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
),
),
),
),
),
),
),
...
@@ -1080,15 +1066,13 @@ void main() {
...
@@ -1080,15 +1066,13 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlineButton
.
icon
(
child:
OutlineButton
.
icon
(
key:
key1
,
key:
key1
,
materialTapTargetSize:
MaterialTapTargetSize
.
padded
,
materialTapTargetSize:
MaterialTapTargetSize
.
padded
,
icon:
const
Icon
(
Icons
.
add_alarm
),
icon:
const
Icon
(
Icons
.
add_alarm
),
label:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
label:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -1107,15 +1091,13 @@ void main() {
...
@@ -1107,15 +1091,13 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlineButton
.
icon
(
child:
OutlineButton
.
icon
(
key:
key2
,
key:
key2
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
icon:
const
Icon
(
Icons
.
add
),
icon:
const
Icon
(
Icons
.
add
),
label:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
label:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/outlined_button_test.dart
View file @
26d4e927
...
@@ -617,20 +617,18 @@ void main() {
...
@@ -617,20 +617,18 @@ void main() {
final
GlobalKey
childKey
=
GlobalKey
();
final
GlobalKey
childKey
=
GlobalKey
();
bool
hovering
=
false
;
bool
hovering
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
OutlinedButton
(
child:
OutlinedButton
(
autofocus:
true
,
autofocus:
true
,
onPressed:
()
{},
onPressed:
()
{},
onLongPress:
()
{},
onLongPress:
()
{},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
focusNode:
focusNode
,
focusNode:
focusNode
,
child:
SizedBox
(
key:
childKey
),
child:
SizedBox
(
key:
childKey
),
),
),
),
),
),
),
),
...
@@ -645,18 +643,16 @@ void main() {
...
@@ -645,18 +643,16 @@ void main() {
expect
(
hovering
,
isTrue
);
expect
(
hovering
,
isTrue
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
OutlinedButton
(
child:
OutlinedButton
(
focusNode:
focusNode
,
focusNode:
focusNode
,
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onPressed:
null
,
onPressed:
null
,
child:
SizedBox
(
key:
childKey
),
child:
SizedBox
(
key:
childKey
),
),
),
),
),
),
),
),
...
@@ -671,21 +667,19 @@ void main() {
...
@@ -671,21 +667,19 @@ void main() {
late
bool
hover
;
late
bool
hover
;
Widget
buildFrame
({
required
bool
enabled
})
{
Widget
buildFrame
({
required
bool
enabled
})
{
return
Material
(
return
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
OutlinedButton
(
child:
OutlinedButton
(
onPressed:
enabled
?
()
{
}
:
null
,
onPressed:
enabled
?
()
{
}
:
null
,
onHover:
(
bool
value
)
{
onHover:
(
bool
value
)
{
onHoverCount
+=
1
;
onHoverCount
+=
1
;
hover
=
value
;
hover
=
value
;
},
},
child:
const
Text
(
'OutlinedButton'
),
child:
const
Text
(
'OutlinedButton'
),
),
),
),
),
),
),
),
...
@@ -735,15 +729,13 @@ void main() {
...
@@ -735,15 +729,13 @@ void main() {
final
FocusNode
node
=
FocusNode
(
debugLabel:
'OutlinedButton Focus'
);
final
FocusNode
node
=
FocusNode
(
debugLabel:
'OutlinedButton Focus'
);
bool
gotFocus
=
false
;
bool
gotFocus
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
OutlinedButton
(
child:
OutlinedButton
(
focusNode:
node
,
focusNode:
node
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
SizedBox
(),
child:
const
SizedBox
(),
),
),
),
),
),
);
);
...
@@ -766,15 +758,13 @@ void main() {
...
@@ -766,15 +758,13 @@ void main() {
final
FocusNode
node
=
FocusNode
(
debugLabel:
'OutlinedButton Focus'
);
final
FocusNode
node
=
FocusNode
(
debugLabel:
'OutlinedButton Focus'
);
bool
gotFocus
=
false
;
bool
gotFocus
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
OutlinedButton
(
child:
OutlinedButton
(
focusNode:
node
,
focusNode:
node
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onPressed:
null
,
onPressed:
null
,
child:
const
SizedBox
(),
child:
const
SizedBox
(),
),
),
),
),
),
);
);
...
@@ -909,13 +899,11 @@ void main() {
...
@@ -909,13 +899,11 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
key:
buttonKey
,
key:
buttonKey
,
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -933,18 +921,16 @@ void main() {
...
@@ -933,18 +921,16 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
),
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
),
),
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
...
@@ -979,20 +965,18 @@ void main() {
...
@@ -979,20 +965,18 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(),
data:
const
MediaQueryData
(),
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
),
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
),
),
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
...
@@ -1006,20 +990,18 @@ void main() {
...
@@ -1006,20 +990,18 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
),
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
),
),
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
...
@@ -1036,14 +1018,12 @@ void main() {
...
@@ -1036,14 +1018,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/raised_button_test.dart
View file @
26d4e927
...
@@ -529,12 +529,10 @@ void main() {
...
@@ -529,12 +529,10 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -572,13 +570,11 @@ void main() {
...
@@ -572,13 +570,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
key:
key1
,
key:
key1
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -593,13 +589,11 @@ void main() {
...
@@ -593,13 +589,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
),
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
key:
key2
,
key:
key2
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -613,10 +607,8 @@ void main() {
...
@@ -613,10 +607,8 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
RaisedButton
(
child:
RaisedButton
(
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
),
),
);
);
...
@@ -696,17 +688,15 @@ void main() {
...
@@ -696,17 +688,15 @@ void main() {
// horizontal padding is applied correctly later on
// horizontal padding is applied correctly later on
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
RaisedButton
.
icon
(
child:
RaisedButton
.
icon
(
icon:
const
Icon
(
Icons
.
add
),
icon:
const
Icon
(
Icons
.
add
),
padding:
const
EdgeInsets
.
fromLTRB
(
16
,
5
,
10
,
12
),
padding:
const
EdgeInsets
.
fromLTRB
(
16
,
5
,
10
,
12
),
key:
buttonKey
,
key:
buttonKey
,
onPressed:
()
{},
onPressed:
()
{},
label:
const
Text
(
label:
const
Text
(
'Hello'
,
'Hello'
,
key:
labelKey
,
key:
labelKey
,
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/text_button_test.dart
View file @
26d4e927
...
@@ -395,11 +395,9 @@ void main() {
...
@@ -395,11 +395,9 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
TextButton
(
child:
TextButton
(
child:
Container
(),
child:
Container
(),
onPressed:
()
{
/* to make sure the button is enabled */
},
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
),
),
);
);
...
@@ -420,14 +418,12 @@ void main() {
...
@@ -420,14 +418,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
TextButton
(
child:
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
overlayColor:
MaterialStateProperty
.
resolveWith
<
Color
?>(
getOverlayColor
),
overlayColor:
MaterialStateProperty
.
resolveWith
<
Color
?>(
getOverlayColor
),
),
child:
Container
(),
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
child:
Container
(),
onPressed:
()
{
/* to make sure the button is enabled */
},
),
),
),
),
);
);
...
@@ -478,18 +474,16 @@ void main() {
...
@@ -478,18 +474,16 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
TextButton
(
child:
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the semantics tree's rect and transform
// RaisedButton so that the semantics tree's rect and transform
// match the original version of this test.
// match the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
),
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
),
),
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
...
@@ -524,14 +518,12 @@ void main() {
...
@@ -524,14 +518,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(),
data:
const
MediaQueryData
(),
child:
Center
(
child:
Center
(
child:
TextButton
(
child:
TextButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -545,14 +537,12 @@ void main() {
...
@@ -545,14 +537,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
child:
Center
(
child:
Center
(
child:
TextButton
(
child:
TextButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -570,14 +560,12 @@ void main() {
...
@@ -570,14 +560,12 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
MediaQuery
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
data:
const
MediaQueryData
(
textScaleFactor:
3.0
),
child:
Center
(
child:
Center
(
child:
TextButton
(
child:
TextButton
(
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
),
),
),
),
),
),
),
...
@@ -599,13 +587,11 @@ void main() {
...
@@ -599,13 +587,11 @@ void main() {
data:
ThemeData
(
materialTapTargetSize:
tapTargetSize
),
data:
ThemeData
(
materialTapTargetSize:
tapTargetSize
),
child:
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Center
(
child:
TextButton
(
child:
TextButton
(
key:
key
,
key:
key
,
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
child:
const
SizedBox
(
width:
50.0
,
height:
8.0
),
onPressed:
()
{
},
onPressed:
()
{
},
),
),
),
),
),
),
),
...
@@ -701,20 +687,18 @@ void main() {
...
@@ -701,20 +687,18 @@ void main() {
final
GlobalKey
childKey
=
GlobalKey
();
final
GlobalKey
childKey
=
GlobalKey
();
bool
hovering
=
false
;
bool
hovering
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
TextButton
(
child:
TextButton
(
autofocus:
true
,
autofocus:
true
,
onPressed:
()
{},
onPressed:
()
{},
onLongPress:
()
{},
onLongPress:
()
{},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
focusNode:
focusNode
,
focusNode:
focusNode
,
child:
SizedBox
(
key:
childKey
),
child:
SizedBox
(
key:
childKey
),
),
),
),
),
),
),
),
...
@@ -729,18 +713,16 @@ void main() {
...
@@ -729,18 +713,16 @@ void main() {
expect
(
hovering
,
isTrue
);
expect
(
hovering
,
isTrue
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
TextButton
(
child:
TextButton
(
focusNode:
focusNode
,
focusNode:
focusNode
,
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onHover:
(
bool
value
)
{
hovering
=
value
;
},
onPressed:
null
,
onPressed:
null
,
child:
SizedBox
(
key:
childKey
),
child:
SizedBox
(
key:
childKey
),
),
),
),
),
),
),
),
...
@@ -755,21 +737,19 @@ void main() {
...
@@ -755,21 +737,19 @@ void main() {
late
bool
hover
;
late
bool
hover
;
Widget
buildFrame
({
required
bool
enabled
})
{
Widget
buildFrame
({
required
bool
enabled
})
{
return
Material
(
return
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
TextButton
(
child:
TextButton
(
onPressed:
enabled
?
()
{
}
:
null
,
onPressed:
enabled
?
()
{
}
:
null
,
onHover:
(
bool
value
)
{
onHover:
(
bool
value
)
{
onHoverCount
+=
1
;
onHoverCount
+=
1
;
hover
=
value
;
hover
=
value
;
},
},
child:
const
Text
(
'TextButton'
),
child:
const
Text
(
'TextButton'
),
),
),
),
),
),
),
),
...
@@ -819,15 +799,13 @@ void main() {
...
@@ -819,15 +799,13 @@ void main() {
final
FocusNode
node
=
FocusNode
(
debugLabel:
'TextButton Focus'
);
final
FocusNode
node
=
FocusNode
(
debugLabel:
'TextButton Focus'
);
bool
gotFocus
=
false
;
bool
gotFocus
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
TextButton
(
child:
TextButton
(
focusNode:
node
,
focusNode:
node
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
SizedBox
(),
child:
const
SizedBox
(),
),
),
),
),
),
);
);
...
@@ -850,15 +828,13 @@ void main() {
...
@@ -850,15 +828,13 @@ void main() {
final
FocusNode
node
=
FocusNode
(
debugLabel:
'TextButton Focus'
);
final
FocusNode
node
=
FocusNode
(
debugLabel:
'TextButton Focus'
);
bool
gotFocus
=
false
;
bool
gotFocus
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Material
(
Directionality
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
TextButton
(
child:
TextButton
(
focusNode:
node
,
focusNode:
node
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onFocusChange:
(
bool
focused
)
=>
gotFocus
=
focused
,
onPressed:
null
,
onPressed:
null
,
child:
const
SizedBox
(),
child:
const
SizedBox
(),
),
),
),
),
),
);
);
...
...
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