@@ -165,12 +165,15 @@ enum ListTileControlAffinity {
165
165
/// wraps to two lines (if it is true).
166
166
///
167
167
/// The heights of the [leading] and [trailing] widgets are constrained
168
- /// according to the [Material spec]
169
- /// (https://material.io/design/components/lists.html).
168
+ /// according to the
169
+ /// [Material spec] (https://material.io/design/components/lists.html).
170
170
/// An exception is made for one-line ListTiles for accessibility. Please
171
171
/// see the example below to see how to adhere to both Material spec and
172
172
/// accessibility requirements.
173
173
///
174
+ /// Note that [leading] and [trailing] widgets can expand as far as they wish
175
+ /// horizontally, so ensure that they are properly constrained.
176
+ ///
174
177
/// List tiles are typically used in [ListView] s, or arranged in [Column] s in
175
178
/// [Drawer] s and [Card] s.
176
179
///
@@ -218,13 +221,13 @@ enum ListTileControlAffinity {
218
221
/// that are large enough, but it is up to the developer to ensure that
219
222
/// their widgets follow the Material spec.
220
223
///
221
- /// The following is an example of a one-line, non-[dense] ListTile with a
224
+ /// {@tool sample}
225
+ ///
226
+ /// Here is an example of a one-line, non-[dense] ListTile with a
222
227
/// tappable leading widget that adheres to accessibility requirements and
223
228
/// the Material spec. To adjust the use case below for a one-line, [dense]
224
229
/// ListTile, adjust the vertical padding to 8.0.
225
230
///
226
- /// {@tool sample}
227
- ///
228
231
/// ```dart
229
232
/// ListTile(
230
233
/// leading: GestureDetector(
@@ -984,6 +987,14 @@ class _RenderListTile extends RenderBox {
984
987
final double tileWidth = looseConstraints.maxWidth;
985
988
final Size leadingSize = _layoutBox (leading, iconConstraints);
986
989
final Size trailingSize = _layoutBox (trailing, iconConstraints);
990
+ assert (
991
+ tileWidth != leadingSize.width,
992
+ 'Leading widget consumes entire tile width. Please use a sized widget.'
993
+ );
994
+ assert (
995
+ tileWidth != trailingSize.width,
996
+ 'Trailing widget consumes entire tile width. Please use a sized widget.'
997
+ );
987
998
988
999
final double titleStart = hasLeading
989
1000
? math.max (_minLeadingWidth, leadingSize.width) + _horizontalTitleGap
0 commit comments