Skip to content

Commit

Permalink
Add ignore: deprecated_member_use.
Browse files Browse the repository at this point in the history
  • Loading branch information
bernaferrari committed Mar 31, 2023
1 parent 4dedd7a commit 9293202
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/flutter/lib/src/semantics/semantics.dart
Expand Up @@ -669,6 +669,7 @@ class SemanticsData with Diagnosticable {
properties.add(DoubleProperty('elevation', elevation, defaultValue: 0.0));
properties.add(DoubleProperty('thickness', thickness, defaultValue: 0.0));
final List<String> actionSummary = <String>[
// ignore: deprecated_member_use
for (final SemanticsAction action in SemanticsAction.doNotUseWillBeDeletedWithoutWarningValuesAsList)
if ((actions & action.index) != 0)
describeEnum(action),
Expand All @@ -680,6 +681,7 @@ class SemanticsData with Diagnosticable {
properties.add(IterableProperty<String?>('customActions', customSemanticsActionSummary, ifEmpty: null));

final List<String> flagSummary = <String>[
// ignore: deprecated_member_use
for (final SemanticsFlag flag in SemanticsFlag.doNotUseWillBeDeletedWithoutWarningValuesAsList)
if ((flags & flag.index) != 0)
describeEnum(flag),
Expand Down Expand Up @@ -2755,6 +2757,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
.toList();
properties.add(IterableProperty<String>('actions', actions, ifEmpty: null));
properties.add(IterableProperty<String?>('customActions', customSemanticsActions, ifEmpty: null));
// ignore: deprecated_member_use
final List<String> flags = SemanticsFlag.doNotUseWillBeDeletedWithoutWarningValuesAsList.where((SemanticsFlag flag) => hasFlag(flag)).map((SemanticsFlag flag) => flag.toString().substring('SemanticsFlag.'.length)).toList();
properties.add(IterableProperty<String>('flags', flags, ifEmpty: null));
properties.add(FlagProperty('isInvisible', value: isInvisible, ifTrue: 'invisible'));
Expand Down
3 changes: 3 additions & 0 deletions packages/flutter/test/widgets/custom_painter_test.dart
Expand Up @@ -346,6 +346,7 @@ void _defineTests() {
),
),
));
// ignore: deprecated_member_use
final Set<SemanticsAction> allActions = SemanticsAction.doNotUseWillBeDeletedWithoutWarningValuesAsList.toSet()
..remove(SemanticsAction.customAction) // customAction is not user-exposed.
..remove(SemanticsAction.showOnScreen); // showOnScreen is not user-exposed
Expand Down Expand Up @@ -444,6 +445,7 @@ void _defineTests() {
),
),
));
// ignore: deprecated_member_use
List<SemanticsFlag> flags = SemanticsFlag.doNotUseWillBeDeletedWithoutWarningValuesAsList.toList();
// [SemanticsFlag.hasImplicitScrolling] isn't part of [SemanticsProperties]
// therefore it has to be removed.
Expand Down Expand Up @@ -498,6 +500,7 @@ void _defineTests() {
),
),
));
// ignore: deprecated_member_use
flags = SemanticsFlag.doNotUseWillBeDeletedWithoutWarningValuesAsList.toList();
// [SemanticsFlag.hasImplicitScrolling] isn't part of [SemanticsProperties]
// therefore it has to be removed.
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter/test/widgets/semantics_test.dart
Expand Up @@ -520,6 +520,7 @@ void main() {
),
);

// ignore: deprecated_member_use
final Set<SemanticsAction> allActions = SemanticsAction.doNotUseWillBeDeletedWithoutWarningValuesAsList.toSet()
..remove(SemanticsAction.moveCursorForwardByWord)
..remove(SemanticsAction.moveCursorBackwardByWord)
Expand Down Expand Up @@ -612,6 +613,7 @@ void main() {
liveRegion: true,
),
);
// ignore: deprecated_member_use
final List<SemanticsFlag> flags = SemanticsFlag.doNotUseWillBeDeletedWithoutWarningValuesAsList.toList();
flags
..remove(SemanticsFlag.hasToggledState)
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter/test/widgets/semantics_tester.dart
Expand Up @@ -633,6 +633,7 @@ class SemanticsTester {
static String _flagsToSemanticsFlagExpression(dynamic flags) {
Iterable<SemanticsFlag> list;
if (flags is int) {
// ignore: deprecated_member_use
list = SemanticsFlag.doNotUseWillBeDeletedWithoutWarningValuesAsList
.where((SemanticsFlag flag) => (flag.index & flags) != 0);
} else {
Expand All @@ -648,6 +649,7 @@ class SemanticsTester {
static String _actionsToSemanticsActionExpression(dynamic actions) {
Iterable<SemanticsAction> list;
if (actions is int) {
// ignore: deprecated_member_use
list = SemanticsAction.doNotUseWillBeDeletedWithoutWarningValuesAsList
.where((SemanticsAction action) => (action.index & actions) != 0);
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/flutter_test/test/matchers_test.dart
Expand Up @@ -613,9 +613,11 @@ void main() {
int actions = 0;
int flags = 0;
const CustomSemanticsAction action = CustomSemanticsAction(label: 'test');
// ignore: deprecated_member_use
for (final int index in SemanticsAction.doNotUseWillBeDeletedWithoutWarningKeys) {
actions |= index;
}
// ignore: deprecated_member_use
for (final int index in SemanticsFlag.doNotUseWillBeDeletedWithoutWarningKeys) {
flags |= index;
}
Expand Down Expand Up @@ -895,9 +897,11 @@ void main() {
int actions = 0;
int flags = 0;
const CustomSemanticsAction action = CustomSemanticsAction(label: 'test');
// ignore: deprecated_member_use
for (final int index in SemanticsAction.doNotUseWillBeDeletedWithoutWarningKeys) {
actions |= index;
}
// ignore: deprecated_member_use
for (final int index in SemanticsFlag.doNotUseWillBeDeletedWithoutWarningKeys) {
flags |= index;
}
Expand Down Expand Up @@ -1081,9 +1085,11 @@ void main() {
testWidgets('only matches given flags and actions', (WidgetTester tester) async {
int allActions = 0;
int allFlags = 0;
// ignore: deprecated_member_use
for (final int index in SemanticsAction.doNotUseWillBeDeletedWithoutWarningKeys) {
allActions |= index;
}
// ignore: deprecated_member_use
for (final int index in SemanticsFlag.doNotUseWillBeDeletedWithoutWarningKeys) {
allFlags |= index;
}
Expand Down

0 comments on commit 9293202

Please sign in to comment.