Skip to content

Commit

Permalink
Fix nullability issue in test (flutter#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer authored Mar 11, 2021
1 parent e062c60 commit f0b0736
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/animations/test/shared_axis_transition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void main() {
// Bottom route is fully faded out.
expect(find.text(bottomRoute), findsOneWidget);
expect(_getOpacity(bottomRoute, tester), 0.0);
final double? halfwayBottomOffset = _getTranslationOffset(
final double halfwayBottomOffset = _getTranslationOffset(
bottomRoute,
tester,
SharedAxisTransitionType.horizontal,
Expand All @@ -318,7 +318,7 @@ void main() {

// Top route is fading/coming in.
expect(find.text(topRoute), findsOneWidget);
final double? halfwayTopOffset = _getTranslationOffset(
final double halfwayTopOffset = _getTranslationOffset(
topRoute,
tester,
SharedAxisTransitionType.horizontal,
Expand Down Expand Up @@ -951,7 +951,7 @@ void main() {
// Bottom route is fully faded out.
expect(find.text(bottomRoute), findsOneWidget);
expect(_getOpacity(bottomRoute, tester), 0.0);
final double? halfwayBottomOffset = _getTranslationOffset(
final double halfwayBottomOffset = _getTranslationOffset(
bottomRoute,
tester,
SharedAxisTransitionType.vertical,
Expand All @@ -961,7 +961,7 @@ void main() {

// Top route is fading/coming in.
expect(find.text(topRoute), findsOneWidget);
final double? halfwayTopOffset = _getTranslationOffset(
final double halfwayTopOffset = _getTranslationOffset(
topRoute,
tester,
SharedAxisTransitionType.vertical,
Expand Down Expand Up @@ -1842,7 +1842,7 @@ double _getOpacity(String key, WidgetTester tester) {
});
}

double? _getTranslationOffset(
double _getTranslationOffset(
String key,
WidgetTester tester,
SharedAxisTransitionType transitionType,
Expand All @@ -1868,9 +1868,11 @@ double? _getTranslationOffset(
return a + translation.y;
});
case SharedAxisTransitionType.scaled:
// SharedAxisTransitionType.scaled should not return a translation
// offset.
return null;
assert(
false,
'SharedAxisTransitionType.scaled does not have a translation offset',
);
return 0.0;
}
}

Expand Down

0 comments on commit f0b0736

Please sign in to comment.