Skip to content

Commit

Permalink
Merge pull request #355 from madmini/fix/finder-flutter-update
Browse files Browse the repository at this point in the history
Update DelegatingFinder for flutter 3.16.2
  • Loading branch information
fzyzcjy authored Dec 5, 2023
2 parents c24191d + ed9b8b9 commit 552bc7f
Showing 1 changed file with 51 additions and 5 deletions.
56 changes: 51 additions & 5 deletions packages/convenient_test_dev/lib/src/utils/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,33 @@ import 'package:test_api/src/backend/state.dart'; // ignore_for_file: implementa

class DelegatingFinder implements Finder {
final Finder target;
@Deprecated('Use FinderBase.describeMatch instead. '
'FinderBase.describeMatch allows for more readable descriptions and removes ambiguity about pluralization. '
'This feature was deprecated after v3.13.0-0.2.pre.')
final String? overrideDescription;
final String Function(Plurality)? overrideDescribeMatch;

DelegatingFinder(this.target, {this.overrideDescription});
DelegatingFinder(
this.target, {
@Deprecated('Use FinderBase.describeMatch instead. '
'FinderBase.describeMatch allows for more readable descriptions and removes ambiguity about pluralization. '
'This feature was deprecated after v3.13.0-0.2.pre.')
this.overrideDescription,
this.overrideDescribeMatch,
});

@override
@Deprecated('Use FinderBase.describeMatch instead. '
'FinderBase.describeMatch allows for more readable descriptions and removes ambiguity about pluralization. '
'This feature was deprecated after v3.13.0-0.2.pre.')
String get description => overrideDescription ?? target.description;

@override
Iterable<Element> apply(Iterable<Element> candidates) => target.apply(candidates);
@Deprecated('Override FinderBase.findInCandidates instead. '
'Using the FinderBase API allows for more consistent caching behavior and cleaner options for interacting with the widget tree. '
'This feature was deprecated after v3.13.0-0.2.pre.')
Iterable<Element> apply(Iterable<Element> candidates) =>
target.apply(candidates);

@override
bool get skipOffstage => target.skipOffstage;
Expand All @@ -22,9 +40,12 @@ class DelegatingFinder implements Finder {
Iterable<Element> get allCandidates => target.allCandidates;

@override
Iterable<Element> evaluate() => target.evaluate();
FinderResult<Element> evaluate() => target.evaluate();

@override
@Deprecated('Use FinderBase.tryFind or FinderBase.runCached instead. '
'Using the FinderBase API allows for more consistent caching behavior and cleaner options for interacting with the widget tree. '
'This feature was deprecated after v3.13.0-0.2.pre.')
bool precache() => target.precache();

@override
Expand All @@ -37,10 +58,35 @@ class DelegatingFinder implements Finder {
Finder at(int index) => target.at(index);

@override
Finder hitTestable({Alignment at = Alignment.center}) => target.hitTestable(at: at);
Finder hitTestable({Alignment at = Alignment.center}) =>
target.hitTestable(at: at);

@override
String toString() => target.toString();
String toString({bool describeSelf = false}) =>
target.toString(describeSelf: describeSelf);

@override
String describeMatch(Plurality plurality) =>
overrideDescribeMatch?.call(plurality) ?? target.describeMatch(plurality);

@override
Iterable<Element> findInCandidates(Iterable<Element> candidates) =>
target.findInCandidates(candidates);

@override
FinderResult<Element> get found => target.found;

@override
bool get hasFound => target.hasFound;

@override
void reset() => target.reset();

@override
void runCached(VoidCallback run) => target.runCached(run);

@override
bool tryEvaluate() => target.tryEvaluate();
}

extension ExtState on State {
Expand Down

0 comments on commit 552bc7f

Please sign in to comment.