refactor: replace shelltranslationservice with validationMessage input

This commit is contained in:
Vick Top 2024-02-29 14:20:52 +01:00
parent 1b9844c5d0
commit b1ca468085
18 changed files with 105 additions and 110 deletions

View file

@ -35,6 +35,7 @@ class _AgePageState extends State<AgePage> {
minValue: 12, minValue: 12,
maxValue: 120, maxValue: 120,
controller: widget.inputController, controller: widget.inputController,
validationMessage: 'Please fill in your age.',
), ),
], ],
); );

View file

@ -34,7 +34,10 @@ class _CarouselPageState extends State<CarouselPage> {
amountOfPages: 4, amountOfPages: 4,
flutterFormWidgets: [ flutterFormWidgets: [
FlutterFormInputCarousel( FlutterFormInputCarousel(
controller: widget.inputController, items: getCars()) controller: widget.inputController,
items: getCars(),
validationMessage: 'Validation error message.',
)
], ],
); );
} }

View file

@ -46,6 +46,7 @@ class _DatePageState extends State<DatePage> {
), ),
label: const Text("Custom date label"), label: const Text("Custom date label"),
controller: widget.dateController, controller: widget.dateController,
validationMessage: 'Please fill in a date.',
), ),
), ),
], ],

View file

@ -40,6 +40,7 @@ class _NamePageState extends State<NamePage> {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text("First Name"), label: const Text("First Name"),
controller: widget.firstNameController, controller: widget.firstNameController,
validationMessage: 'Please fill in your first name.',
), ),
), ),
if (widget.showLastName) if (widget.showLastName)
@ -48,6 +49,7 @@ class _NamePageState extends State<NamePage> {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text("Last Name"), label: const Text("Last Name"),
controller: widget.lastNameController, controller: widget.lastNameController,
validationMessage: 'Please fill in your last name.',
), ),
), ),
], ],

View file

@ -189,6 +189,7 @@ class _FormExampleState extends ConsumerState<FormExample> {
child: Center( child: Center(
child: FlutterFormInputPhone( child: FlutterFormInputPhone(
controller: phoneInputController, controller: phoneInputController,
validationMessage: 'Please fill in a valid phone number',
), ),
), ),
), ),

View file

@ -9,4 +9,3 @@ export 'src/form.dart';
export 'src/widgets/input/abstractions.dart'; export 'src/widgets/input/abstractions.dart';
export 'src/widgets/input/input_types/input_types.dart'; export 'src/widgets/input/input_types/input_types.dart';
export 'utils/form.dart'; export 'utils/form.dart';
export 'utils/translation_service.dart';

View file

@ -122,6 +122,6 @@ abstract class FlutterFormInputController<T> {
/// [onValidate] is used to validate the given input by the user. /// [onValidate] is used to validate the given input by the user.
String? onValidate( String? onValidate(
T? value, T? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
); );
} }

View file

