From ae4eaa03590b40c98dcc28268bb896d5afd59d77 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 3 Aug 2026 20:21:20 +0000 Subject: [PATCH] fix(filters): make sort sheet options dense like the other sheets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SortOptionsSheet built its options with a plain ListTile and omitted dense: true, while the category, style, and visibility sheets all pass it on their CheckboxListTiles. With no ListTileTheme in lib/, the sort tile fell back to the Material 3 default of styling its title from bodyLarge (~16sp), giving a 48px row pitch against 40px elsewhere — so the sort picker read as a different, larger font. Add dense: true so the row pitch and title size match. Cosmetic only; the Semantics labels and the widget tree shape are unchanged. The issue also asked whether controlAffinity wants aligning here. It does not — ListTile has no controlAffinity parameter, and passing leading: Radio already is leading affinity, matching the other sheets. Fixes #507 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01A5nhJiJuRjtP3q7mTrsXBt --- lib/widgets/drink_filter_sheets.dart | 3 ++ test/widgets/drink_filter_sheets_test.dart | 41 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/lib/widgets/drink_filter_sheets.dart b/lib/widgets/drink_filter_sheets.dart index a39f23af..bdd079a6 100644 --- a/lib/widgets/drink_filter_sheets.dart +++ b/lib/widgets/drink_filter_sheets.dart @@ -188,6 +188,9 @@ class SortOptionsSheet extends StatelessWidget { child: ListTile( leading: Radio(value: sort), title: Text(sortLabel), + // Matches the CheckboxListTile rows in the category, + // style, and visibility sheets, which are all dense. + dense: true, onTap: () { provider.setSort(sort); Navigator.pop(context); diff --git a/test/widgets/drink_filter_sheets_test.dart b/test/widgets/drink_filter_sheets_test.dart index 66da9510..3b2e6e14 100644 --- a/test/widgets/drink_filter_sheets_test.dart +++ b/test/widgets/drink_filter_sheets_test.dart @@ -189,6 +189,47 @@ void main() { expect(find.text('ABV (High to Low)'), findsOneWidget); }); + testWidgets( + 'SortOptionsSheet option rows are the same height as the other ' + 'sheets (regression: #507)', + (tester) async { + await tester.pumpWidget( + directHost(SortOptionsSheet(provider: provider)), + ); + await tester.pumpAndSettle(); + + final sortTiles = tester + .widgetList(find.byType(ListTile)) + .toList(); + expect(sortTiles, isNotEmpty); + for (final tile in sortTiles) { + expect( + tile.dense, + isTrue, + reason: + 'Sort options must be dense to match the category, style, ' + 'and visibility sheets.', + ); + } + + // The user-visible symptom was row pitch, not the flag: measure the + // rendered height and compare it against a sheet that was always + // dense, so this stays honest if Material changes its metrics. + final sortRowHeight = tester + .getSize(find.widgetWithText(ListTile, 'Name (A-Z)')) + .height; + + await tester.pumpWidget(directHost(const CategoryFilterSheet())); + await tester.pumpAndSettle(); + + final categoryRowHeight = tester + .getSize(find.widgetWithText(CheckboxListTile, 'Beer (2)')) + .height; + + expect(sortRowHeight, categoryRowHeight); + }, + ); + testWidgets('StyleFilterSheet shows styles in case-insensitive order', ( tester, ) async {