Skip to content
Open
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
  •  
  •  
  •  
37 changes: 27 additions & 10 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify analysis options.
#
# This file is a copy of analysis_options.yaml from flutter repo
# as of 2023-12-18, but with some modifications marked with
# as of 2026-05-11, but with some modifications marked with
# "DIFFERENT FROM FLUTTER/FLUTTER" below. The file is expected to
# be kept in sync with the master file from the flutter repo.

Expand All @@ -22,33 +22,40 @@ analyzer:
- '**/*.g.dart'
- '**/*.mocks.dart' # Mockito @GenerateMocks

formatter:
page_width: 100

linter:
rules:
# This list is derived from the list of all available lints located at
# https://github.com/dart-lang/linter/blob/main/example/all.yaml
# https://github.com/dart-lang/sdk/blob/main/pkg/linter/example/all.yaml
- 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 # 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
- annotate_redeclares
# - avoid_annotating_with_dynamic # conflicts with type_annotate_public_apis
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/4998
# - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es
- avoid_double_and_int_checks
- avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
# - avoid_final_parameters # incompatible with prefer_final_parameters
# TODO(kallentu): Remove this lint once the Dart SDK in Flutter is on version 3.13.
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
# - avoid_futureor_void # not yet tested
# - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558
- avoid_init_to_null
- avoid_js_rounded_ints
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
- avoid_print
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
Expand All @@ -64,7 +71,7 @@ linter:
- avoid_slow_async_io
- avoid_type_to_string
- avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
# - avoid_types_on_closure_parameters # not yet tested
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
Expand All @@ -91,6 +98,7 @@ linter:
- directives_ordering
# - discarded_futures # too many false positives, similar to unawaited_futures
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
# - document_ignores # not yet tested
- empty_catches
- empty_constructor_bodies
- empty_statements
Expand All @@ -103,6 +111,7 @@ linter:
- implicit_call_tearoffs
- implicit_reopen
- invalid_case_patterns
- invalid_runtime_check_with_js_interop_types
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
- library_annotations
Expand All @@ -114,7 +123,7 @@ linter:
# - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509
- missing_code_block_language_in_doc_comment
- missing_whitespace_between_adjacent_strings
# - no_adjacent_strings_in_list # conflicts with prefer_adjacent_string_concatenation
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
Expand All @@ -128,12 +137,12 @@ linter:
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
# - omit_local_variable_types # conflicts with specify_nonobvious_local_variable_types
# - omit_local_variable_types # superset of omit_obvious_local_variable_types
- omit_obvious_local_variable_types
# - omit_obvious_property_types # conflicts with type_annotate_public_apis
# - 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
# - package_api_docs # Deprecated (https://github.com/dart-lang/linter/issues/5107)
- package_names
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
Expand All @@ -149,8 +158,8 @@ linter:
# - prefer_constructors_over_static_methods # far too many false positives
- prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods
- prefer_final_fields
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods
- prefer_final_in_for_each
- prefer_final_locals
# - prefer_final_parameters # adds too much verbosity
Expand Down Expand Up @@ -190,6 +199,7 @@ linter:
- sort_unnamed_constructors_first
- specify_nonobvious_local_variable_types
- specify_nonobvious_property_types
- strict_top_level_inference
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
Expand All @@ -205,9 +215,11 @@ linter:
- unnecessary_constructor_name
# - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters
# - unnecessary_ignore # Disabled by default to simplify migrations; should be periodically enabled locally to clean up offenders
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_late
- unnecessary_library_directive
# - unnecessary_library_name # blocked on https://github.com/dart-lang/dartdoc/issues/3882
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
Expand All @@ -222,8 +234,10 @@ linter:
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unnecessary_underscores
- unreachable_from_main
- unrelated_type_equality_checks
# - unsafe_variance # not yet tested
- use_build_context_synchronously
- use_colored_box
# - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding)
Expand All @@ -243,5 +257,8 @@ linter:
- use_super_parameters
- use_test_throws_matchers
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- use_truncating_division
- valid_regexps
# TODO(kallentu): Remove this lint once the Dart SDK in Flutter is on version 3.13.
- var_with_no_type_annotation
- void_checks
17 changes: 8 additions & 9 deletions packages/animations/example/lib/container_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class OpenContainerTransformDemo extends StatefulWidget {
}
}