@ -16,24 +16,27 @@ import 'package:flutter_input_library/flutter_input_library.dart' as input;
class FlutterFormInputCarousel extends FlutterFormInputWidget<int> { class FlutterFormInputCarousel extends FlutterFormInputWidget<int> {
const FlutterFormInputCarousel({ const FlutterFormInputCarousel({
required super.controller, required super.controller,
required this.validationMessage,
required this.items, required this.items,
super.key, super.key,
super.label, super.label,
this.validator,
this.height = 425, this.height = 425,
}); });
final List<Widget> items; final List<Widget> items;
final double height; final double height;
final String validationMessage;
final String? Function(int?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
return input.FlutterFormInputCarousel( return input.FlutterFormInputCarousel(
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
onChanged: controller.onChanged, onChanged: controller.onChanged,
initialValue: controller.value ?? 0, initialValue: controller.value ?? 0,
items: items, items: items,
@ -86,7 +89,7 @@ class FlutterFormInputCarouselController
@override @override
String? onValidate( String? onValidate(
int? value, int? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) {} if (mandatory) {}

View file

@ -33,9 +33,11 @@ class FlutterFormInputDateTime extends FlutterFormInputWidget<String> {
required super.controller, required super.controller,
required this.inputType, required this.inputType,
required this.dateFormat, required this.dateFormat,
required this.validationMessage,
super.key, super.key,
super.label, super.label,
this.showIcon = true, this.showIcon = true,
this.validator,
this.firstDate, this.firstDate,
this.lastDate, this.lastDate,
this.initialDate, this.initialDate,
@ -54,10 +56,11 @@ class FlutterFormInputDateTime extends FlutterFormInputWidget<String> {
final IconData icon; final IconData icon;
final bool enabled; final bool enabled;
final bool onTapEnabled; final bool onTapEnabled;
final String validationMessage;
final String? Function(String?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
return input.FlutterFormInputDateTime( return input.FlutterFormInputDateTime(
@ -71,7 +74,8 @@ class FlutterFormInputDateTime extends FlutterFormInputWidget<String> {
inputType: inputType, inputType: inputType,
onChanged: (value) => controller.onChanged?.call(value), onChanged: (value) => controller.onChanged?.call(value),
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
initialValue: controller.value, initialValue: controller.value,
dateFormat: dateFormat, dateFormat: dateFormat,
initialDate: initialDate, initialDate: initialDate,
@ -143,11 +147,11 @@ class FlutterFormInputDateTimeController
@override @override
String? onValidate( String? onValidate(
String? value, String? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) { if (mandatory) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return translator('shell.form.error.empty'); return validationMessage;
} }
} }

View file

@ -16,21 +16,23 @@ class FlutterFormInputEmail extends FlutterFormInputWidget<String> {
/// The [key], [focusNode], [label], and [enabled] parameters are optional. /// The [key], [focusNode], [label], and [enabled] parameters are optional.
const FlutterFormInputEmail({ const FlutterFormInputEmail({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.focusNode, super.focusNode,
super.label, super.label,
bool? enabled, bool? enabled,
this.validator,
this.decoration, this.decoration,
}) : super( }) : super(
enabled: enabled ?? true, enabled: enabled ?? true,
); );
final InputDecoration? decoration; final InputDecoration? decoration;
final String validationMessage;
final String? Function(String?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
return input.FlutterFormInputPlainText( return input.FlutterFormInputPlainText(
@ -40,7 +42,8 @@ class FlutterFormInputEmail extends FlutterFormInputWidget<String> {
controller.onSaved(value); controller.onSaved(value);
}, },
focusNode: focusNode, focusNode: focusNode,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
onChanged: (value) => controller.onChanged?.call(value), onChanged: (value) => controller.onChanged?.call(value),
decoration: decoration, decoration: decoration,
); );
@ -98,17 +101,17 @@ class FlutterFormInputEmailController
@override @override
String? onValidate( String? onValidate(
String? value, String? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) { if (mandatory) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return translator('shell.form.error.empty'); return validationMessage;
} }
if (!RegExp( if (!RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+", r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+",
).hasMatch(value)) { ).hasMatch(value)) {
return translator('shell.form.error.email.notValid'); return validationMessage;
} }
} }

View file

@ -15,26 +15,29 @@ import 'package:flutter_input_library/flutter_input_library.dart' as input;
class FlutterFormInputNumberPicker extends FlutterFormInputWidget<int> { class FlutterFormInputNumberPicker extends FlutterFormInputWidget<int> {
const FlutterFormInputNumberPicker({ const FlutterFormInputNumberPicker({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.label, super.label,
this.validator,
this.minValue = 0, this.minValue = 0,
this.maxValue = 100, this.maxValue = 100,
}) : assert(minValue < maxValue, 'minValue must be less than maxValue'); }) : assert(minValue < maxValue, 'minValue must be less than maxValue');
final int minValue; final int minValue;
final int maxValue; final int maxValue;
final String validationMessage;
final String? Function(int?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
return input.FlutterFormInputNumberPicker( return input.FlutterFormInputNumberPicker(
minValue: minValue, minValue: minValue,
maxValue: maxValue, maxValue: maxValue,
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
onChanged: (value) => controller.onChanged?.call(value), onChanged: (value) => controller.onChanged?.call(value),
initialValue: controller.value ?? minValue, initialValue: controller.value ?? minValue,
); );
@ -91,7 +94,7 @@ class FlutterFormInputNumberPickerController
@override @override
String? onValidate( String? onValidate(
int? value, int? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) {} if (mandatory) {}

View file

@ -12,29 +12,31 @@ import 'package:flutter_input_library/flutter_input_library.dart' as input;
class FlutterFormInputPassword extends FlutterFormInputWidget<String> { class FlutterFormInputPassword extends FlutterFormInputWidget<String> {
const FlutterFormInputPassword({ const FlutterFormInputPassword({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.focusNode, super.focusNode,
super.label, super.label,
bool? enabled, bool? enabled,
this.validator,
this.decoration, this.decoration,
}) : super( }) : super(
enabled: enabled ?? true, enabled: enabled ?? true,
); );
final InputDecoration? decoration; final InputDecoration? decoration;
final String validationMessage;
final String? Function(String?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.registerController(context); super.registerController(context);
var translator = getTranslator(context);
return input.FlutterFormInputPassword( return input.FlutterFormInputPassword(
enabled: enabled, enabled: enabled,
initialValue: controller.value, initialValue: controller.value,
focusNode: focusNode, focusNode: focusNode,
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
onChanged: (value) => controller.onChanged?.call(value), onChanged: (value) => controller.onChanged?.call(value),
onFieldSubmitted: (value) => controller.onSubmit?.call(value), onFieldSubmitted: (value) => controller.onSubmit?.call(value),
decoration: decoration, decoration: decoration,
@ -93,15 +95,15 @@ class FlutterFormInputPasswordController
@override @override
String? onValidate( String? onValidate(
String? value, String? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) { if (mandatory) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return translator('Field can not be empty'); return validationMessage;
} }
if (value.length < 6) { if (value.length < 6) {
return translator('Field should be at least 6 characters long'); return validationMessage;
} }
} }

View file

@ -14,12 +14,14 @@ import 'package:flutter_input_library/flutter_input_library.dart' as input;
class FlutterFormInputPhone extends FlutterFormInputWidget<input.PhoneNumber?> { class FlutterFormInputPhone extends FlutterFormInputWidget<input.PhoneNumber?> {
const FlutterFormInputPhone({ const FlutterFormInputPhone({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.focusNode, super.focusNode,
super.label, super.label,
this.decoration, this.decoration,
this.enabled = true, this.enabled = true,
this.numberFieldStyle, this.numberFieldStyle,
this.validator,
this.dialCodeSelectorStyle, this.dialCodeSelectorStyle,
this.dialCodeSelectorPadding = const EdgeInsets.only(top: 6), this.dialCodeSelectorPadding = const EdgeInsets.only(top: 6),
this.textAlignVertical = TextAlignVertical.top, this.textAlignVertical = TextAlignVertical.top,
@ -32,11 +34,11 @@ class FlutterFormInputPhone extends FlutterFormInputWidget<input.PhoneNumber?> {
final TextStyle? dialCodeSelectorStyle; final TextStyle? dialCodeSelectorStyle;
final EdgeInsets dialCodeSelectorPadding; final EdgeInsets dialCodeSelectorPadding;
final TextAlignVertical textAlignVertical; final TextAlignVertical textAlignVertical;
final String validationMessage;
final String? Function(PhoneNumber?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
var inputDecoration = decoration ?? var inputDecoration = decoration ??
@ -50,7 +52,8 @@ class FlutterFormInputPhone extends FlutterFormInputWidget<input.PhoneNumber?> {
enabled: enabled, enabled: enabled,
initialValue: controller.value, initialValue: controller.value,
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
onChanged: (value) => controller.onChanged?.call(value), onChanged: (value) => controller.onChanged?.call(value),
onFieldSubmitted: (value) => controller.onSubmit?.call(value), onFieldSubmitted: (value) => controller.onSubmit?.call(value),
decoration: inputDecoration, decoration: inputDecoration,
@ -100,11 +103,11 @@ class FlutterFormInputPhoneController
@override @override
String? onValidate( String? onValidate(
input.PhoneNumber? value, input.PhoneNumber? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) { if (mandatory) {
if (value == null || value.number == null) { if (value == null || value.number == null) {
return translator('Field can not be empty'); return validationMessage;
} }
} }

View file

@ -20,6 +20,7 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
/// [enabled], [style], and [textCapitalization] parameters are optional. /// [enabled], [style], and [textCapitalization] parameters are optional.
const FlutterFormInputPlainText({ const FlutterFormInputPlainText({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.focusNode, super.focusNode,
super.label, super.label,
@ -30,6 +31,7 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
this.scrollPadding, this.scrollPadding,
this.maxLength, this.maxLength,
this.keyboardType, this.keyboardType,
this.validator,
this.enabled = true, this.enabled = true,
this.style, this.style,
this.textCapitalization = TextCapitalization.none, this.textCapitalization = TextCapitalization.none,
@ -46,11 +48,11 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
final bool enabled; final bool enabled;
final TextStyle? style; final TextStyle? style;
final TextCapitalization textCapitalization; final TextCapitalization textCapitalization;
final String validationMessage;
final String? Function(String?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
var inputDecoration = decoration ?? var inputDecoration = decoration ??
@ -65,7 +67,8 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
initialValue: controller.value, initialValue: controller.value,
focusNode: focusNode, focusNode: focusNode,
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
onChanged: (value) => controller.onChanged?.call(value), onChanged: (value) => controller.onChanged?.call(value),
onFieldSubmitted: (value) => controller.onSubmit?.call(value), onFieldSubmitted: (value) => controller.onSubmit?.call(value),
decoration: inputDecoration, decoration: inputDecoration,
@ -89,10 +92,12 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
class FlutterFormInputMultiLine extends StatelessWidget { class FlutterFormInputMultiLine extends StatelessWidget {
const FlutterFormInputMultiLine({ const FlutterFormInputMultiLine({
required this.controller, required this.controller,
required this.validationMessage,
super.key, super.key,
this.focusNode, this.focusNode,
this.label, this.label,
this.hint, this.hint,
this.validator,
this.maxCharacters, this.maxCharacters,
this.enabled = true, this.enabled = true,
this.textCapitalization = TextCapitalization.sentences, this.textCapitalization = TextCapitalization.sentences,
@ -119,11 +124,12 @@ class FlutterFormInputMultiLine extends StatelessWidget {
/// The capitalization behavior for the input field. /// The capitalization behavior for the input field.
final TextCapitalization textCapitalization; final TextCapitalization textCapitalization;
@override final String validationMessage;
Widget build(BuildContext context) {
var translator = getTranslator(context);
return input.FlutterFormInputMultiLine( final String? Function(String?)? validator;
@override
Widget build(BuildContext context) => input.FlutterFormInputMultiLine(
enabled: enabled, enabled: enabled,
label: label, label: label,
hint: hint, hint: hint,
@ -132,11 +138,11 @@ class FlutterFormInputMultiLine extends StatelessWidget {
maxCharacters: maxCharacters, maxCharacters: maxCharacters,
onChanged: controller.onChanged, onChanged: controller.onChanged,
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (v) => controller.onValidate(v, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
textCapitalization: textCapitalization, textCapitalization: textCapitalization,
); );
} }
}
/// Controller for plain text used by a [FlutterFormInputWidget] used in a /// Controller for plain text used by a [FlutterFormInputWidget] used in a
/// [FlutterForm]. /// [FlutterForm].
@ -189,11 +195,11 @@ class FlutterFormInputPlainTextController
@override @override
String? onValidate( String? onValidate(
String? value, String? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) { if (mandatory) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return translator('Field can not be empty'); return validationMessage;
} }
} }

View file

@ -19,26 +19,29 @@ class FlutterFormInputSlider extends FlutterFormInputWidget<double> {
/// The [enabled] parameter specifies whether the input field is enabled. /// The [enabled] parameter specifies whether the input field is enabled.
const FlutterFormInputSlider({ const FlutterFormInputSlider({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.focusNode, super.focusNode,
super.label, super.label,
this.validator,
this.minValue = 0, this.minValue = 0,
this.maxValue = 100, this.maxValue = 100,
}) : assert(minValue < maxValue, 'minValue must be less than maxValue'); }) : assert(minValue < maxValue, 'minValue must be less than maxValue');
final int minValue; final int minValue;
final int maxValue; final int maxValue;
final String validationMessage;
final String? Function(double?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
return input.FlutterFormInputSlider( return input.FlutterFormInputSlider(
focusNode: focusNode, focusNode: focusNode,
onSaved: controller.onSaved, onSaved: controller.onSaved,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
); );
} }
} }
@ -93,7 +96,7 @@ class FlutterFormInputSliderController
@override @override
String? onValidate( String? onValidate(
double? value, double? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) { ) {
if (mandatory) {} if (mandatory) {}

View file

@ -14,22 +14,26 @@ import 'package:flutter_input_library/flutter_input_library.dart' as input;
class FlutterFormInputSwitch extends FlutterFormInputWidget<bool> { class FlutterFormInputSwitch extends FlutterFormInputWidget<bool> {
const FlutterFormInputSwitch({ const FlutterFormInputSwitch({
required super.controller, required super.controller,
required this.validationMessage,
super.key, super.key,
super.focusNode, super.focusNode,
super.label, super.label,
this.validator,
}); });
final String validationMessage;
final String? Function(bool?)? validator;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var translator = getTranslator(context);
super.registerController(context); super.registerController(context);
return input.FlutterFormInputBool( return input.FlutterFormInputBool(
focusNode: focusNode, focusNode: focusNode,
onSaved: controller.onSaved, onSaved: controller.onSaved,
onChanged: controller.onChanged, onChanged: controller.onChanged,
validator: (value) => controller.onValidate(value, translator), validator: validator ??
(value) => controller.onValidate(value, validationMessage),
initialValue: controller.value ?? false, initialValue: controller.value ?? false,
widgetType: input.BoolWidgetType.switchWidget, widgetType: input.BoolWidgetType.switchWidget,
); );
@ -86,7 +90,7 @@ class FlutterFormInputSwitchController
@override @override
String? onValidate( String? onValidate(
bool? value, bool? value,
String Function(String, {List<String>? params}) translator, String validationMessage,
) => ) =>
null; null;
} }

View file

@ -1,48 +0,0 @@
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart';
abstract class TranslationService {
TranslationService._();
String translate(
BuildContext context,
String key, {
List<String>? params,
});
String number(double value);
}
typedef Translator = String Function(
String, {
List<String>? params,
});
class ShellTranslationService implements TranslationService {
@override
String number(double value) => value.toStringAsFixed(2);
@override
String translate(BuildContext context, String key, {List<String>? params}) =>
key;
}
Translator getTranslator(BuildContext context) {
try {
var translator = ShellTranslationService().translate;
return (
String key, {
List<String>? params,
}) =>
translator(context, key, params: params);
} on Exception catch (_) {
return (
String key, {
List<String>? params,
}) =>
key;
}
}

View file

@ -56,6 +56,7 @@ void main() {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text('Field1Label'), label: const Text('Field1Label'),
controller: testField1Controller, controller: testField1Controller,
validationMessage: 'Please fill in this field',
), ),
), ),
), ),
@ -64,6 +65,7 @@ void main() {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text('Field2Label'), label: const Text('Field2Label'),
controller: testField2Controller, controller: testField2Controller,
validationMessage: 'Please fill in this field',
), ),
), ),
), ),
@ -154,6 +156,7 @@ void main() {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text('Field1Label'), label: const Text('Field1Label'),
controller: testField1Controller, controller: testField1Controller,
validationMessage: 'Please fill in this field',
), ),
), ),
), ),
@ -162,6 +165,7 @@ void main() {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text('Field2Label'), label: const Text('Field2Label'),
controller: testField2Controller, controller: testField2Controller,
validationMessage: 'Please fill in this field',
), ),
), ),
), ),
@ -260,6 +264,7 @@ void main() {
child: FlutterFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text('Field1Label'), label: const Text('Field1Label'),
controller: testField1Controller, controller: testField1Controller,
validationMessage: 'Field can not be empty',
), ),
), ),
), ),