Skip to content

Commit

Permalink
Updated lints
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffaKetchup committed Feb 24, 2024
1 parent ae2193f commit 2a3f55f
Show file tree
Hide file tree
Showing 29 changed files with 297 additions and 338 deletions.
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ analyzer:
linter:
rules:
avoid_slow_async_io: false
# TODO: Remove
public_member_api_docs: false
5 changes: 5 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: ../analysis_options.yaml

linter:
rules:
public_member_api_docs: false
8 changes: 4 additions & 4 deletions example/lib/screens/import_store/import_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ class _ImportStorePopupState extends State<ImportStorePopup> {
}

class _ImportStore {
final Future result;
List<String>? collisionInfo;
Completer<bool> collisionResolution;

_ImportStore(
this.result, {
required this.collisionInfo,
}) : collisionResolution = Completer();

final Future result;
List<String>? collisionInfo;
Completer<bool> collisionResolution;
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class RegionShape extends StatelessWidget {
bounds.southEast,
bounds.southWest,
];
break;
case RegionType.circle:
holePoints = CircleRegion(
provider.coordinates[0],
Expand All @@ -63,19 +62,18 @@ class RegionShape extends StatelessWidget {
) /
1000,
).toOutline().toList();
break;
case RegionType.line:
throw Error();
case RegionType.customPolygon:
holePoints = provider.isCustomPolygonComplete
? provider.coordinates
: [
...provider.coordinates,
provider.customPolygonSnap
? provider.coordinates.first
: provider.currentNewPointPos,
if (provider.customPolygonSnap)
provider.coordinates.first
else
provider.currentNewPointPos,
];
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ class LineRegionPane extends StatelessWidget {
icon: const Icon(Icons.route),
tooltip: 'Import from GPX',
),
layoutDirection == Axis.vertical
? const Divider(height: 8)
: const VerticalDivider(width: 8),
if (layoutDirection == Axis.vertical)
const Divider(height: 8)
else
const VerticalDivider(width: 8),
const SizedBox.square(dimension: 4),
if (layoutDirection == Axis.vertical) ...[
Text('${provider.lineRadius.round()}m'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,22 @@ class _PrimaryPane extends StatelessWidget {
direction: layoutDirection,
mainAxisSize: MainAxisSize.min,
children: [
provider.openAdjustZoomLevelsSlider
? IconButton.outlined(
icon: Icon(
layoutDirection == Axis.vertical
? Icons.arrow_left
: Icons.arrow_drop_down,
),
onPressed: () =>
provider.openAdjustZoomLevelsSlider = false,
)
: IconButton(
icon: const Icon(Icons.zoom_in),
onPressed: () =>
provider.openAdjustZoomLevelsSlider = true,
),
if (provider.openAdjustZoomLevelsSlider)
IconButton.outlined(
icon: Icon(
layoutDirection == Axis.vertical
? Icons.arrow_left
: Icons.arrow_drop_down,
),
onPressed: () =>
provider.openAdjustZoomLevelsSlider = false,
)
else
IconButton(
icon: const Icon(Icons.zoom_in),
onPressed: () =>
provider.openAdjustZoomLevelsSlider = true,
),
const SizedBox.square(dimension: 12),
IconButton.filled(
icon: const Icon(Icons.done),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class _RegionSelectionPageState extends State<RegionSelectionPage> {
provider
..clearCoordinates()
..addCoordinate(provider.currentNewPointPos);

break;
case RegionType.circle:
if (coords.length == 2) {
provider.region = CircleRegion(
Expand All @@ -81,15 +79,11 @@ class _RegionSelectionPageState extends State<RegionSelectionPage> {
provider
..clearCoordinates()
..addCoordinate(provider.currentNewPointPos);

break;
case RegionType.line:
provider.region = LineRegion(coords, provider.lineRadius);
break;
case RegionType.customPolygon:
if (!provider.isCustomPolygonComplete) break;
provider.region = CustomPolygonRegion(coords);
break;
}
},
onSecondaryTap: (_, __) =>
Expand Down
19 changes: 10 additions & 9 deletions example/lib/screens/main/pages/stores/components/stat_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ class StatDisplay extends StatelessWidget {
@override
Widget build(BuildContext context) => Column(
children: [
statistic == null
? const CircularProgressIndicator()
: Text(
statistic!,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
if (statistic == null)
const CircularProgressIndicator()
else
Text(
statistic!,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
Text(
description,
style: const TextStyle(
Expand Down
31 changes: 24 additions & 7 deletions jaffa_lints.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- annotate_redeclares
- avoid_annotating_with_dynamic
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_double_and_int_checks
- avoid_dynamic_calls
Expand All @@ -24,8 +25,6 @@ linter:
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_setters_without_getters
Expand All @@ -45,13 +44,17 @@ linter:
- cascade_invocations
- 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
- deprecated_member_use_from_same_package
- directives_ordering
- do_not_use_environment
- empty_catches
Expand All @@ -62,22 +65,28 @@ 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_annotations
- 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_default_cases
- 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_self_assignments
- no_wildcard_variable_uses
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
Expand All @@ -100,7 +109,6 @@ linter:
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
Expand All @@ -109,6 +117,7 @@ linter:
- prefer_foreach
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
Expand All @@ -127,30 +136,36 @@ linter:
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- public_member_api_docs
- 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_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_breaks
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_late
- unnecessary_library_directive
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
Expand All @@ -161,6 +176,8 @@ linter:
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unreachable_from_main
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
Expand All @@ -182,4 +199,4 @@ linter:
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
- void_checks
- void_checks
70 changes: 35 additions & 35 deletions lib/src/backend/impls/objectbox/models/src/recovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,6 @@ import '../../../../../../flutter_map_tile_caching.dart';

@Entity()
base class ObjectBoxRecovery {
@Id()
@internal
int id = 0;

@Index()
@Unique()
int refId;

String storeName;
@Property(type: PropertyType.date)
DateTime creationTime;

int minZoom;
int maxZoom;
int startTile;
int? endTile;

int typeId; // 0 - rect, 1 - circle, 2 - line, 3 - custom polygon

double? rectNwLat;
double? rectNwLng;
double? rectSeLat;
double? rectSeLng;

double? circleCenterLat;
double? circleCenterLng;
double? circleRadius;

List<double>? lineLats;
List<double>? lineLngs;
double? lineRadius;

List<double>? customPolygonLats;
List<double>? customPolygonLngs;

ObjectBoxRecovery({
required this.refId,
required this.storeName,
Expand Down Expand Up @@ -144,6 +109,41 @@ base class ObjectBoxRecovery {
.toList()
: null;

@Id()
@internal
int id = 0;

@Index()
@Unique()
int refId;

String storeName;
@Property(type: PropertyType.date)
DateTime creationTime;

int minZoom;
int maxZoom;
int startTile;
int? endTile;

int typeId; // 0 - rect, 1 - circle, 2 - line, 3 - custom polygon

double? rectNwLat;
double? rectNwLng;
double? rectSeLat;
double? rectSeLng;

double? circleCenterLat;
double? circleCenterLng;
double? circleRadius;

List<double>? lineLats;
List<double>? lineLngs;
double? lineRadius;

List<double>? customPolygonLats;
List<double>? customPolygonLngs;

RecoveredRegion toRegion() => RecoveredRegion(
id: refId,
storeName: storeName,
Expand Down
Loading

0 comments on commit 2a3f55f

Please sign in to comment.