class _OpenContainerTransformDemoState
extends State<OpenContainerTransformDemo> {
class _OpenContainerTransformDemoState extends State<OpenContainerTransformDemo> {
ContainerTransitionType _transitionType = ContainerTransitionType.fade;

void _showMarkedAsDoneSnackbar(bool? isMarkedAsDone) {
Expand Down Expand Up @@ -529,18 +528,18 @@ class _DetailsPage extends StatelessWidget {
Text(
'Title',
style: Theme.of(context).textTheme.headlineSmall!.copyWith(
color: Colors.black54,
fontSize: 30.0,
),
color: Colors.black54,
fontSize: 30.0,
),
),
const SizedBox(height: 10),
Text(
_loremIpsumParagraph,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Colors.black54,
height: 1.5,
fontSize: 16.0,
),
color: Colors.black54,
height: 1.5,
fontSize: 16.0,
),
),
],
),
Expand Down
26 changes: 12 additions & 14 deletions packages/animations/example/lib/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class FadeScaleTransitionDemo extends StatefulWidget {
const FadeScaleTransitionDemo({super.key});

@override
State<FadeScaleTransitionDemo> createState() =>
_FadeScaleTransitionDemoState();
State<FadeScaleTransitionDemo> createState() => _FadeScaleTransitionDemoState();
}

class _FadeScaleTransitionDemoState extends State<FadeScaleTransitionDemo>
Expand All @@ -21,19 +20,18 @@ class _FadeScaleTransitionDemoState extends State<FadeScaleTransitionDemo>

@override
void initState() {
_controller =
AnimationController(
value: 0.0,
duration: const Duration(milliseconds: 150),
reverseDuration: const Duration(milliseconds: 75),
vsync: this,
)..addStatusListener((AnimationStatus status) {
setState(() {
// setState needs to be called to trigger a rebuild because
// the 'HIDE FAB'/'SHOW FAB' button needs to be updated based
// the latest value of [_controller.status].
});
_controller = AnimationController(
value: 0.0,
duration: const Duration(milliseconds: 150),
reverseDuration: const Duration(milliseconds: 75),
vsync: this,
)..addStatusListener((AnimationStatus status) {
setState(() {
// setState needs to be called to trigger a rebuild because
// the 'HIDE FAB'/'SHOW FAB' button needs to be updated based
// the latest value of [_controller.status].
});
});
super.initState();
}

Expand Down
26 changes: 12 additions & 14 deletions packages/animations/example/lib/fade_through_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class FadeThroughTransitionDemo extends StatefulWidget {
const FadeThroughTransitionDemo({super.key});

@override
State<FadeThroughTransitionDemo> createState() =>
_FadeThroughTransitionDemoState();
State<FadeThroughTransitionDemo> createState() => _FadeThroughTransitionDemoState();
}

class _FadeThroughTransitionDemoState extends State<FadeThroughTransitionDemo> {
Expand All @@ -25,18 +24,17 @@ class _FadeThroughTransitionDemoState extends State<FadeThroughTransitionDemo> {
return Scaffold(
appBar: AppBar(title: const Text('Fade through')),
body: PageTransitionSwitcher(
transitionBuilder:
(
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return FadeThroughTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
child: child,
);
},
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return FadeThroughTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
child: child,
);
},
child: pageList[pageIndex],
),
bottomNavigationBar: BottomNavigationBar(
Expand Down
28 changes: 13 additions & 15 deletions packages/animations/example/lib/shared_axis_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class SharedAxisTransitionDemo extends StatefulWidget {
}

class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
SharedAxisTransitionType? _transitionType =
SharedAxisTransitionType.horizontal;
SharedAxisTransitionType? _transitionType = SharedAxisTransitionType.horizontal;
bool _isLoggedIn = false;

void _updateTransitionType(SharedAxisTransitionType? newType) {
Expand All @@ -44,19 +43,18 @@ class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
Expanded(
child: PageTransitionSwitcher(
reverse: !_isLoggedIn,
transitionBuilder:
(
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: _transitionType!,
child: child,
);
},
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: _transitionType!,
child: child,
);
},
child: _isLoggedIn ? _CoursePage() : _SignInPage(),
),
),
Expand Down
32 changes: 15 additions & 17 deletions packages/animations/lib/src/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,21 @@ class FadeScaleTransition extends StatelessWidget {
Widget build(BuildContext context) {
return DualTransitionBuilder(
animation: animation,
forwardBuilder:
(BuildContext context, Animation<double> animation, Widget? child) {
return FadeTransition(
opacity: _fadeInTransition.animate(animation),
child: ScaleTransition(
scale: _scaleInTransition.animate(animation),
child: child,
),
);
},
reverseBuilder:
(BuildContext context, Animation<double> animation, Widget? child) {
return FadeTransition(
opacity: _fadeOutTransition.animate(animation),
child: child,
);
},
forwardBuilder: (BuildContext context, Animation<double> animation, Widget? child) {
return FadeTransition(
opacity: _fadeInTransition.animate(animation),
child: ScaleTransition(
scale: _scaleInTransition.animate(animation),
child: child,
),
);
},
reverseBuilder: (BuildContext context, Animation<double> animation, Widget? child) {
return FadeTransition(
opacity: _fadeOutTransition.animate(animation),
child: child,
);
},
child: child,
);
}
Expand Down
Loading
Loading