fix(app): use native selected affordance in runs sort sheet
This commit is contained in:
@@ -227,8 +227,18 @@ class RunsBarActions {
|
||||
// The current order is the sheet's default (bold) action.
|
||||
isDefaultAction: controller.sort == option.$1,
|
||||
onPressed: () => Navigator.pop(sheet, option.$1),
|
||||
child: Text(
|
||||
'${controller.sort == option.$1 ? '✓ ' : ''}${option.$2}',
|
||||
child: Semantics(
|
||||
selected: controller.sort == option.$1,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(option.$2),
|
||||
if (controller.sort == option.$1) ...[
|
||||
const SizedBox(width: 8),
|
||||
const Icon(CupertinoIcons.checkmark),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -150,6 +150,35 @@ void main() {
|
||||
expect(controller.sort, 'newest_first');
|
||||
});
|
||||
|
||||
testWidgets('Cupertino sort sheet marks the selected order with an icon', (
|
||||
tester,
|
||||
) async {
|
||||
await mount(tester, cupertino: true);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.sort')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('✓ Newest first'), findsNothing);
|
||||
final newestFirst = find.widgetWithText(
|
||||
CupertinoActionSheetAction,
|
||||
'Newest first',
|
||||
);
|
||||
expect(newestFirst, findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: newestFirst,
|
||||
matching: find.byIcon(CupertinoIcons.checkmark),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final selected = find.descendant(
|
||||
of: newestFirst,
|
||||
matching: find.byWidgetPredicate(
|
||||
(widget) => widget is Semantics && widget.properties.selected == true,
|
||||
),
|
||||
);
|
||||
expect(selected, findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the usage page is honest when nothing was reported', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user