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
e6f20eb9
Unverified
Commit
e6f20eb9
authored
Dec 19, 2017
by
Michael Goderbauer
Committed by
GitHub
Dec 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IconButton is a button, semantically (#13674)
* IconButton is a button, semantically * fix datepicker test
parent
12f40557
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
14 deletions
+49
-14
icon_button.dart
packages/flutter/lib/src/material/icon_button.dart
+17
-14
date_picker_test.dart
packages/flutter/test/material/date_picker_test.dart
+2
-0
icon_button_test.dart
packages/flutter/test/material/icon_button_test.dart
+30
-0
No files found.
packages/flutter/lib/src/material/icon_button.dart
View file @
e6f20eb9
...
...
@@ -191,21 +191,24 @@ class IconButton extends StatelessWidget {
else
currentColor
=
disabledColor
??
Theme
.
of
(
context
).
disabledColor
;
Widget
result
=
new
ConstrainedBox
(
constraints:
const
BoxConstraints
(
minWidth:
_kMinButtonSize
,
minHeight:
_kMinButtonSize
),
child:
new
Padding
(
padding:
padding
,
child:
new
SizedBox
(
height:
iconSize
,
width:
iconSize
,
child:
new
Align
(
alignment:
alignment
,
child:
IconTheme
.
merge
(
data:
new
IconThemeData
(
size:
iconSize
,
color:
currentColor
Widget
result
=
new
Semantics
(
button:
true
,
child:
new
ConstrainedBox
(
constraints:
const
BoxConstraints
(
minWidth:
_kMinButtonSize
,
minHeight:
_kMinButtonSize
),
child:
new
Padding
(
padding:
padding
,
child:
new
SizedBox
(
height:
iconSize
,
width:
iconSize
,
child:
new
Align
(
alignment:
alignment
,
child:
IconTheme
.
merge
(
data:
new
IconThemeData
(
size:
iconSize
,
color:
currentColor
),
child:
icon
),
child:
icon
),
),
),
...
...
packages/flutter/test/material/date_picker_test.dart
View file @
e6f20eb9
...
...
@@ -573,11 +573,13 @@ void _tests() {
],
),
new
TestSemantics
(
flags:
<
SemanticsFlags
>[
SemanticsFlags
.
isButton
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
r'Previous month December 2015'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
flags:
<
SemanticsFlags
>[
SemanticsFlags
.
isButton
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
r'Next month February 2016'
,
textDirection:
TextDirection
.
ltr
,
...
...
packages/flutter/test/material/icon_button_test.dart
View file @
e6f20eb9
...
...
@@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'../widgets/semantics_tester.dart'
;
class
MockOnPressedFunction
implements
Function
{
int
called
=
0
;
...
...
@@ -270,6 +274,32 @@ void main() {
await
gesture
.
up
();
});
testWidgets
(
'IconButton Semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
wrap
(
child:
new
IconButton
(
onPressed:
mockOnPressedFunction
,
icon:
const
Icon
(
Icons
.
link
,
semanticLabel:
'link'
),
),
),
);
expect
(
semantics
,
hasSemantics
(
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
new
TestSemantics
.
rootChild
(
rect:
new
Rect
.
fromLTRB
(
0.0
,
0.0
,
48.0
,
48.0
),
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
flags:
<
SemanticsFlags
>[
SemanticsFlags
.
isButton
],
label:
'link'
,
)
]
),
ignoreId:
true
,
ignoreTransform:
true
));
semantics
.
dispose
();
});
}
Widget
wrap
(
{
Widget
child
})
{
...
...
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