screen-locker/stronglift_replacement/workout_app/test/icon_finders.dart
Krzysztof kuhy Rudnicki 5f2925a550 Move workout_app to Flutter 3.50 material_ui
Flutter 3.50 deprecates package:flutter/material.dart, which made
flutter-analyze report 27 deprecated_member_use infos and blocked the
gate. workout_app now imports material_ui 1.11.0, with crdt_sync_dart
0.14.1 and sync_settings_ui 0.8.2 (both on material_ui).

material_ui's MaterialApp ships its own MaterialLocalizations, so a
package that still calls the framework showDialog threw a null check.
WorkoutApp now adds the framework delegate, and a widget test opens a
material_ui and a framework dialog through the real app root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
2026-11-16 08:54:33 +01:00

30 lines
1.1 KiB
Dart

/// Finders for icon-only controls (textgate: the old words survive only as
/// the icon's spoken `semanticLabel`).
library;
import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
/// The [Icon] whose spoken label is exactly [label].
Finder iconLabeled(String label) => find.byWidgetPredicate(
(w) => w is Icon && w.semanticLabel == label,
description: 'Icon labelled "$label"',
);
/// The nearest [T] (a button type) around the icon labelled [label].
Finder buttonLabeled<T extends Widget>(String label) =>
find.ancestor(of: iconLabeled(label), matching: find.byType(T));
/// The [Icon] whose spoken label contains [part].
Finder iconLabelContaining(String part) => find.byWidgetPredicate(
(w) => w is Icon && (w.semanticLabel?.contains(part) ?? false),
description: 'Icon labelled with "$part"',
);
/// The [Semantics] widget whose label is exactly [label] (a painted-glyph
/// group whose old sentence is spoken only).
Finder semanticsLabeled(String label) => find.byWidgetPredicate(
(w) => w is Semantics && w.properties.label == label,
description: 'Semantics labelled "$label"',
);