diff --git a/glade_forms/lib/src/core/glade_input.dart b/glade_forms/lib/src/core/glade_input.dart index 6f2c997..b5fd99a 100644 --- a/glade_forms/lib/src/core/glade_input.dart +++ b/glade_forms/lib/src/core/glade_input.dart @@ -517,7 +517,7 @@ class GladeInput extends ChangeNotifier { bool? createTextController, ValueTransform? valueTransform, }) { - return GladeInput( + return GladeInput( value: value ?? this.value, valueComparator: valueComparator ?? this.valueComparator, validatorInstance: validatorInstance ?? this.validatorInstance, diff --git a/glade_forms/lib/src/model/glade_model_base.dart b/glade_forms/lib/src/model/glade_model_base.dart index 28b2d12..37d9c28 100644 --- a/glade_forms/lib/src/model/glade_model_base.dart +++ b/glade_forms/lib/src/model/glade_model_base.dart @@ -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> _lastUpdates = []; bool _groupEdit = false; @@ -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(); diff --git a/glade_forms/lib/src/validator/glade_validator.dart b/glade_forms/lib/src/validator/glade_validator.dart index 3280f5a..83485c4 100644 --- a/glade_forms/lib/src/validator/glade_validator.dart +++ b/glade_forms/lib/src/validator/glade_validator.dart @@ -20,7 +20,7 @@ class GladeValidator { /// Beware that some validators assume non-null value. bool stopOnFirstError = true, }) => - ValidatorInstance(parts: parts, stopOnFirstError: stopOnFirstError); + ValidatorInstance(parts: parts, stopOnFirstError: stopOnFirstError); void clear() => parts = []; diff --git a/glade_forms/lib/src/validator/part/custom_validation_part.dart b/glade_forms/lib/src/validator/part/custom_validation_part.dart index 2361a60..116f32c 100644 --- a/glade_forms/lib/src/validator/part/custom_validation_part.dart +++ b/glade_forms/lib/src/validator/part/custom_validation_part.dart @@ -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 extends InputValidatorPart { - final GladeValidatorError? Function( - T value, { - required InputDependencies dependencies, - Object? extra, - }) customValidator; + final ValidateFunction customValidator; const CustomValidationPart({ required this.customValidator, diff --git a/glade_forms/lib/src/validator/validator_instance.dart b/glade_forms/lib/src/validator/validator_instance.dart index b983192..34a9743 100644 --- a/glade_forms/lib/src/validator/validator_instance.dart +++ b/glade_forms/lib/src/validator/validator_instance.dart @@ -28,10 +28,10 @@ class ValidatorInstance { if (error != null) { errors.add(error); - if (stopOnFirstError) return ValidatorResult(errors: errors, associatedInput: _input); + if (stopOnFirstError) return ValidatorResult(errors: errors, associatedInput: _input); } } - return ValidatorResult(errors: errors, associatedInput: _input); + return ValidatorResult(errors: errors, associatedInput: _input); } } diff --git a/glade_forms/lib/src/widgets/glade_model_debug_info.dart b/glade_forms/lib/src/widgets/glade_model_debug_info.dart index 01b2517..243135f 100644 --- a/glade_forms/lib/src/widgets/glade_model_debug_info.dart +++ b/glade_forms/lib/src/widgets/glade_model_debug_info.dart @@ -119,7 +119,7 @@ class _DangerStrips extends StatelessWidget { required this.gap, }); - List getListOfStripes(int count) { + List _getListOfStripes(int count) { final stripes = []; for (var i = 0; i < count; i++) { stripes.add( @@ -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())); }, ), ); diff --git a/glade_forms/test/model/group_edit_test.dart b/glade_forms/test/model/group_edit_test.dart index dd580d3..5ebef1b 100644 --- a/glade_forms/test/model/group_edit_test.dart +++ b/glade_forms/test/model/group_edit_test.dart @@ -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(() { diff --git a/storybook/lib/localization_addon_custom.dart b/storybook/lib/localization_addon_custom.dart index bb92c79..a561fa6 100644 --- a/storybook/lib/localization_addon_custom.dart +++ b/storybook/lib/localization_addon_custom.dart @@ -37,6 +37,7 @@ class LocalizationAddonCustom extends WidgetbookAddon { 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');