chore: fix and format using melos

This commit is contained in:
2023-02-23 19:19:48 +01:00
parent d098d9a6bf
commit 8d833d39d7
152 changed files with 441 additions and 468 deletions
@@ -35,7 +35,9 @@ class App extends StatelessWidget {
FormInput(formFieldEmail, const Email.pure(),
metadata: const FormInputMetadata<Metadata>(extra: blue)),
FormInput(
formFieldList, const ListOption<String>.pure(choices: ['c1', 'c2', 'c3'],defaultValue: 'c3')),
formFieldList,
const ListOption<String>.pure(
choices: ['c1', 'c2', 'c3'], defaultValue: 'c3')),
FormInput(formFieldRadio, const TextString.pure()),
FormInput(formFieldPro, const Boolean.pure(),
metadata: const FormInputMetadata<Metadata>(name: 'business')),
@@ -65,7 +67,7 @@ class App extends StatelessWidget {
Widget build(BuildContext context) {
FormRepository formRepository = FormRepositoryImpl()
..registerForm(getNormalFormData());
// FormRepository formRepository = FormRepositoryImpl()
// ..registerForm(WyattFormImpl([
// FormInput(formFieldName, const Name.pure('Test'),
@@ -15,10 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
enum Category {
perso,
business
}
enum Category { perso, business }
class Metadata {
final Category category;
@@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
@@ -23,4 +23,4 @@ const String formFieldList = 'list';
const String formFieldRadio = 'radio';
const String formFieldHidden = 'hidden';
const String formFieldPro = 'isPro';
const String formFieldPro = 'isPro';
@@ -38,8 +38,7 @@ class _NameInput extends StatelessWidget {
Widget build(BuildContext context) {
return InputBuilderTextController<SimpleCustomFormCubit, String?, Metadata>(
field: formFieldName,
builder:
(context, cubit, state, field, input, controller, metadata) {
builder: (context, cubit, state, field, input, controller, metadata) {
final meta = state.form.metadataOf<Metadata>(field).extra;
final color = computeColor(meta);
return Row(
@@ -0,0 +1 @@
@@ -33,7 +33,7 @@ enum SetOperation {
/// Add new elements to set.
union(FormUnion());
final FormOperation operation;
const SetOperation(this.operation);
final FormOperation operation;
}
@@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
@@ -26,7 +26,6 @@ import 'package:wyatt_form_bloc/src/domain/input_validators/form_input_validator
// ignore: must_be_immutable
class WyattFormImpl extends WyattForm {
WyattFormImpl(
this._inputs, {
required String name,
@@ -149,7 +148,7 @@ class WyattFormImpl extends WyattForm {
@override
bool isValidInput(String key) => inputOf(key).validator.valid;
@override
bool isInvalidInput(String key) => inputOf(key).validator.invalid;
@@ -22,17 +22,15 @@ import 'package:wyatt_form_bloc/src/domain/input_validators/form_input_validator
/// {@endtemplate}
class Boolean extends NullableValidator<bool, ValidationStandardError> {
/// {@macro boolean}
const Boolean.pure({bool defaultValue = false})
: super.pure(defaultValue);
const Boolean.pure({bool defaultValue = false}) : super.pure(defaultValue);
/// {@macro boolean}
const Boolean.dirty({bool? value}) : super.dirty(value);
@override
ValidationStandardError get onNull => ValidationStandardError.invalid;
@override
ValidationStandardError? validator(bool? value) =>
value != null ? null : onNull;
}
@@ -21,8 +21,7 @@ class EnumOption<T> extends AnyValidator<T, List<T>, ValidationError> {
const EnumOption.pure({this.enums = const [], T? defaultValue})
: super.pure(defaultValue);
const EnumOption.dirty({required this.enums, T? value})
: super.dirty(value);
const EnumOption.dirty({required this.enums, T? value}) : super.dirty(value);
final List<T> enums;
@@ -61,6 +61,5 @@ class FormInput<
List<Object?> get props => [key, validator, metadata];
@override
String toString() =>
'FormInput(name: $name, $validator)';
String toString() => 'FormInput(name: $name, $validator)';
}
@@ -17,12 +17,12 @@
part of 'form_data_cubit.dart';
abstract class FormDataState extends Equatable {
const FormDataState({
required this.form,
this.status = FormStatus.pure,
this.errorMessage,
});
/// Global status of a form.
final FormStatus status;
@@ -27,7 +27,6 @@ import 'package:wyatt_form_bloc/src/presentation/features/form_data/form_data_cu
part 'form_data_state_impl.dart';
abstract class FormDataCubitImpl extends FormDataCubit<FormDataStateImpl> {
FormDataCubitImpl(this._formRepository, this._formName)
: super(FormDataStateImpl(form: _formRepository.accessForm(_formName)));
final FormRepository _formRepository;