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
d4c4f563
Unverified
Commit
d4c4f563
authored
Apr 02, 2019
by
Shi-Hao Hong
Committed by
GitHub
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added assert to prevent complete ListTile trailing/leading horizontal expansion (#30212)
parent
712195b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+16
-5
No files found.
packages/flutter/lib/src/material/list_tile.dart
View file @
d4c4f563
...
...
@@ -165,12 +165,15 @@ enum ListTileControlAffinity {
/// wraps to two lines (if it is true).
///
/// The heights of the [leading] and [trailing] widgets are constrained
/// according to the
[Material spec]
/// (https://material.io/design/components/lists.html).
/// according to the
///
[Material spec]
(https://material.io/design/components/lists.html).
/// An exception is made for one-line ListTiles for accessibility. Please
/// see the example below to see how to adhere to both Material spec and
/// accessibility requirements.
///
/// Note that [leading] and [trailing] widgets can expand as far as they wish
/// horizontally, so ensure that they are properly constrained.
///
/// List tiles are typically used in [ListView]s, or arranged in [Column]s in
/// [Drawer]s and [Card]s.
///
...
...
@@ -218,13 +221,13 @@ enum ListTileControlAffinity {
/// that are large enough, but it is up to the developer to ensure that
/// their widgets follow the Material spec.
///
/// The following is an example of a one-line, non-[dense] ListTile with a
/// {@tool sample}
///
/// Here is an example of a one-line, non-[dense] ListTile with a
/// tappable leading widget that adheres to accessibility requirements and
/// the Material spec. To adjust the use case below for a one-line, [dense]
/// ListTile, adjust the vertical padding to 8.0.
///
/// {@tool sample}
///
/// ```dart
/// ListTile(
/// leading: GestureDetector(
...
...
@@ -984,6 +987,14 @@ class _RenderListTile extends RenderBox {
final
double
tileWidth
=
looseConstraints
.
maxWidth
;
final
Size
leadingSize
=
_layoutBox
(
leading
,
iconConstraints
);
final
Size
trailingSize
=
_layoutBox
(
trailing
,
iconConstraints
);
assert
(
tileWidth
!=
leadingSize
.
width
,
'Leading widget consumes entire tile width. Please use a sized widget.'
);
assert
(
tileWidth
!=
trailingSize
.
width
,
'Trailing widget consumes entire tile width. Please use a sized widget.'
);
final
double
titleStart
=
hasLeading
?
math
.
max
(
_minLeadingWidth
,
leadingSize
.
width
)
+
_horizontalTitleGap
...
...
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