diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 485af01..13e22cc 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-5.0.2/","dependencies":[]},{"name":"package_info","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/","dependencies":[]},{"name":"path_provider_ios","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.7/","dependencies":[]},{"name":"shared_preferences_ios","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.0.10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"sqflite_sqlcipher","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_sqlcipher-2.1.0/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.5.1/","dependencies":[]},{"name":"url_launcher_ios","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.15/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-5.0.2/","dependencies":[]},{"name":"package_info","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/","dependencies":[]},{"name":"path_provider_android","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.11/","dependencies":[]},{"name":"shared_preferences_android","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_android-2.0.11/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"sqflite_sqlcipher","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_sqlcipher-2.1.0/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.5.1/","dependencies":[]},{"name":"url_launcher_android","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_android-6.0.15/","dependencies":[]}],"macos":[{"name":"flutter_secure_storage_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_macos-1.1.0/","dependencies":[]},{"name":"package_info","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.5/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.3/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"sqflite_sqlcipher","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_sqlcipher-2.1.0/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-3.0.0/","dependencies":[]}],"linux":[{"name":"flutter_secure_storage_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_linux-1.1.0/","dependencies":[]},{"name":"path_provider_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.5/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.1.0/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-3.0.0/","dependencies":[]}],"windows":[{"name":"flutter_secure_storage_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_windows-1.1.2/","dependencies":[]},{"name":"path_provider_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/","dependencies":[]},{"name":"shared_preferences_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.1.0/","dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-3.0.0/","dependencies":[]}],"web":[{"name":"flutter_secure_storage_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_web-1.0.2/","dependencies":[]},{"name":"shared_preferences_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.3/","dependencies":[]},{"name":"uni_links_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links_web-0.1.0/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.8/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_ios","shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_ios","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"sqflite_sqlcipher","dependencies":[]},{"name":"uni_links","dependencies":["uni_links_web"]},{"name":"uni_links_web","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2022-02-11 20:58:40.315788","version":"2.10.1"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-5.0.2/","dependencies":[]},{"name":"package_info","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/","dependencies":[]},{"name":"path_provider_ios","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.7/","dependencies":[]},{"name":"shared_preferences_ios","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.0.10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"sqflite_sqlcipher","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_sqlcipher-2.1.0/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.5.1/","dependencies":[]},{"name":"url_launcher_ios","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.15/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-5.0.2/","dependencies":[]},{"name":"package_info","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/","dependencies":[]},{"name":"path_provider_android","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.11/","dependencies":[]},{"name":"shared_preferences_android","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_android-2.0.11/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"sqflite_sqlcipher","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_sqlcipher-2.1.0/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.5.1/","dependencies":[]},{"name":"url_launcher_android","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_android-6.0.15/","dependencies":[]}],"macos":[{"name":"flutter_secure_storage_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_macos-1.1.0/","dependencies":[]},{"name":"package_info","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.5/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.3/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.2/","dependencies":[]},{"name":"sqflite_sqlcipher","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_sqlcipher-2.1.0/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-3.0.0/","dependencies":[]}],"linux":[{"name":"flutter_secure_storage_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_linux-1.1.0/","dependencies":[]},{"name":"path_provider_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.5/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.1.0/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-3.0.0/","dependencies":[]}],"windows":[{"name":"flutter_secure_storage_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_windows-1.1.2/","dependencies":[]},{"name":"path_provider_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/","dependencies":[]},{"name":"shared_preferences_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.1.0/","dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-3.0.0/","dependencies":[]}],"web":[{"name":"flutter_secure_storage_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage_web-1.0.2/","dependencies":[]},{"name":"shared_preferences_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.3/","dependencies":[]},{"name":"uni_links_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links_web-0.1.0/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.8/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_ios","shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_ios","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"sqflite_sqlcipher","dependencies":[]},{"name":"uni_links","dependencies":["uni_links_web"]},{"name":"uni_links_web","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2022-02-16 17:05:51.140854","version":"2.10.1"} \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index 2d567fe..f065cf1 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,199 +1,29 @@ -# Specify analysis options. +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. # -# Until there are meta linter rules, each desired lint must be explicitly enabled. -# See: https://github.com/dart-lang/linter/issues/288 -# -# For a list of lints, see: http://dart-lang.github.io/linter/lints/ -# See the configuration guide for more -# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer -# -# There are other similar analysis options files in the flutter repos, -# which should be kept in sync with this file: -# -# - analysis_options.yaml (this file) -# - packages/flutter/lib/analysis_options_user.yaml -# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml -# - https://github.com/flutter/engine/blob/master/analysis_options.yaml -# -# This file contains the analysis options used by Flutter tools, such as IntelliJ, -# Android Studio, and the `flutter analyze` command. +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - errors: - missing_required_param: warning - missing_return: warning - # Ignore analyzer hints for updating pubspecs when using Future or - # Stream and not importing dart:async - # Please see https://github.com/flutter/flutter/pull/24528 for details. - sdk_version_async_exported_from_core: ignore - exclude: - - "lib/i18n/messages_*.dart" - # HAS:20200527 This is generated code, so I cannot influence it - - "lib/model/model.dart" - - "lib/model/model.g.dart" +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. rules: - - 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_require_non_null_named_parameters - - always_specify_types - - annotate_overrides - # - avoid_annotating_with_dynamic # conflicts with always_specify_types - # - avoid_as # required for implicit-casts: true - - avoid_bool_literals_in_conditional_expressions - # - avoid_catches_without_on_clauses # we do this commonly - # - avoid_catching_errors # we do this commonly - - avoid_classes_with_only_static_members - # - avoid_double_and_int_checks # only useful when targeting JS runtime - - avoid_empty_else - - avoid_equals_and_hash_code_on_mutable_classes - - avoid_field_initializers_in_const_classes - - avoid_function_literals_in_foreach_calls - # - avoid_implementing_value_types # not yet tested - - avoid_init_to_null - # - avoid_js_rounded_ints # only useful when targeting JS runtime - - avoid_null_checks_in_equality_operators - # - avoid_positional_boolean_parameters # not yet tested - # - avoid_print # not yet tested - # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) - # - avoid_redundant_argument_values # not yet tested - - avoid_relative_lib_imports - - avoid_renaming_method_parameters - - avoid_return_types_on_setters - # - avoid_returning_null # there are plenty of valid reasons to return null - # - avoid_returning_null_for_future # not yet tested - - avoid_returning_null_for_void - # - avoid_returning_this # there are plenty of valid reasons to return this - # - avoid_setters_without_getters # not yet tested - # - avoid_shadowing_type_parameters # not yet tested - - avoid_single_cascade_in_expression_statements - - avoid_slow_async_io - - avoid_types_as_parameter_names - # - avoid_types_on_closure_parameters # conflicts with always_specify_types - # - avoid_unnecessary_containers # not yet tested - - avoid_unused_constructor_parameters - - avoid_void_async - # - avoid_web_libraries_in_flutter # not yet tested - - await_only_futures - - camel_case_extensions - - camel_case_types - - cancel_subscriptions - # - cascade_invocations # not yet tested - # - close_sinks # not reliable enough - # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765 - # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 - - control_flow_in_finally - # - curly_braces_in_flow_control_structures # not yet tested - # - diagnostic_describe_all_properties # not yet tested - - directives_ordering - - empty_catches - - empty_constructor_bodies - - empty_statements - # - file_names # not yet tested - - flutter_style_todos - - hash_and_equals - - implementation_imports - # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 - - iterable_contains_unrelated_type - # - join_return_with_assignment # not yet tested - - library_names - - library_prefixes - # - lines_longer_than_80_chars # not yet tested - - list_remove_unrelated_type - # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 - # - missing_whitespace_between_adjacent_strings # not yet tested - - no_adjacent_strings_in_list - - no_duplicate_case_values - # - no_logic_in_create_state # not yet tested - # - no_runtimeType_toString # not yet tested - - non_constant_identifier_names - # - null_closures # not yet tested - # - omit_local_variable_types # opposite of always_specify_types - # - one_member_abstracts # too many false positives - # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 - - overridden_fields - - package_api_docs - - package_names - - package_prefixed_library_names - # - parameter_assignments # we do this commonly - - prefer_adjacent_string_concatenation - - prefer_asserts_in_initializer_lists - # - prefer_asserts_with_message # not yet tested - - prefer_collection_literals - - prefer_conditional_assignment - - prefer_const_constructors - - prefer_const_constructors_in_immutables - - prefer_const_declarations - - prefer_const_literals_to_create_immutables - # - prefer_constructors_over_static_methods # not yet tested - - prefer_contains - # - prefer_double_quotes # opposite of prefer_single_quotes - - prefer_equal_for_default_values - # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods - - prefer_final_fields - - prefer_final_in_for_each - - prefer_final_locals - - prefer_for_elements_to_map_fromIterable - - prefer_foreach - # - prefer_function_declarations_over_variables # not yet tested - - prefer_generic_function_type_aliases - - prefer_if_elements_to_conditional_expressions - - prefer_if_null_operators - - prefer_initializing_formals - - prefer_inlined_adds - # - prefer_int_literals # not yet tested - # - prefer_interpolation_to_compose_strings # not yet tested - - prefer_is_empty - - prefer_is_not_empty - - prefer_is_not_operator - - prefer_iterable_whereType - # - prefer_mixin # https://github.com/dart-lang/language/issues/32 - # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932 - # - prefer_relative_imports # not yet tested - - prefer_single_quotes - - prefer_spread_collections - - prefer_typing_uninitialized_variables - - prefer_void_to_null - # - provide_deprecation_message # not yet tested - # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml - - recursive_getters - - slash_for_doc_comments - # - sort_child_properties_last # not yet tested - - sort_constructors_first - - sort_pub_dependencies - - sort_unnamed_constructors_first - - test_types_in_equals - - throw_in_finally - # - type_annotate_public_apis # subset of always_specify_types - - type_init_formals - # - unawaited_futures # too many false positives - # - unnecessary_await_in_return # not yet tested - - unnecessary_brace_in_string_interps - - unnecessary_const - # - unnecessary_final # conflicts with prefer_final_locals - - unnecessary_getters_setters - # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 - - unnecessary_new - - unnecessary_null_aware_assignments - - unnecessary_null_in_if_null_operators - - unnecessary_overrides - - unnecessary_parenthesis - - unnecessary_statements - - unnecessary_string_interpolations - - unnecessary_this - - unrelated_type_equality_checks - # - unsafe_html # not yet tested - - use_full_hex_values_for_flutter_colors - # - use_function_type_syntax_for_parameters # not yet tested - # - use_key_in_widget_constructors # not yet tested - - use_rethrow_when_possible - # - use_setters_to_change_properties # not yet tested - # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 - # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review - - valid_regexps - - void_checks + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 43f4470..a3f50cd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -576,7 +576,7 @@ * `2019-09-19 16:58` [6480ce2](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/6480ce2) - refactoring * `2019-09-19 16:46` [3a1432a](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/3a1432a) - switch to sqfentity * `2019-09-18 16:51` [0825952](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/0825952) - create table athletes, if it does not exist -* `2019-09-18 14:50` [49f873a](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/49f873a) - persisting athlete, todo: create database and table +* `2019-09-18 14:50` [49f873a](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/49f873a) - persisting athlete, create database and table * `2019-08-18 15:11` [6e6b0f5](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/6e6b0f5) - lots of small reformattings and reorganisations * `2019-08-17 20:21` [3c79a87](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/3c79a87) - fix all linting issues * `2019-08-17 11:51` [fe55e2a](https://gitlab.informatom.com/3-schweinehunde/encrateia/-/commit/fe55e2a) - store data in scoped model diff --git a/lib/actions/parse_activity.dart b/lib/actions/parse_activity.dart index be46e53..4fe1a7a 100644 --- a/lib/actions/parse_activity.dart +++ b/lib/actions/parse_activity.dart @@ -23,9 +23,9 @@ Future parseActivity({ try { percentageStream = activity.parse(athlete: athlete); await for (final int value in percentageStream) { - if (value == -2) - await flushbar?.dismiss(); - else if (value == -1) { + if (value == -2) { + var object = await flushbar?.dismiss(); + } else if (value == -1) { await flushbar?.dismiss(); flushbar = Flushbar( message: 'Analysing »${activity.name}«', diff --git a/lib/models/activity.dart b/lib/models/activity.dart index a9a9d73..edea51b 100644 --- a/lib/models/activity.dart +++ b/lib/models/activity.dart @@ -169,24 +169,27 @@ class Activity { // calculated from other attributes: double get avgPace { - if (avgSpeed != null && avgSpeed != 0) + if (avgSpeed != null && avgSpeed != 0) { return 50 / 3 / avgSpeed; - else + } else { return null; + } } double get avgSpeedPerHeartRate { - if (avgSpeed != null && heartRateAvailable) + if (avgSpeed != null && heartRateAvailable) { return 60 * avgSpeed / avgHeartRate; - else + } else { return null; + } } double get avgPowerPerHeartRate { - if (powerAvailable && heartRateAvailable) + if (powerAvailable && heartRateAvailable) { return avgPower / avgHeartRate; - else + } else { return null; + } } int get elevationDifference => @@ -567,9 +570,10 @@ class Activity { final DateTime startTime = dateTimeFromStrava(dataMessage.get('start_time') as double); - if (name == 'new activity') + if (name == 'new activity') { name = 'Activity on ' + DateFormat.yMMMMd('en_US').format(startTime); + } _db ..timeStamp = dateTimeFromStrava(dataMessage.get('timestamp') as double) diff --git a/lib/models/activity_list.dart b/lib/models/activity_list.dart index 7287c4f..6c5e059 100644 --- a/lib/models/activity_list.dart +++ b/lib/models/activity_list.dart @@ -80,10 +80,10 @@ class ActivityList extends DelegatingList { { firstGroupWithData = false; activityIds = activityIdsFromThisGroup; - } else - // For the others: intersect. + } else { activityIds.removeWhere( (int tagId) => !activityIdsFromThisGroup.contains(tagId)); + } } } } diff --git a/lib/models/activity_tagging.dart b/lib/models/activity_tagging.dart index 13eacea..03d6905 100644 --- a/lib/models/activity_tagging.dart +++ b/lib/models/activity_tagging.dart @@ -39,9 +39,9 @@ class ActivityTagging { .equals(tag.id) .toSingle(); - if (dbActivityTagging != null) + if (dbActivityTagging != null) { return ActivityTagging._fromDb(dbActivityTagging); - else { + } else { final ActivityTagging activityTagging = ActivityTagging( activity: activity, tag: tag, system: system ?? false); await activityTagging._db.save(); @@ -61,8 +61,9 @@ class ActivityTagging { .tagsId .equals(tag.id) .toSingle(); - if (dbActivityTagging != null) + if (dbActivityTagging != null) { return ActivityTagging._fromDb(dbActivityTagging); + } return null; } diff --git a/lib/models/athlete.dart b/lib/models/athlete.dart index 73c5cd8..7875d11 100644 --- a/lib/models/athlete.dart +++ b/lib/models/athlete.dart @@ -183,8 +183,9 @@ class Athlete { await activity.deleteLaps(); // ignore: avoid_slow_async_io - if (await File(appDocDir.path + '/$stravaId.fit').exists()) + if (await File(appDocDir.path + '/$stravaId.fit').exists()) { await File(appDocDir.path + '/$stravaId.fit').delete(); + } } await _db.getDbActivities().delete(); return await _db.delete(); diff --git a/lib/models/critical_power.dart b/lib/models/critical_power.dart index 1598ab9..d640cde 100644 --- a/lib/models/critical_power.dart +++ b/lib/models/critical_power.dart @@ -13,11 +13,12 @@ class CriticalPower extends PowerDuration { final List plotPoints = []; powerMap.forEach((int duration, double power) { - if (duration > 60 && duration < 1200) + if (duration > 60 && duration < 1200) { plotPoints.add(DoublePlotPoint( domain: duration, measure: power, )); + } }); plotPoints.sort( diff --git a/lib/models/heart_rate_zone.dart b/lib/models/heart_rate_zone.dart index d8fd097..19d9d3b 100644 --- a/lib/models/heart_rate_zone.dart +++ b/lib/models/heart_rate_zone.dart @@ -22,12 +22,14 @@ class HeartRateZone { ..upperPercentage = upperPercentage ?? 0 ..color = color ?? 0xFFFFc107; - if (lowerPercentage != null) + if (lowerPercentage != null) { _db.lowerLimit = (lowerPercentage * heartRateZoneSchema.base / 100).round(); - if (upperPercentage != null) + } + if (upperPercentage != null) { _db.upperLimit = (upperPercentage * heartRateZoneSchema.base / 100).round(); + } } HeartRateZone._fromDb(this._db); diff --git a/lib/models/heart_rate_zone_schema.dart b/lib/models/heart_rate_zone_schema.dart index 2517fab..a275d16 100644 --- a/lib/models/heart_rate_zone_schema.dart +++ b/lib/models/heart_rate_zone_schema.dart @@ -148,9 +148,9 @@ class HeartRateZoneSchema { .orderByDesc('date') .top(1) .toList(); - if (dbHeartRateZoneSchemas.isNotEmpty) + if (dbHeartRateZoneSchemas.isNotEmpty) { return HeartRateZoneSchema._fromDb(dbHeartRateZoneSchemas.first); - else + } else { dbHeartRateZoneSchemas = await DbHeartRateZoneSchema() .select() .athletesId @@ -158,6 +158,7 @@ class HeartRateZoneSchema { .orderBy('date') .top(1) .toList(); + } return (dbHeartRateZoneSchemas.isNotEmpty) ? HeartRateZoneSchema._fromDb(dbHeartRateZoneSchemas.first) : null; diff --git a/lib/models/interval.dart b/lib/models/interval.dart index 81123b4..f57ab51 100644 --- a/lib/models/interval.dart +++ b/lib/models/interval.dart @@ -171,48 +171,54 @@ class Interval { avgSpeed != null && avgSpeed > 0 && weight != null && - weight > 0) + weight > 0) { return avgPower / avgSpeed / weight; - else + } else { return null; + } } double get avgPace { - if (avgSpeedByDistance != null && avgSpeedByDistance != 0) + if (avgSpeedByDistance != null && avgSpeedByDistance != 0) { return 50 / 3 / avgSpeedByDistance; - else + } else { return null; + } } double get avgSpeedPerHeartRate { - if (avgSpeed != null && avgHeartRate != null && avgHeartRate != 0) + if (avgSpeed != null && avgHeartRate != null && avgHeartRate != 0) { return 100 * (avgSpeed / avgHeartRate); - else + } else { return null; + } } double get avgPowerPerHeartRate { if (avgPower != null && avgPower != -1 && avgHeartRate != null && - avgHeartRate != null) + avgHeartRate != null) { return avgPower / avgHeartRate; - else + } else { return null; + } } int get elevationDifference { - if (totalAscent != null && totalDescent != null) + if (totalAscent != null && totalDescent != null) { return totalAscent - totalDescent; - else + } else { return null; + } } double get avgDoubleStrydCadence { - if (avgStrydCadence != null) + if (avgStrydCadence != null) { return avgStrydCadence * 2; - else + } else { return null; + } } // easier check for data availability diff --git a/lib/models/interval_tagging.dart b/lib/models/interval_tagging.dart index 210b2e1..647bd6c 100644 --- a/lib/models/interval_tagging.dart +++ b/lib/models/interval_tagging.dart @@ -46,9 +46,9 @@ class IntervalTagging { .equals(tag.id) .toSingle(); - if (dbIntervalTagging != null) + if (dbIntervalTagging != null) { return IntervalTagging._fromDb(dbIntervalTagging); - else { + } else { final IntervalTagging intervalTagging = IntervalTagging( interval: interval, tag: tag, diff --git a/lib/models/lap.dart b/lib/models/lap.dart index 1eb697f..bb48f53 100644 --- a/lib/models/lap.dart +++ b/lib/models/lap.dart @@ -104,48 +104,54 @@ class Lap { avgSpeed != null && avgSpeed > 0 && weight != null && - weight > 0) + weight > 0) { return avgPower / avgSpeed / weight; - else + } else { return null; + } } double get avgPace { - if (avgSpeed != null && avgSpeed != 0) + if (avgSpeed != null && avgSpeed != 0) { return 50 / 3 / avgSpeed; - else + } else { return null; + } } double get avgSpeedPerHeartRate { - if (avgSpeed != null && avgHeartRate != null && avgHeartRate != 0) + if (avgSpeed != null && avgHeartRate != null && avgHeartRate != 0) { return 100 * (avgSpeed / avgHeartRate); - else + } else { return null; + } } double get avgPowerPerHeartRate { if (avgPower != null && avgPower != -1 && avgHeartRate != null && - avgHeartRate != null) + avgHeartRate != null) { return avgPower / avgHeartRate; - else + } else { return null; + } } int get elevationDifference { - if (totalAscent != null && totalDescent != null) + if (totalAscent != null && totalDescent != null) { return totalAscent - totalDescent; - else + } else { return null; + } } double get avgDoubleStrydCadence { - if (avgStrydCadence != null) + if (avgStrydCadence != null) { return avgStrydCadence * 2; - else + } else { return null; + } } // easier check for data availability diff --git a/lib/models/lap_tagging.dart b/lib/models/lap_tagging.dart index 6427edd..34a5921 100644 --- a/lib/models/lap_tagging.dart +++ b/lib/models/lap_tagging.dart @@ -45,9 +45,9 @@ class LapTagging { .equals(tag.id) .toSingle(); - if (dbLapTagging != null) + if (dbLapTagging != null) { return LapTagging._fromDb(dbLapTagging); - else { + } else { final LapTagging lapTagging = LapTagging( lap: lap, tag: tag, diff --git a/lib/models/power_zone.dart b/lib/models/power_zone.dart index a0bcdf9..ba089ce 100644 --- a/lib/models/power_zone.dart +++ b/lib/models/power_zone.dart @@ -22,10 +22,12 @@ class PowerZone { ..upperPercentage = upperPercentage ?? 0 ..color = color ?? 0xFFFFc107; - if (lowerPercentage != null) + if (lowerPercentage != null) { _db.lowerLimit = (lowerPercentage * powerZoneSchema.base / 100).round(); - if (upperPercentage != null) + } + if (upperPercentage != null) { _db.upperLimit = (upperPercentage * powerZoneSchema.base / 100).round(); + } } PowerZone._fromDb(this._db); diff --git a/lib/models/power_zone_schema.dart b/lib/models/power_zone_schema.dart index 574c347..bded88d 100644 --- a/lib/models/power_zone_schema.dart +++ b/lib/models/power_zone_schema.dart @@ -212,9 +212,9 @@ class PowerZoneSchema { .orderByDesc('date') .top(1) .toList(); - if (dbPowerZoneSchemas.isNotEmpty) + if (dbPowerZoneSchemas.isNotEmpty) { return PowerZoneSchema._fromDb(dbPowerZoneSchemas.first); - else + } else { dbPowerZoneSchemas = await DbPowerZoneSchema() .select() .athletesId @@ -222,6 +222,7 @@ class PowerZoneSchema { .orderBy('date') .top(1) .toList(); + } return (dbPowerZoneSchemas.isNotEmpty) ? PowerZoneSchema._fromDb(dbPowerZoneSchemas.first) : null; diff --git a/lib/models/record_list.dart b/lib/models/record_list.dart index c66511c..3327699 100644 --- a/lib/models/record_list.dart +++ b/lib/models/record_list.dart @@ -44,11 +44,12 @@ class RecordList extends DelegatingList { if (record.event == 'record') { if (record.speed != null && record.timeStamp != null) { if (record.speed > 0) { - if (lastSpeed > 0) + if (lastSpeed > 0) { movingTime += record.timeStamp.difference(lastTimestamp).inSeconds; - else + } else { movingTime += 1; + } } lastTimestamp = record.timeStamp; lastSpeed = record.speed; @@ -401,8 +402,9 @@ class RecordList extends DelegatingList { .cast(); for (final double altitude in altitudes) { - if (lastAltitude != 0 && altitude > lastAltitude) + if (lastAltitude != 0 && altitude > lastAltitude) { sumOfAscents += altitude - lastAltitude; + } lastAltitude = altitude; } return sumOfAscents; @@ -417,8 +419,9 @@ class RecordList extends DelegatingList { .cast(); for (final double altitude in altitudes) { - if (lastAltitude != 0 && altitude < lastAltitude) + if (lastAltitude != 0 && altitude < lastAltitude) { sumOfDescents += lastAltitude - altitude; + } lastAltitude = altitude; } return sumOfDescents; diff --git a/lib/models/tag_group.dart b/lib/models/tag_group.dart index a17853a..79b809f 100644 --- a/lib/models/tag_group.dart +++ b/lib/models/tag_group.dart @@ -68,9 +68,9 @@ class TagGroup { .name .equals('Auto Power Zones') .toSingle(); - if (dbTagGroup != null) + if (dbTagGroup != null) { return TagGroup._fromDb(dbTagGroup); - else { + } else { final TagGroup autoPowerTagGroup = TagGroup.by( name: 'Auto Power Zones', athlete: athlete, @@ -95,9 +95,9 @@ class TagGroup { .name .equals('Auto Heart Rate Zones') .toSingle(); - if (dbTagGroup != null) + if (dbTagGroup != null) { return TagGroup._fromDb(dbTagGroup); - else { + } else { final TagGroup autoHeartRateTagGroup = TagGroup.by( name: 'Auto Heart Rate Zones', athlete: athlete, @@ -119,9 +119,9 @@ class TagGroup { .name .equals('Effort') .toSingle(); - if (dbTagGroup != null) + if (dbTagGroup != null) { return TagGroup._fromDb(dbTagGroup); - else { + } else { final TagGroup autoEffortTagGroup = TagGroup.by( name: 'Effort', athlete: athlete, diff --git a/lib/models/weight.dart b/lib/models/weight.dart index b7d46b0..0e6d984 100644 --- a/lib/models/weight.dart +++ b/lib/models/weight.dart @@ -41,9 +41,9 @@ class Weight { .orderByDesc('date') .top(1) .toList(); - if (dbWeights.isNotEmpty) + if (dbWeights.isNotEmpty) { return Weight._fromDb(dbWeights.first); - else + } else { dbWeights = await DbWeight() .select() .athletesId @@ -51,6 +51,7 @@ class Weight { .orderBy('date') .top(1) .toList(); + } return (dbWeights.isNotEmpty) ? Weight._fromDb(dbWeights.first) : null; } diff --git a/lib/screens/add_filter_screen.dart b/lib/screens/add_filter_screen.dart index 2ecc879..4dbe0c6 100644 --- a/lib/screens/add_filter_screen.dart +++ b/lib/screens/add_filter_screen.dart @@ -80,11 +80,12 @@ class _AddFilterScreenState extends State { ), onSelected: (bool selected) { setState(() { - if (selected) + if (selected) { widget.athlete.filters.add(tag.id); - else + } else { widget.athlete.filters.removeWhere( (int tagId) => tagId == tag.id); + } }); }, selected: widget.athlete.filters.contains(tag.id), diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index aa90783..5c31f95 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -31,9 +31,9 @@ class _DashboardState extends State { @override Widget build(BuildContext context) { - if (athletes.isEmpty) + if (athletes.isEmpty) { return Container(); - else { + } else { return Scaffold( appBar: AppBar( backgroundColor: MyColor.primary, diff --git a/lib/screens/select_interval_screen.dart b/lib/screens/select_interval_screen.dart index bc3ed05..de93eea 100644 --- a/lib/screens/select_interval_screen.dart +++ b/lib/screens/select_interval_screen.dart @@ -51,7 +51,7 @@ class _SelectIntervalScreenState extends State { ), ), ); - } else + } else { return Scaffold( appBar: AppBar( backgroundColor: MyColor.settings, @@ -59,6 +59,7 @@ class _SelectIntervalScreenState extends State { ), body: const Text('Loading...'), ); + } } Future getData() async { diff --git a/lib/screens/show_activity_screen.dart b/lib/screens/show_activity_screen.dart index 7c9ff9d..02159f9 100644 --- a/lib/screens/show_activity_screen.dart +++ b/lib/screens/show_activity_screen.dart @@ -548,9 +548,9 @@ class _ShowActivityScreenState extends State { final Stream percentageStream = widget.activity.parse(athlete: widget.athlete); await for (final int value in percentageStream) { - if (value == -2) - await flushbar?.dismiss(); - else if (value == -1) { + if (value == -2) { + var object = await flushbar?.dismiss(); + } else if (value == -1) { await flushbar?.dismiss(); flushbar = Flushbar( message: 'Analysing »${widget.activity.name}«', diff --git a/lib/screens/strava_get_user.dart b/lib/screens/strava_get_user.dart index 1b68ba7..93b4d37 100644 --- a/lib/screens/strava_get_user.dart +++ b/lib/screens/strava_get_user.dart @@ -33,11 +33,9 @@ class _StravaGetUserState extends State { backgroundColor: MyColor.primary, ), body: SafeArea( - child: Container( - child: Padding( - padding: const EdgeInsets.all(20), - child: Text(widget.athlete.stateText), - ), + child: Padding( + padding: const EdgeInsets.all(20), + child: Text(widget.athlete.stateText), ), ), ); diff --git a/lib/utils/db.dart b/lib/utils/db.dart index ab07a28..0026aeb 100644 --- a/lib/utils/db.dart +++ b/lib/utils/db.dart @@ -12,8 +12,9 @@ class Db { static bool _isConnected = false; Future connect() async { - if (_isConnected == false) + if (_isConnected == false) { _isConnected = await DbEncrateia().initializeDB(); + } return _isConnected; } } diff --git a/lib/utils/graph_utils.dart b/lib/utils/graph_utils.dart index 6e67959..c63c47c 100644 --- a/lib/utils/graph_utils.dart +++ b/lib/utils/graph_utils.dart @@ -41,9 +41,9 @@ class GraphUtils { bottomMarginSpec: MarginSpec.fixedPixel(40), ); - static Container loadingContainer = Container( + static SizedBox loadingContainer = const SizedBox( height: 100, - child: const Center(child: Text('Loading')), + child: Center(child: Text('Loading')), ); static List> axis({String measureTitle}) { diff --git a/lib/utils/my_bar_chart.dart b/lib/utils/my_bar_chart.dart index 17b2869..3444143 100644 --- a/lib/utils/my_bar_chart.dart +++ b/lib/utils/my_bar_chart.dart @@ -56,9 +56,9 @@ class MyBarChart extends StatelessWidget { @override Widget build(BuildContext context) { - if (_barZones.isEmpty && _value == null || _value <= 0) + if (_barZones.isEmpty && _value == null || _value <= 0) { return const Text('no data'); - else + } else { return SizedBox( width: _width, height: _height, @@ -74,55 +74,59 @@ class MyBarChart extends StatelessWidget { ), ), ); + } } static List toBarZones({ List powerZones, List heartRateZones, }) { - if (powerZones != null) + if (powerZones != null) { return BarZone.fromPowerZones(powerZones); - else if (heartRateZones != null) + } else if (heartRateZones != null) { return BarZone.fromHeartRateZones(heartRateZones); - else + } else { return []; + } } static double maxFromZones( {List powerZones, List heartRateZones, num maximum}) { - if (maximum != null) + if (maximum != null) { return maximum.toDouble(); - else if (powerZones != null) + } else if (powerZones != null) { return powerZones .map((PowerZone powerZone) => powerZone.upperLimit.toDouble()) .reduce(math.max); - else if (heartRateZones != null) + } else if (heartRateZones != null) { return heartRateZones .map((HeartRateZone heartRateZone) => heartRateZone.upperLimit.toDouble()) .reduce(math.max); - else + } else { return 100.0; + } } static double minFromZones( {List powerZones, List heartRateZones, num minimum}) { - if (minimum != null) + if (minimum != null) { return minimum.toDouble(); - else if (powerZones != null) + } else if (powerZones != null) { return powerZones .map((PowerZone powerZone) => powerZone.lowerLimit.toDouble()) .reduce(math.min); - else if (heartRateZones != null) + } else if (heartRateZones != null) { return heartRateZones .map((HeartRateZone heartRateZone) => heartRateZone.lowerLimit.toDouble()) .reduce(math.min); - else + } else { return 0.0; + } } } diff --git a/lib/utils/my_color.dart b/lib/utils/my_color.dart index df31a4c..8cb2e09 100644 --- a/lib/utils/my_color.dart +++ b/lib/utils/my_color.dart @@ -76,11 +76,13 @@ class MyColor { }) { if (selected) { if (ThemeData.estimateBrightnessForColor(backgroundColor) == - Brightness.light) + Brightness.light) { return black; - else + } else { return white; - } else + } + } else { return black; + } } } diff --git a/lib/utils/my_line_chart.dart b/lib/utils/my_line_chart.dart index 36b2948..42824f4 100644 --- a/lib/utils/my_line_chart.dart +++ b/lib/utils/my_line_chart.dart @@ -83,7 +83,7 @@ class MyLineChart extends LineChart { double minimum, double maximum, }) { - if (powerZones != null) + if (powerZones != null) { return NumericExtents( powerZones .map((PowerZone powerZone) => powerZone.lowerLimit) @@ -93,7 +93,7 @@ class MyLineChart extends LineChart { .map((PowerZone powerZone) => powerZone.upperLimit) .reduce(max) * 1.1); - else if (heartRateZones != null) + } else if (heartRateZones != null) { return NumericExtents( heartRateZones .map( @@ -105,9 +105,10 @@ class MyLineChart extends LineChart { (HeartRateZone heartRateZone) => heartRateZone.upperLimit) .reduce(max) * 1.1); - else if (minimum != null) + } else if (minimum != null) { return NumericExtents(minimum, maximum); - else + } else { return null; + } } } diff --git a/lib/widgets/activities_feed_widget.dart b/lib/widgets/activities_feed_widget.dart index 6cc0dc4..7d7b2ca 100644 --- a/lib/widgets/activities_feed_widget.dart +++ b/lib/widgets/activities_feed_widget.dart @@ -56,7 +56,7 @@ class _ActivitiesFeedWidgetState extends State { itemCount: activities.length, itemBuilder: (BuildContext context, int index) { final Activity activity = activities[index]; - if (activity.nonParsable == true) + if (activity.nonParsable == true) { return ListTile( leading: sportsIcon(sport: activity.sport), title: Text(activity.name ?? 'Activity'), @@ -75,7 +75,7 @@ class _ActivitiesFeedWidgetState extends State { getData(); }, ); - else + } else { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -167,6 +167,7 @@ class _ActivitiesFeedWidgetState extends State { ), ) ]); + } }, ); } diff --git a/lib/widgets/activity_widgets/activity_bargraph_widget.dart b/lib/widgets/activity_widgets/activity_bargraph_widget.dart index 6d198ed..8de7a46 100644 --- a/lib/widgets/activity_widgets/activity_bargraph_widget.dart +++ b/lib/widgets/activity_widgets/activity_bargraph_widget.dart @@ -190,15 +190,17 @@ class _ActivityBarGraphWidgetState extends State { } _powerZoneSchema = await activity.powerZoneSchema; - if (_powerZoneSchema != null) + if (_powerZoneSchema != null) { _powerZones = await _powerZoneSchema.powerZones; + } _heartRateDistributions = await activity.powerZoneCounts(); _powerDistributions = await activity.heartRateZoneCounts(); _heartRateZoneSchema = await activity.heartRateZoneSchema; - if (_heartRateZoneSchema != null) + if (_heartRateZoneSchema != null) { _heartRateZones = await _heartRateZoneSchema.heartRateZones; + } setState(() => loading = false); } diff --git a/lib/widgets/activity_widgets/activity_ftp_widget.dart b/lib/widgets/activity_widgets/activity_ftp_widget.dart index 2429b6f..2286bf1 100644 --- a/lib/widgets/activity_widgets/activity_ftp_widget.dart +++ b/lib/widgets/activity_widgets/activity_ftp_widget.dart @@ -67,7 +67,7 @@ class _ActivityFtpWidgetState extends State { ); } } else { - return Container( + return SizedBox( height: 100, child: Center( child: Text(loading ? 'Loading' : 'No data available'), diff --git a/lib/widgets/activity_widgets/activity_heart_rate_widget.dart b/lib/widgets/activity_widgets/activity_heart_rate_widget.dart index eed0040..b49b438 100644 --- a/lib/widgets/activity_widgets/activity_heart_rate_widget.dart +++ b/lib/widgets/activity_widgets/activity_heart_rate_widget.dart @@ -136,10 +136,11 @@ class _ActivityHeartRateWidgetState extends State { records = RecordList(await activity.records); heartRateZoneSchema = await activity.heartRateZoneSchema; - if (heartRateZoneSchema != null) + if (heartRateZoneSchema != null) { heartRateZones = await heartRateZoneSchema.heartRateZones; - else + } else { heartRateZones = []; + } setState(() => loading = false); } } diff --git a/lib/widgets/activity_widgets/activity_power_widget.dart b/lib/widgets/activity_widgets/activity_power_widget.dart index 8ecc0c6..12c1235 100644 --- a/lib/widgets/activity_widgets/activity_power_widget.dart +++ b/lib/widgets/activity_widgets/activity_power_widget.dart @@ -134,10 +134,11 @@ class _ActivityPowerWidgetState extends State { records = RecordList(await activity.records); powerZoneSchema = await activity.powerZoneSchema; - if (powerZoneSchema != null) + if (powerZoneSchema != null) { powerZones = await powerZoneSchema.powerZones; - else + } else { powerZones = []; + } setState(() => loading = false); } } diff --git a/lib/widgets/activity_widgets/activity_tag_widget.dart b/lib/widgets/activity_widgets/activity_tag_widget.dart index 129dba9..c1e9e74 100644 --- a/lib/widgets/activity_widgets/activity_tag_widget.dart +++ b/lib/widgets/activity_widgets/activity_tag_widget.dart @@ -31,11 +31,11 @@ class _ActivityTagWidgetState extends State { @override Widget build(BuildContext context) { - if (tagGroups == null) + if (tagGroups == null) { return const Center( child: Text('Loading ...'), ); - else + } else { return GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: @@ -94,6 +94,7 @@ class _ActivityTagWidgetState extends State { ), ), ); + } } Future getData() async { diff --git a/lib/widgets/athlete_widgets/athlete_current_filter_widget.dart b/lib/widgets/athlete_widgets/athlete_current_filter_widget.dart index 750e5a1..6bef14b 100644 --- a/lib/widgets/athlete_widgets/athlete_current_filter_widget.dart +++ b/lib/widgets/athlete_widgets/athlete_current_filter_widget.dart @@ -29,8 +29,9 @@ class AthleteCurrentFilterWidget extends StatelessWidget { widgets.add(const Text('(')); widgets.add(Text(' ${tagGroup.name}: ')); empty = false; - } else + } else { widgets.add(const Text('OR')); + } widgets.add( Chip( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, @@ -67,7 +68,8 @@ class AthleteCurrentFilterWidget extends StatelessWidget { runSpacing: 15, children: widgets, ); - } else + } else { return Container(); + } } } diff --git a/lib/widgets/athlete_widgets/athlete_distance_widget.dart b/lib/widgets/athlete_widgets/athlete_distance_widget.dart index 6a53af6..710e25a 100644 --- a/lib/widgets/athlete_widgets/athlete_distance_widget.dart +++ b/lib/widgets/athlete_widgets/athlete_distance_widget.dart @@ -122,8 +122,9 @@ class _AthleteDistanceWidgetState extends State { if (activity.timeStamp.year != year) { year = activity.timeStamp.year; distanceSoFar = activity.distance; - } else + } else { distanceSoFar += activity.distance; + } activity.distanceSoFar = distanceSoFar; } diff --git a/lib/widgets/athlete_widgets/athlete_moving_time_widget.dart b/lib/widgets/athlete_widgets/athlete_moving_time_widget.dart index 0d2d84c..bceaaa5 100644 --- a/lib/widgets/athlete_widgets/athlete_moving_time_widget.dart +++ b/lib/widgets/athlete_widgets/athlete_moving_time_widget.dart @@ -123,8 +123,9 @@ class _AthleteMovingTimeWidgetState extends State { if (activity.timeStamp.year != year) { year = activity.timeStamp.year; movingTimeSoFar = activity.movingTime; - } else + } else { movingTimeSoFar += activity.movingTime; + } activity.movingTimeSoFar = movingTimeSoFar; } diff --git a/lib/widgets/athlete_widgets/athlete_settings_widget.dart b/lib/widgets/athlete_widgets/athlete_settings_widget.dart index e923cdd..8af0793 100644 --- a/lib/widgets/athlete_widgets/athlete_settings_widget.dart +++ b/lib/widgets/athlete_widgets/athlete_settings_widget.dart @@ -112,8 +112,9 @@ class _AthleteSettingsWidgetState extends State { Future decreaseDownloadInterval() async { widget.athlete.downloadInterval = (widget.athlete.downloadInterval ?? 21) - 7; - if (widget.athlete.downloadInterval < 7) + if (widget.athlete.downloadInterval < 7) { widget.athlete.downloadInterval = 7; + } await widget.athlete.save(); setState(() {}); } @@ -128,14 +129,15 @@ class _AthleteSettingsWidgetState extends State { Future decreaseRecordAggregationCount() async { widget.athlete.recordAggregationCount = ((widget.athlete.recordAggregationCount ?? 16) / 2).round(); - if (widget.athlete.recordAggregationCount < 1) + if (widget.athlete.recordAggregationCount < 1) { widget.athlete.recordAggregationCount = 1; + } await widget.athlete.save(); setState(() {}); } Widget stravaTile({Athlete athlete}) { - if (athlete.id != null) + if (athlete.id != null) { return ListTile( leading: MyIcon.stravaDownload, title: const Text('Strava ID / Username / Location'), @@ -145,7 +147,8 @@ class _AthleteSettingsWidgetState extends State { ' / ' + (athlete.geoState ?? '')), ); - else + } else { return Container(width: 0, height: 0); + } } } diff --git a/lib/widgets/athlete_widgets/athlete_tag_group_widget.dart b/lib/widgets/athlete_widgets/athlete_tag_group_widget.dart index 9c7287d..79a0434 100644 --- a/lib/widgets/athlete_widgets/athlete_tag_group_widget.dart +++ b/lib/widgets/athlete_widgets/athlete_tag_group_widget.dart @@ -70,10 +70,11 @@ class _AthleteTagGroupWidgetState extends State { context, MaterialPageRoute( builder: (BuildContext context) { - if (tagGroup.system) + if (tagGroup.system) { return ShowTagGroupScreen(tagGroup: tagGroup); - else + } else { return AddTagGroupScreen(tagGroup: tagGroup); + } }, ), ); diff --git a/lib/widgets/athlete_widgets/edit_standalone_athlete_widget.dart b/lib/widgets/athlete_widgets/edit_standalone_athlete_widget.dart index 5f7dc81..23b356b 100644 --- a/lib/widgets/athlete_widgets/edit_standalone_athlete_widget.dart +++ b/lib/widgets/athlete_widgets/edit_standalone_athlete_widget.dart @@ -75,7 +75,7 @@ class _EditStandaloneAthleteWidgetState final List powerZoneSchemas = await widget.athlete.powerZoneSchemas; - if (powerZoneSchemas.isEmpty) + if (powerZoneSchemas.isEmpty) { Navigator.pushReplacement( context, MaterialPageRoute( @@ -83,7 +83,8 @@ class _EditStandaloneAthleteWidgetState OnBoardingPowerZoneSchemaScreen(athlete: widget.athlete), ), ); - else + } else { Navigator.of(context).pop(); + } } } diff --git a/lib/widgets/athlete_widgets/edit_strava_athlete_widget.dart b/lib/widgets/athlete_widgets/edit_strava_athlete_widget.dart index c86865f..6132b00 100644 --- a/lib/widgets/athlete_widgets/edit_strava_athlete_widget.dart +++ b/lib/widgets/athlete_widgets/edit_strava_athlete_widget.dart @@ -96,7 +96,7 @@ class _EditStravaAthleteWidgetState extends State { final List powerZoneSchemas = await widget.athlete.powerZoneSchemas; await flushbar.dismiss(); - if (powerZoneSchemas.isEmpty) + if (powerZoneSchemas.isEmpty) { Navigator.pushReplacement( context, MaterialPageRoute( @@ -104,8 +104,9 @@ class _EditStravaAthleteWidgetState extends State { OnBoardingPowerZoneSchemaScreen(athlete: widget.athlete), ), ); - else + } else { Navigator.of(context).pop(); + } } else { flushbar = Flushbar( icon: MyIcon.error, diff --git a/lib/widgets/charts/activity_charts/activity_altitude_chart.dart b/lib/widgets/charts/activity_charts/activity_altitude_chart.dart index a1a0797..7618bb5 100644 --- a/lib/widgets/charts/activity_charts/activity_altitude_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_altitude_chart.dart @@ -63,8 +63,9 @@ class ActivityAltitudeChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_ecor_chart.dart b/lib/widgets/charts/activity_charts/activity_ecor_chart.dart index 50a3220..dfcc5c5 100644 --- a/lib/widgets/charts/activity_charts/activity_ecor_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_ecor_chart.dart @@ -67,8 +67,9 @@ class ActivityEcorChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_form_power_chart.dart b/lib/widgets/charts/activity_charts/activity_form_power_chart.dart index 62965c1..a1ff490 100644 --- a/lib/widgets/charts/activity_charts/activity_form_power_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_form_power_chart.dart @@ -68,8 +68,9 @@ class ActivityFormPowerChart extends StatelessWidget { maximum: maximum, ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_ground_time_chart.dart b/lib/widgets/charts/activity_charts/activity_ground_time_chart.dart index ff7a83c..1a7afdb 100644 --- a/lib/widgets/charts/activity_charts/activity_ground_time_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_ground_time_chart.dart @@ -69,8 +69,9 @@ class ActivityGroundTimeChart extends StatelessWidget { maximum: maximum, ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_heart_rate_chart.dart b/lib/widgets/charts/activity_charts/activity_heart_rate_chart.dart index f280105..627484c 100644 --- a/lib/widgets/charts/activity_charts/activity_heart_rate_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_heart_rate_chart.dart @@ -66,8 +66,9 @@ class ActivityHeartRateChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_intervals_chart.dart b/lib/widgets/charts/activity_charts/activity_intervals_chart.dart index 4f45f38..32e3195 100644 --- a/lib/widgets/charts/activity_charts/activity_intervals_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_intervals_chart.dart @@ -75,7 +75,7 @@ class _ActivityIntervalsChartState extends State { ) ]; - if (laps.isNotEmpty) + if (laps.isNotEmpty) { return SingleChildScrollView( child: Column( children: [ @@ -260,14 +260,13 @@ class _ActivityIntervalsChartState extends State { ], ), if (selectedRecord == null) - Container( - child: const Text('Select a record to continue.'), - ), + const Text('Select a record to continue.'), ], ), ); - else + } else { return GraphUtils.loadingContainer; + } } void moveSelectedRecord({int amount}) { diff --git a/lib/widgets/charts/activity_charts/activity_leg_spring_stiffness_chart.dart b/lib/widgets/charts/activity_charts/activity_leg_spring_stiffness_chart.dart index b6356b5..8e33b70 100644 --- a/lib/widgets/charts/activity_charts/activity_leg_spring_stiffness_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_leg_spring_stiffness_chart.dart @@ -63,8 +63,9 @@ class ActivityLegSpringStiffnessChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_pace_chart.dart b/lib/widgets/charts/activity_charts/activity_pace_chart.dart index e802c1c..9ae4f93 100644 --- a/lib/widgets/charts/activity_charts/activity_pace_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_pace_chart.dart @@ -70,8 +70,9 @@ class ActivityPaceChart extends StatelessWidget { flipVerticalAxis: true, ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_power_chart.dart b/lib/widgets/charts/activity_charts/activity_power_chart.dart index c5f3f3a..d73c9ad 100644 --- a/lib/widgets/charts/activity_charts/activity_power_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_power_chart.dart @@ -65,8 +65,9 @@ class ActivityPowerChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_power_per_heart_rate_chart.dart b/lib/widgets/charts/activity_charts/activity_power_per_heart_rate_chart.dart index 2fb1d28..bf73952 100644 --- a/lib/widgets/charts/activity_charts/activity_power_per_heart_rate_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_power_per_heart_rate_chart.dart @@ -63,8 +63,9 @@ class ActivityPowerPerHeartRateChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_power_ratio_chart.dart b/lib/widgets/charts/activity_charts/activity_power_ratio_chart.dart index a2751de..e12a80b 100644 --- a/lib/widgets/charts/activity_charts/activity_power_ratio_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_power_ratio_chart.dart @@ -63,8 +63,9 @@ class ActivityPowerRatioChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_speed_chart.dart b/lib/widgets/charts/activity_charts/activity_speed_chart.dart index 80d40c4..414498e 100644 --- a/lib/widgets/charts/activity_charts/activity_speed_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_speed_chart.dart @@ -69,8 +69,9 @@ class ActivitySpeedChart extends StatelessWidget { maximum: maximum, ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_speed_per_heart_rate_chart.dart b/lib/widgets/charts/activity_charts/activity_speed_per_heart_rate_chart.dart index aed0a16..bf16110 100644 --- a/lib/widgets/charts/activity_charts/activity_speed_per_heart_rate_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_speed_per_heart_rate_chart.dart @@ -63,8 +63,9 @@ class ActivitySpeedPerHeartRateChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_stride_ratio_chart.dart b/lib/widgets/charts/activity_charts/activity_stride_ratio_chart.dart index 0da8cdc..5fd1662 100644 --- a/lib/widgets/charts/activity_charts/activity_stride_ratio_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_stride_ratio_chart.dart @@ -63,8 +63,9 @@ class ActivityStrideRatioChart extends StatelessWidget { const BasicNumericTickProviderSpec(desiredTickCount: 6), ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_stryd_cadence_chart.dart b/lib/widgets/charts/activity_charts/activity_stryd_cadence_chart.dart index c2e9d89..d57bb71 100644 --- a/lib/widgets/charts/activity_charts/activity_stryd_cadence_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_stryd_cadence_chart.dart @@ -69,8 +69,9 @@ class ActivityStrydCadenceChart extends StatelessWidget { maximum: maximum, ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/charts/activity_charts/activity_vertical_oscillation_chart.dart b/lib/widgets/charts/activity_charts/activity_vertical_oscillation_chart.dart index 83212cc..8c05c52 100644 --- a/lib/widgets/charts/activity_charts/activity_vertical_oscillation_chart.dart +++ b/lib/widgets/charts/activity_charts/activity_vertical_oscillation_chart.dart @@ -69,8 +69,9 @@ class ActivityVerticalOscillationChart extends StatelessWidget { maximum: maximum, ), ); - } else + } else { return GraphUtils.loadingContainer; + } }, ); } diff --git a/lib/widgets/interval_widgets/interval_heart_rate_widget.dart b/lib/widgets/interval_widgets/interval_heart_rate_widget.dart index 72a6910..b720b63 100644 --- a/lib/widgets/interval_widgets/interval_heart_rate_widget.dart +++ b/lib/widgets/interval_widgets/interval_heart_rate_widget.dart @@ -124,10 +124,11 @@ class _IntervalHeartRateWidgetState extends State { Future getData() async { records = RecordList(await widget.interval.records); heartRateZoneSchema = await widget.interval.heartRateZoneSchema; - if (heartRateZoneSchema != null) + if (heartRateZoneSchema != null) { heartRateZones = await heartRateZoneSchema.heartRateZones; - else + } else { heartRateZones = []; + } setState(() => loading = false); } } diff --git a/lib/widgets/interval_widgets/interval_power_widget.dart b/lib/widgets/interval_widgets/interval_power_widget.dart index d794e9e..5e8c6c4 100644 --- a/lib/widgets/interval_widgets/interval_power_widget.dart +++ b/lib/widgets/interval_widgets/interval_power_widget.dart @@ -13,7 +13,7 @@ import '/utils/my_button.dart'; import '/widgets/charts/lap_charts/lap_power_chart.dart'; class IntervalPowerWidget extends StatefulWidget { - const IntervalPowerWidget({this.interval}); + const IntervalPowerWidget({Key? key, this.interval}) : super(key: key); final encrateia.Interval interval; @@ -118,10 +118,11 @@ class _IntervalPowerWidgetState extends State { Future getData() async { records = RecordList(await widget.interval.records); powerZoneSchema = await widget.interval.powerZoneSchema; - if (powerZoneSchema != null) + if (powerZoneSchema != null) { powerZones = await powerZoneSchema.powerZones; - else + } else { powerZones = []; + } setState(() => loading = false); } } diff --git a/lib/widgets/interval_widgets/interval_tag_widget.dart b/lib/widgets/interval_widgets/interval_tag_widget.dart index 3f9d9bf..35f908f 100644 --- a/lib/widgets/interval_widgets/interval_tag_widget.dart +++ b/lib/widgets/interval_widgets/interval_tag_widget.dart @@ -37,11 +37,11 @@ class _IntervalTagWidgetState extends State { @override Widget build(BuildContext context) { - if (tagGroups == null) + if (tagGroups == null) { return const Center( child: Text('Loading ...'), ); - else + } else { return GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: @@ -96,6 +96,7 @@ class _IntervalTagWidgetState extends State { ), ), ); + } } Future getData() async { diff --git a/lib/widgets/lap_widgets/lap_heart_rate_widget.dart b/lib/widgets/lap_widgets/lap_heart_rate_widget.dart index b13e016..3cfe5a8 100644 --- a/lib/widgets/lap_widgets/lap_heart_rate_widget.dart +++ b/lib/widgets/lap_widgets/lap_heart_rate_widget.dart @@ -120,10 +120,11 @@ class _LapHeartRateWidgetState extends State { Future getData() async { records = RecordList(await widget.lap.records); heartRateZoneSchema = await widget.lap.heartRateZoneSchema; - if (heartRateZoneSchema != null) + if (heartRateZoneSchema != null) { heartRateZones = await heartRateZoneSchema.heartRateZones; - else + } else { heartRateZones = []; + } setState(() => loading = false); } } diff --git a/lib/widgets/lap_widgets/lap_power_widget.dart b/lib/widgets/lap_widgets/lap_power_widget.dart index 488385e..cf4d2d2 100644 --- a/lib/widgets/lap_widgets/lap_power_widget.dart +++ b/lib/widgets/lap_widgets/lap_power_widget.dart @@ -118,10 +118,11 @@ class _LapPowerWidgetState extends State { Future getData() async { records = RecordList(await widget.lap.records); powerZoneSchema = await widget.lap.powerZoneSchema; - if (powerZoneSchema != null) + if (powerZoneSchema != null) { powerZones = await powerZoneSchema.powerZones; - else + } else { powerZones = []; + } setState(() => loading = false); } } diff --git a/lib/widgets/lap_widgets/lap_tag_widget.dart b/lib/widgets/lap_widgets/lap_tag_widget.dart index 0bc273f..3dd4e0e 100644 --- a/lib/widgets/lap_widgets/lap_tag_widget.dart +++ b/lib/widgets/lap_widgets/lap_tag_widget.dart @@ -37,11 +37,11 @@ class _LapTagWidgetState extends State { @override Widget build(BuildContext context) { - if (tagGroups == null) + if (tagGroups == null) { return const Center( child: Text('Loading ...'), ); - else + } else { return GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: @@ -94,6 +94,7 @@ class _LapTagWidgetState extends State { ), ), ); + } } Future getData() async { diff --git a/lib/widgets/laps_list_widget.dart b/lib/widgets/laps_list_widget.dart index f554d0e..de6ce26 100644 --- a/lib/widgets/laps_list_widget.dart +++ b/lib/widgets/laps_list_widget.dart @@ -96,10 +96,11 @@ class _LapsListWidgetState extends State { ), ), ); - } else + } else { return Center( child: Text(loading ? 'Loading' : 'No data available'), ); + } } Future copyToInterval({Lap lap}) async { diff --git a/pubspec.lock b/pubspec.lock index de05987..7bee761 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -293,6 +293,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.2" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" flutter_markdown: dependency: "direct main" description: @@ -349,13 +356,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.2" - flutter_staggered_grid_view: - dependency: "direct main" - description: - name: flutter_staggered_grid_view - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.1" flutter_web_plugins: dependency: transitive description: flutter @@ -452,6 +452,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.4.0" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" logging: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index acabb8c..3cb40a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,7 @@ dependencies: dev_dependencies: build_runner: ^2.1.7 build_verify: ^3.0.0 + flutter_lints: ^1.0.4 flutter: uses-material-design: true