diff --git a/analysis_options.yaml b/analysis_options.yaml index f8fbbfc..b94fd6d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,33 +1,35 @@ -include: package:flutter_lints/flutter.yaml - analyzer: + language: + strict-casts: true + strict-inference: true + strict-raw-types: true + errors: - annotate_overrides: error - avoid_shadowing_type_parameters: warning - exhaustive_cases: warning - literal_only_boolean_expressions: warning - missing_required_param: warning - missing_return: warning - no_duplicate_case_values: error - only_throw_errors: error - override_on_non_overriding_member: error - unnecessary_overrides: error + collection_methods_unrelated_type: warning + missing_required_param: error + missing_return: error + record_literal_one_positional_no_trailing_comma: error + unrelated_type_equality_checks: warning linter: rules: - always_declare_return_types + - always_put_required_named_parameters_first + - always_use_package_imports - annotate_overrides - avoid_bool_literals_in_conditional_expressions - avoid_catching_errors + - 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 - avoid_function_literals_in_foreach_calls - - avoid_implementing_value_types - avoid_init_to_null - avoid_js_rounded_ints + - avoid_multiple_declarations_per_line - avoid_null_checks_in_equality_operators - avoid_print - avoid_private_typedef_functions @@ -54,15 +56,16 @@ linter: - cast_nullable_to_non_nullable - close_sinks - collection_methods_unrelated_type + - combinators_ordering - comment_references - conditional_uri_does_not_exist - constant_identifier_names - control_flow_in_finally - curly_braces_in_flow_control_structures + - dangling_library_doc_comments - depend_on_referenced_packages - deprecated_consistency - directives_ordering - - discarded_futures - empty_catches - empty_constructor_bodies - empty_statements @@ -71,21 +74,25 @@ linter: - file_names - hash_and_equals - implementation_imports - - iterable_contains_unrelated_type + - implicit_call_tearoffs + - implicit_reopen + - invalid_case_patterns - join_return_with_assignment - leading_newlines_in_multiline_strings - library_names - library_prefixes - library_private_types_in_public_api - - list_remove_unrelated_type - literal_only_boolean_expressions + - matching_super_parameters - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_duplicate_case_values - no_leading_underscores_for_library_prefixes - no_leading_underscores_for_local_identifiers + - no_literal_bool_comparisons - no_logic_in_create_state - no_runtimeType_toString + - no_wildcard_variable_uses - non_constant_identifier_names - noop_primitive_operations - null_check_on_nullable_type_parameter @@ -93,7 +100,6 @@ linter: - omit_local_variable_types - only_throw_errors - overridden_fields - - package_api_docs - package_names - package_prefixed_library_names - parameter_assignments @@ -132,10 +138,12 @@ linter: - provide_deprecation_message - recursive_getters - require_trailing_commas + - secure_pubspec_urls - sized_box_for_whitespace - sized_box_shrink_expand - slash_for_doc_comments - sort_child_properties_last + - sort_pub_dependencies - sort_unnamed_constructors_first - test_types_in_equals - throw_in_finally @@ -145,6 +153,7 @@ linter: - unawaited_futures - unnecessary_await_in_return - unnecessary_brace_in_string_interps + - unnecessary_breaks - unnecessary_const - unnecessary_constructor_name - unnecessary_getters_setters @@ -171,15 +180,17 @@ linter: - use_enums - use_full_hex_values_for_flutter_colors - use_function_type_syntax_for_parameters + - use_if_null_to_convert_nulls_to_bools - use_is_even_rather_than_modulo - use_key_in_widget_constructors - - use_late_for_private_fields_and_variables - use_named_constants - use_raw_strings - use_rethrow_when_possible - use_setters_to_change_properties - use_string_buffers + - use_string_in_part_of_directives - use_super_parameters + - use_test_throws_matchers - use_to_and_as_if_applicable - valid_regexps - void_checks diff --git a/example/lib/example_candidate_model.dart b/example/lib/example_candidate_model.dart index 0f53a26..f6465cd 100644 --- a/example/lib/example_candidate_model.dart +++ b/example/lib/example_candidate_model.dart @@ -1,10 +1,10 @@ import 'package:flutter/cupertino.dart'; class ExampleCandidateModel { - String name; - String job; - String city; - List color; + final String name; + final String job; + final String city; + final List color; ExampleCandidateModel({ required this.name, diff --git a/example/lib/example_card.dart b/example/lib/example_card.dart index dc5c7fa..edfd6e5 100644 --- a/example/lib/example_card.dart +++ b/example/lib/example_card.dart @@ -1,7 +1,6 @@ +import 'package:example/example_candidate_model.dart'; import 'package:flutter/material.dart'; -import 'example_candidate_model.dart'; - class ExampleCard extends StatelessWidget { final ExampleCandidateModel candidate; @@ -23,7 +22,7 @@ class ExampleCard extends StatelessWidget { spreadRadius: 3, blurRadius: 7, offset: const Offset(0, 3), - ) + ), ], ), alignment: Alignment.center, @@ -66,7 +65,7 @@ class ExampleCard extends StatelessWidget { Text( candidate.city, style: const TextStyle(color: Colors.grey), - ) + ), ], ), ), diff --git a/lib/src/card_animation.dart b/lib/src/card_animation.dart index 183efc7..c19c6f5 100644 --- a/lib/src/card_animation.dart +++ b/lib/src/card_animation.dart @@ -117,7 +117,8 @@ class CardAnimation { void updateDifference() { final discrepancy = (total / 10).abs(); - var diffX = 0.0, diffY = 0.0; + var diffX = 0.0; + var diffY = 0.0; if (initialOffset.dx > 0) { diffX = discrepancy; diff --git a/lib/src/card_swiper.dart b/lib/src/card_swiper.dart index e30b5c7..f341871 100644 --- a/lib/src/card_swiper.dart +++ b/lib/src/card_swiper.dart @@ -127,9 +127,9 @@ class CardSwiper extends StatefulWidget { final Offset backCardOffset; const CardSwiper({ - Key? key, required this.cardBuilder, required this.cardsCount, + Key? key, this.controller, this.initialIndex = 0, this.padding = const EdgeInsets.symmetric(horizontal: 20, vertical: 25), diff --git a/pubspec.yaml b/pubspec.yaml index 5369429..4d9aa9c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.1 screenshots: - description: "Example of the widget."