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
52ebff72
Unverified
Commit
52ebff72
authored
Dec 20, 2017
by
Michael Goderbauer
Committed by
GitHub
Dec 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
selected ListTile is selected (#13676)
* selected ListTile is selected * review comment * analyzer fix
parent
31418570
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
12 deletions
+68
-12
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+15
-12
list_tile_test.dart
packages/flutter/test/material/list_tile_test.dart
+53
-0
No files found.
packages/flutter/lib/src/material/list_tile.dart
View file @
52ebff72
...
@@ -451,19 +451,22 @@ class ListTile extends StatelessWidget {
...
@@ -451,19 +451,22 @@ class ListTile extends StatelessWidget {
return
new
InkWell
(
return
new
InkWell
(
onTap:
enabled
?
onTap
:
null
,
onTap:
enabled
?
onTap
:
null
,
onLongPress:
enabled
?
onLongPress
:
null
,
onLongPress:
enabled
?
onLongPress
:
null
,
child:
new
ConstrainedBox
(
child:
new
Semantics
(
constraints:
new
BoxConstraints
(
minHeight:
tileHeight
),
selected:
selected
,
child:
new
Padding
(
child:
new
ConstrainedBox
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
constraints:
new
BoxConstraints
(
minHeight:
tileHeight
),
child:
new
UnconstrainedBox
(
child:
new
Padding
(
constrainedAxis:
Axis
.
horizontal
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
child:
new
SafeArea
(
child:
new
UnconstrainedBox
(
top:
false
,
constrainedAxis:
Axis
.
horizontal
,
bottom:
false
,
child:
new
SafeArea
(
child:
new
Row
(
children:
children
),
top:
false
,
bottom:
false
,
child:
new
Row
(
children:
children
),
),
),
),
)
,
)
)
)
,
),
),
);
);
}
}
...
...
packages/flutter/test/material/list_tile_test.dart
View file @
52ebff72
...
@@ -2,9 +2,14 @@
...
@@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:ui'
show
SemanticsFlags
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/semantics_tester.dart'
;
class
TestIcon
extends
StatefulWidget
{
class
TestIcon
extends
StatefulWidget
{
const
TestIcon
({
Key
key
})
:
super
(
key:
key
);
const
TestIcon
({
Key
key
})
:
super
(
key:
key
);
...
@@ -322,4 +327,52 @@ void main() {
...
@@ -322,4 +327,52 @@ void main() {
expect
(
textColor
(
subtitleKey
),
theme
.
disabledColor
);
expect
(
textColor
(
subtitleKey
),
theme
.
disabledColor
);
});
});
testWidgets
(
'ListTile semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
MediaQuery
(
data:
const
MediaQueryData
(),
child:
new
Column
(
children:
<
Widget
>[
const
ListTile
(
title:
const
Text
(
'one'
),
),
const
ListTile
(
title:
const
Text
(
'two'
),
selected:
true
,
),
const
ListTile
(
title:
const
Text
(
'three'
),
),
],
),
),
)
),
);
expect
(
semantics
,
hasSemantics
(
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
new
TestSemantics
.
rootChild
(
label:
'one'
,
),
new
TestSemantics
.
rootChild
(
label:
'two'
,
flags:
<
SemanticsFlags
>[
SemanticsFlags
.
isSelected
],
),
new
TestSemantics
.
rootChild
(
label:
'three'
,
),
]
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
),
);
semantics
.
dispose
();
});
}
}
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