Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 6 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ linter:
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
- always_specify_types
# - always_specify_types # conflicts with omit_obvious_local_variable_types
# - always_use_package_imports # we do this commonly
- annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
Expand Down Expand Up @@ -128,7 +128,8 @@ linter:
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
# - omit_local_variable_types # opposite of always_specify_types
# - omit_local_variable_types # conflicts with specify_nonobvious_local_variable_types
- omit_obvious_local_variable_types
# - one_member_abstracts # too many false positives
- only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al
- overridden_fields
Expand Down Expand Up @@ -187,10 +188,12 @@ linter:
- sort_constructors_first
- sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository.
- sort_unnamed_constructors_first
- specify_nonobvious_local_variable_types
- specify_nonobvious_property_types
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures # DIFFERENT FROM FLUTTER/FLUTTER: It's disabled there for "too many false positives"; that's not an issue here, and missing awaits have caused production issues in plugins.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class _ExampleSingleTile extends StatelessWidget {

@override
Widget build(BuildContext context) {
const double height = 100.0;
const height = 100.0;

return _InkWellOverlay(
openContainer: openContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class _CourseSwitchState extends State<_CourseSwitch> {

@override
Widget build(BuildContext context) {
final String subtitle = _value ? 'Bundled' : 'Shown Individually';
final subtitle = _value ? 'Bundled' : 'Shown Individually';
return SwitchListTile(
title: Text(widget.course),
subtitle: Text(subtitle),
Expand Down
13 changes: 6 additions & 7 deletions packages/animations/lib/src/open_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
required BuildContext navigatorContext,
bool delayForSourceRoute = false,
}) {
final RenderBox navigator =
final navigator =
Navigator.of(
navigatorContext,
rootNavigator: useRootNavigator,
Expand Down Expand Up @@ -679,8 +679,7 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
Rect _getRect(GlobalKey key, RenderBox ancestor) {
assert(key.currentContext != null);
assert(ancestor.hasSize);
final RenderBox render =
key.currentContext!.findRenderObject()! as RenderBox;
final render = key.currentContext!.findRenderObject()! as RenderBox;
assert(render.hasSize);
return MatrixUtils.transformRect(
render.getTransformTo(ancestor),
Expand All @@ -689,8 +688,8 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
}

bool get _transitionWasInterrupted {
bool wasInProgress = false;
bool isInProgress = false;
var wasInProgress = false;
var isInProgress = false;

switch (_currentAnimationStatus) {
case AnimationStatus.completed:
Expand Down Expand Up @@ -884,8 +883,8 @@ class _FlippableTweenSequence<T> extends TweenSequence<T> {

_FlippableTweenSequence<T>? get flipped {
if (_flipped == null) {
final List<TweenSequenceItem<T>> newItems = <TweenSequenceItem<T>>[];
for (int i = 0; i < _items.length; i++) {
final newItems = <TweenSequenceItem<T>>[];
for (var i = 0; i < _items.length; i++) {
newItems.add(
TweenSequenceItem<T>(
tween: _items[i].tween,
Expand Down
10 changes: 5 additions & 5 deletions packages/animations/lib/src/page_transition_switcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ class _PageTransitionSwitcherState extends State<PageTransitionSwitcher>
_activeEntries.forEach(_updateTransitionForEntry);
}

final bool hasNewChild = widget.child != null;
final bool hasOldChild = _currentEntry != null;
final hasNewChild = widget.child != null;
final hasOldChild = _currentEntry != null;
if (hasNewChild != hasOldChild ||
hasNewChild &&
!Widget.canUpdate(widget.child!, _currentEntry!.widgetChild)) {
Expand Down Expand Up @@ -327,11 +327,11 @@ class _PageTransitionSwitcherState extends State<PageTransitionSwitcher>
if (widget.child == null) {
return;
}
final AnimationController primaryController = AnimationController(
final primaryController = AnimationController(
duration: widget.duration,
vsync: this,
);
final AnimationController secondaryController = AnimationController(
final secondaryController = AnimationController(
duration: widget.duration,
vsync: this,
);
Expand Down Expand Up @@ -373,7 +373,7 @@ class _PageTransitionSwitcherState extends State<PageTransitionSwitcher>
primaryController,
secondaryController,
);
final _ChildEntry entry = _ChildEntry(
final entry = _ChildEntry(
widgetChild: child,
transition: KeyedSubtree.wrap(transition, _childNumber),
primaryController: primaryController,
Expand Down
8 changes: 4 additions & 4 deletions packages/animations/test/dual_transition_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';

void main() {
testWidgets('runs animations', (WidgetTester tester) async {
final AnimationController controller = AnimationController(
final controller = AnimationController(
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
);
Expand Down Expand Up @@ -75,7 +75,7 @@ void main() {
});

testWidgets('keeps state', (WidgetTester tester) async {
final AnimationController controller = AnimationController(
final controller = AnimationController(
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
);
Expand Down Expand Up @@ -146,7 +146,7 @@ void main() {
testWidgets('does not jump when interrupted - forward', (
WidgetTester tester,
) async {
final AnimationController controller = AnimationController(
final controller = AnimationController(
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
);
Expand Down Expand Up @@ -212,7 +212,7 @@ void main() {
testWidgets('does not jump when interrupted - reverse', (
WidgetTester tester,
) async {
final AnimationController controller = AnimationController(
final controller = AnimationController(
value: 1.0,
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
Expand Down
6 changes: 3 additions & 3 deletions packages/animations/test/fade_scale_transition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void main() {
});

testWidgets('should preserve state', (WidgetTester tester) async {
final AnimationController controller = AnimationController(
final controller = AnimationController(
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
);
Expand Down Expand Up @@ -416,7 +416,7 @@ double _getOpacity(GlobalKey key, WidgetTester tester) {
matching: find.byType(FadeTransition),
);
return tester.widgetList(finder).fold<double>(1.0, (double a, Widget widget) {
final FadeTransition transition = widget as FadeTransition;
final transition = widget as FadeTransition;
return a * transition.opacity.value;
});
}
Expand All @@ -427,7 +427,7 @@ double _getScale(GlobalKey key, WidgetTester tester) {
matching: find.byType(ScaleTransition),
);
return tester.widgetList(finder).fold<double>(1.0, (double a, Widget widget) {
final ScaleTransition transition = widget as ScaleTransition;
final transition = widget as ScaleTransition;
return a * transition.scale.value;
});
}
Expand Down
40 changes: 18 additions & 22 deletions packages/animations/test/fade_through_transition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ void main() {
testWidgets(
'FadeThroughPageTransitionsBuilder builds a FadeThroughTransition',
(WidgetTester tester) async {
final AnimationController animation = AnimationController(
vsync: const TestVSync(),
);
final AnimationController secondaryAnimation = AnimationController(
vsync: const TestVSync(),
);
final animation = AnimationController(vsync: const TestVSync());
final secondaryAnimation = AnimationController(vsync: const TestVSync());

await tester.pumpWidget(
const FadeThroughPageTransitionsBuilder().buildTransitions<void>(
Expand All @@ -34,9 +30,9 @@ void main() {
testWidgets('FadeThroughTransition runs forward', (
WidgetTester tester,
) async {
final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>();
const String bottomRoute = '/';
const String topRoute = '/a';
final navigator = GlobalKey<NavigatorState>();
const bottomRoute = '/';
const topRoute = '/a';

await tester.pumpWidget(_TestWidget(navigatorKey: navigator));
expect(find.text(bottomRoute), findsOneWidget);
Expand Down Expand Up @@ -116,9 +112,9 @@ void main() {
testWidgets('FadeThroughTransition runs backwards', (
WidgetTester tester,
) async {
final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>();
const String bottomRoute = '/';
const String topRoute = '/a';
final navigator = GlobalKey<NavigatorState>();
const bottomRoute = '/';
const topRoute = '/a';

await tester.pumpWidget(_TestWidget(navigatorKey: navigator));
navigator.currentState!.pushNamed('/a');
Expand Down Expand Up @@ -206,9 +202,9 @@ void main() {
testWidgets('FadeThroughTransition does not jump when interrupted', (
WidgetTester tester,
) async {
final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>();
const String bottomRoute = '/';
const String topRoute = '/a';
final navigator = GlobalKey<NavigatorState>();
const bottomRoute = '/';
const topRoute = '/a';

await tester.pumpWidget(_TestWidget(navigatorKey: navigator));
expect(find.text(bottomRoute), findsOneWidget);
Expand Down Expand Up @@ -271,9 +267,9 @@ void main() {
testWidgets('State is not lost when transitioning', (
WidgetTester tester,
) async {
final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>();
const String bottomRoute = '/';
const String topRoute = '/a';
final navigator = GlobalKey<NavigatorState>();
const bottomRoute = '/';
const topRoute = '/a';

await tester.pumpWidget(
_TestWidget(
Expand Down Expand Up @@ -358,11 +354,11 @@ void main() {
});

testWidgets('should keep state', (WidgetTester tester) async {
final AnimationController animation = AnimationController(
final animation = AnimationController(
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
);
final AnimationController secondaryAnimation = AnimationController(
final secondaryAnimation = AnimationController(
vsync: const TestVSync(),
duration: const Duration(milliseconds: 300),
);
Expand Down Expand Up @@ -431,7 +427,7 @@ double _getOpacity(String key, WidgetTester tester) {
matching: find.byType(FadeTransition),
);
return tester.widgetList(finder).fold<double>(1.0, (double a, Widget widget) {
final FadeTransition transition = widget as FadeTransition;
final transition = widget as FadeTransition;
return a * transition.opacity.value;
});
}
Expand All @@ -442,7 +438,7 @@ double _getScale(String key, WidgetTester tester) {
matching: find.byType(ScaleTransition),
);
return tester.widgetList(finder).fold<double>(1.0, (double a, Widget widget) {
final ScaleTransition transition = widget as ScaleTransition;
final transition = widget as ScaleTransition;
return a * transition.scale.value;
});
}
Expand Down
8 changes: 4 additions & 4 deletions packages/animations/test/modal_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void main() {
testWidgets('showModal builds a new route with specified route settings', (
WidgetTester tester,
) async {
const RouteSettings routeSettings = RouteSettings(
const routeSettings = RouteSettings(
name: 'route-name',
arguments: 'arguments',
);
Expand Down Expand Up @@ -473,7 +473,7 @@ void main() {
testWidgets('showModal builds a new route with specified image filter', (
WidgetTester tester,
) async {
final ui.ImageFilter filter = ui.ImageFilter.blur(sigmaX: 1, sigmaY: 1);
final filter = ui.ImageFilter.blur(sigmaX: 1, sigmaY: 1);

final Widget button = Builder(
builder: (BuildContext context) {
Expand Down Expand Up @@ -518,7 +518,7 @@ double _getOpacity(GlobalKey key, WidgetTester tester) {
matching: find.byType(FadeTransition),
);
return tester.widgetList(finder).fold<double>(1.0, (double a, Widget widget) {
final FadeTransition transition = widget as FadeTransition;
final transition = widget as FadeTransition;
return a * transition.opacity.value;
});
}
Expand All @@ -529,7 +529,7 @@ double _getScale(GlobalKey key, WidgetTester tester) {
matching: find.byType(ScaleTransition),
);
return tester.widgetList(finder).fold<double>(1.0, (double a, Widget widget) {
final ScaleTransition transition = widget as ScaleTransition;
final transition = widget as ScaleTransition;
return a * transition.scale.value;
});
}
Expand Down
Loading