diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index 009e4f12bd..30a6154f87 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -48,6 +48,7 @@ class AboutListTile extends StatelessWidget { this.applicationIcon, this.applicationLegalese, this.aboutBoxChildren, + this.dense, }) : super(key: key); /// The icon to show for this drawer item. @@ -106,14 +107,23 @@ class AboutListTile extends StatelessWidget { /// Defaults to nothing. final List aboutBoxChildren; + /// Whether this list tile is part of a vertically dense list. + /// + /// If this property is null, then its value is based on [ListTileTheme.dense]. + /// + /// Dense list tiles default to a smaller height. + final bool dense; + @override Widget build(BuildContext context) { assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterialLocalizations(context)); return ListTile( leading: icon, - title: child ?? - Text(MaterialLocalizations.of(context).aboutListTileTitle(applicationName ?? _defaultApplicationName(context))), + title: child ?? Text(MaterialLocalizations.of(context).aboutListTileTitle( + applicationName ?? _defaultApplicationName(context), + )), + dense: dense, onTap: () { showAboutDialog( context: context, diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index 960f768e8d..5c716ea9b7 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -285,6 +285,26 @@ void main() { ); expect(find.text('flutter_tester'), findsOneWidget); }); + + testWidgets('AboutListTile dense property is applied', (WidgetTester tester) async { + await tester.pumpWidget(const MaterialApp( + home: Material(child: Center(child: AboutListTile())), + )); + Rect tileRect = tester.getRect(find.byType(AboutListTile)); + expect(tileRect.height, 56.0); + + await tester.pumpWidget(const MaterialApp( + home: Material(child: Center(child: AboutListTile(dense: false))), + )); + tileRect = tester.getRect(find.byType(AboutListTile)); + expect(tileRect.height, 56.0); + + await tester.pumpWidget(const MaterialApp( + home: Material(child: Center(child: AboutListTile(dense: true))), + )); + tileRect = tester.getRect(find.byType(AboutListTile)); + expect(tileRect.height, 48.0); + }); } class FakeLicenseEntry extends LicenseEntry {