Skip to content

Commit ae4eaa0

Browse files
committed
fix(filters): make sort sheet options dense like the other sheets
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A5nhJiJuRjtP3q7mTrsXBt
1 parent af30dc0 commit ae4eaa0

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

lib/widgets/drink_filter_sheets.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ class SortOptionsSheet extends StatelessWidget {
188188
child: ListTile(
189189
leading: Radio<DrinkSort>(value: sort),
190190
title: Text(sortLabel),
191+
// Matches the CheckboxListTile rows in the category,
192+
// style, and visibility sheets, which are all dense.
193+
dense: true,
191194
onTap: () {
192195
provider.setSort(sort);
193196
Navigator.pop(context);

test/widgets/drink_filter_sheets_test.dart

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,47 @@ void main() {
189189
expect(find.text('ABV (High to Low)'), findsOneWidget);
190190
});
191191

192+
testWidgets(
193+
'SortOptionsSheet option rows are the same height as the other '
194+
'sheets (regression: #507)',
195+
(tester) async {
196+
await tester.pumpWidget(
197+
directHost(SortOptionsSheet(provider: provider)),
198+
);
199+
await tester.pumpAndSettle();
200+
201+
final sortTiles = tester
202+
.widgetList<ListTile>(find.byType(ListTile))
203+
.toList();
204+
expect(sortTiles, isNotEmpty);
205+
for (final tile in sortTiles) {
206+
expect(
207+
tile.dense,
208+
isTrue,
209+
reason:
210+
'Sort options must be dense to match the category, style, '
211+
'and visibility sheets.',
212+
);
213+
}
214+
215+
// The user-visible symptom was row pitch, not the flag: measure the
216+
// rendered height and compare it against a sheet that was always
217+
// dense, so this stays honest if Material changes its metrics.
218+
final sortRowHeight = tester
219+
.getSize(find.widgetWithText(ListTile, 'Name (A-Z)'))
220+
.height;
221+
222+
await tester.pumpWidget(directHost(const CategoryFilterSheet()));
223+
await tester.pumpAndSettle();
224+
225+
final categoryRowHeight = tester
226+
.getSize(find.widgetWithText(CheckboxListTile, 'Beer (2)'))
227+
.height;
228+
229+
expect(sortRowHeight, categoryRowHeight);
230+
},
231+
);
232+
192233
testWidgets('StyleFilterSheet shows styles in case-insensitive order', (
193234
tester,
194235
) async {

0 commit comments

Comments
 (0)