@@ -1484,18 +1484,36 @@ class _RenderListTile extends RenderBox
14841484 final Size ? leadingSize = leading == null ? null : getSize (leading, iconConstraints);
14851485 final Size ? trailingSize = trailing == null ? null : getSize (trailing, iconConstraints);
14861486
1487- assert (
1488- tileWidth != leadingSize? .width || tileWidth == 0.0 ,
1489- 'Leading widget consumes entire tile width. Please use a sized widget, '
1490- 'or consider replacing ListTile with a custom widget '
1491- '(see https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4)' ,
1492- );
1493- assert (
1494- tileWidth != trailingSize? .width || tileWidth == 0.0 ,
1495- 'Trailing widget consumes entire tile width. Please use a sized widget, '
1496- 'or consider replacing ListTile with a custom widget '
1497- '(see https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4)' ,
1498- );
1487+ assert (() {
1488+ if (tileWidth == 0.0 ) {
1489+ return true ;
1490+ }
1491+
1492+ String ? overflowedWidget;
1493+ if (tileWidth == leadingSize? .width) {
1494+ overflowedWidget = 'Leading' ;
1495+ } else if (tileWidth == trailingSize? .width) {
1496+ overflowedWidget = 'Trailing' ;
1497+ }
1498+
1499+ if (overflowedWidget == null ) {
1500+ return true ;
1501+ }
1502+
1503+ throw FlutterError .fromParts (< DiagnosticsNode > [
1504+ ErrorSummary (
1505+ '$overflowedWidget widget consumes the entire tile width (including ListTile.contentPadding).' ,
1506+ ),
1507+ ErrorDescription (
1508+ 'Either resize the tile width so that the ${overflowedWidget .toLowerCase ()} widget plus any content padding '
1509+ 'do not exceed the tile width, or use a sized widget, or consider replacing '
1510+ 'ListTile with a custom widget.' ,
1511+ ),
1512+ ErrorHint (
1513+ 'See also: https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4' ,
1514+ ),
1515+ ]);
1516+ }());
14991517
15001518 final double titleStart =
15011519 leadingSize == null
0 commit comments