Skip to content

Commit

Permalink
Fix dcm warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
petr-jilek-deploy committed Jan 12, 2024
1 parent 6f367ca commit e156ac1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion glade_forms/lib/src/core/glade_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ class GladeInput<T> extends ChangeNotifier {
bool? createTextController,
ValueTransform<T>? valueTransform,
}) {
return GladeInput<T>(
return GladeInput(
value: value ?? this.value,
valueComparator: valueComparator ?? this.valueComparator,
validatorInstance: validatorInstance ?? this.validatorInstance,
Expand Down
4 changes: 3 additions & 1 deletion glade_forms/lib/src/model/glade_model_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:flutter/foundation.dart';
import 'package:glade_forms/src/core/core.dart';
import 'package:meta/meta.dart';

typedef OnEdit = void Function();

abstract class GladeModelBase extends ChangeNotifier {
List<GladeInput<Object?>> _lastUpdates = [];
bool _groupEdit = false;
Expand Down Expand Up @@ -86,7 +88,7 @@ abstract class GladeModelBase extends ChangeNotifier {
}

/// Use it to update multiple inputs at once before these changes are popragated through notifyListeners().
void groupEdit(void Function() edit) {
void groupEdit(OnEdit edit) {
_groupEdit = true;

edit();
Expand Down
2 changes: 1 addition & 1 deletion glade_forms/lib/src/validator/glade_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GladeValidator<T> {
/// Beware that some validators assume non-null value.
bool stopOnFirstError = true,
}) =>
ValidatorInstance<T>(parts: parts, stopOnFirstError: stopOnFirstError);
ValidatorInstance(parts: parts, stopOnFirstError: stopOnFirstError);

void clear() => parts = [];

Expand Down
10 changes: 2 additions & 8 deletions glade_forms/lib/src/validator/part/custom_validation_part.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import 'package:glade_forms/src/core/core.dart';
import 'package:glade_forms/src/validator/part/input_validator_part.dart';
import 'package:glade_forms/src/validator/validator_error/glade_validator_error.dart';
import 'package:glade_forms/src/src.dart';

class CustomValidationPart<T> extends InputValidatorPart<T> {
final GladeValidatorError<T>? Function(
T value, {
required InputDependencies dependencies,
Object? extra,
}) customValidator;
final ValidateFunction<T> customValidator;

Check notice on line 4 in glade_forms/lib/src/validator/part/custom_validation_part.dart

View workflow job for this annotation

GitHub Actions / DCM report

glade_forms/lib/src/validator/part/custom_validation_part.dart#L4

This field with a Function type does not match the configured pattern: ^on[A-Z]+. Try renaming it.

const CustomValidationPart({
required this.customValidator,
Expand Down
4 changes: 2 additions & 2 deletions glade_forms/lib/src/validator/validator_instance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class ValidatorInstance<T> {
if (error != null) {
errors.add(error);

if (stopOnFirstError) return ValidatorResult<T>(errors: errors, associatedInput: _input);
if (stopOnFirstError) return ValidatorResult(errors: errors, associatedInput: _input);
}
}

return ValidatorResult<T>(errors: errors, associatedInput: _input);
return ValidatorResult(errors: errors, associatedInput: _input);
}
}
5 changes: 2 additions & 3 deletions glade_forms/lib/src/widgets/glade_model_debug_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class _DangerStrips extends StatelessWidget {
required this.gap,
});

List<Widget> getListOfStripes(int count) {
List<Widget> _getListOfStripes(int count) {
final stripes = <Widget>[];
for (var i = 0; i < count; i++) {
stripes.add(
Expand All @@ -140,8 +140,7 @@ class _DangerStrips extends StatelessWidget {
width: double.infinity,
child: LayoutBuilder(
builder: (context, constraints) {
// ignore: avoid-returning-widgets, ok here
return Stack(children: getListOfStripes((constraints.maxWidth / 2).ceil()));
return Stack(children: _getListOfStripes((constraints.maxWidth / 2).ceil()));
},
),
);
Expand Down
2 changes: 1 addition & 1 deletion glade_forms/test/model/group_edit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void main() {
expect(listenerCount, equals(1), reason: 'Should be called');
});

test('When updating [a] listeners is called', () {
test('When updating [b] listeners is called', () {
final model = _Model();
var listenerCount = 0;
model.addListener(() {
Expand Down
1 change: 1 addition & 0 deletions storybook/lib/localization_addon_custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class LocalizationAddonCustom extends WidgetbookAddon<Locale> {
initialLocale == null || locales.contains(initialLocale),
'initialLocale must be in locales',
),
// ignore: avoid-unsafe-collection-methods, the locales are set programmatically and should have at least one element
initialLocale = initialLocale ?? locales.first,
super(name: 'Locale');

Expand Down

0 comments on commit e156ac1

Please sign in to comment.