Replaced ShellForm with FlutterForm

This commit is contained in:
Jacques Doeleman 2022-09-28 12:02:40 +02:00
parent cade46ecfe
commit fa6994cee5
18 changed files with 139 additions and 139 deletions

View file

@ -18,7 +18,7 @@ To use this package, add `flutter_form` as a [dependency in your pubspec.yaml fi
See the [Example Code](example/lib/form_example.dart) for an example on how to use this package. See the [Example Code](example/lib/form_example.dart) for an example on how to use this package.
WARNING Make sure to define your ShellFormInputControllers above your Flutter Form and not inside each page. This prevents that the used controllers differ from the registered ones. WARNING Make sure to define your FlutterFormInputControllers above your Flutter Form and not inside each page. This prevents that the used controllers differ from the registered ones.
Flutter Form has two paramaters: options and formController. Each of these parameters' own parameters will be explained in tabels below. Flutter Form has two paramaters: options and formController. Each of these parameters' own parameters will be explained in tabels below.

View file

@ -8,7 +8,7 @@ class AgePage extends StatefulWidget {
super.key, super.key,
}); });
final ShellFormInputNumberPickerController inputController; final FlutterFormInputNumberPickerController inputController;
@override @override
State<AgePage> createState() => _AgePageState(); State<AgePage> createState() => _AgePageState();
@ -26,8 +26,8 @@ class _AgePageState extends State<AgePage> {
title: "What is your age?", title: "What is your age?",
pageNumber: 1, pageNumber: 1,
amountOfPages: 3, amountOfPages: 3,
shellFormWidgets: [ FlutterFormWidgets: [
ShellFormInputNumberPicker( FlutterFormInputNumberPicker(
minValue: 12, minValue: 12,
maxValue: 120, maxValue: 120,
controller: widget.inputController, controller: widget.inputController,

View file

@ -9,7 +9,7 @@ class CarouselPage extends StatefulWidget {
super.key, super.key,
}); });
final ShellFormInputCarouselController inputController; final FlutterFormInputCarouselController inputController;
final List<Map<String, dynamic>> cars; final List<Map<String, dynamic>> cars;
@override @override
@ -28,8 +28,8 @@ class _CarouselPageState extends State<CarouselPage> {
title: "What's your favorite car?", title: "What's your favorite car?",
pageNumber: 3, pageNumber: 3,
amountOfPages: 3, amountOfPages: 3,
shellFormWidgets: [ FlutterFormWidgets: [
ShellFormInputCarousel( FlutterFormInputCarousel(
controller: widget.inputController, items: getCars()) controller: widget.inputController, items: getCars())
], ],
); );

View file

@ -10,8 +10,8 @@ class NamePage extends StatefulWidget {
super.key, super.key,
}); });
final ShellFormInputPlainTextController firstNameController; final FlutterFormInputPlainTextController firstNameController;
final ShellFormInputPlainTextController lastNameController; final FlutterFormInputPlainTextController lastNameController;
final bool showLastName; final bool showLastName;
@override @override
@ -30,10 +30,10 @@ class _NamePageState extends State<NamePage> {
pageNumber: 2, pageNumber: 2,
amountOfPages: 3, amountOfPages: 3,
title: "Please enter your name", title: "Please enter your name",
shellFormWidgets: [ FlutterFormWidgets: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(40, 0, 40, 40), padding: const EdgeInsets.fromLTRB(40, 0, 40, 40),
child: ShellFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text("First Name"), label: const Text("First Name"),
controller: widget.firstNameController, controller: widget.firstNameController,
), ),
@ -41,7 +41,7 @@ class _NamePageState extends State<NamePage> {
if (widget.showLastName) if (widget.showLastName)
Padding( Padding(
padding: const EdgeInsets.fromLTRB(40, 0, 40, 0), padding: const EdgeInsets.fromLTRB(40, 0, 40, 0),
child: ShellFormInputPlainText( child: FlutterFormInputPlainText(
label: const Text("Last Name"), label: const Text("Last Name"),
controller: widget.lastNameController, controller: widget.lastNameController,
), ),

View file

@ -15,18 +15,18 @@ class FormExample extends ConsumerStatefulWidget {
} }
class _FormExampleState extends ConsumerState<FormExample> { class _FormExampleState extends ConsumerState<FormExample> {
final ShellFormController formController = ShellFormController(); final FlutterFormController formController = FlutterFormController();
final String checkPageText = "All entered info: "; final String checkPageText = "All entered info: ";
final ageInputController = ShellFormInputNumberPickerController( final ageInputController = FlutterFormInputNumberPickerController(
id: "age", id: "age",
checkPageTitle: (dynamic amount) { checkPageTitle: (dynamic amount) {
return "Age: $amount years"; return "Age: $amount years";
}, },
); );
late final ShellFormInputCarouselController carouselInputController; late final FlutterFormInputCarouselController carouselInputController;
final List<Map<String, dynamic>> cars = [ final List<Map<String, dynamic>> cars = [
{ {
@ -43,8 +43,8 @@ class _FormExampleState extends ConsumerState<FormExample> {
}, },
]; ];
ShellFormInputPlainTextController firstNameController = FlutterFormInputPlainTextController firstNameController =
ShellFormInputPlainTextController( FlutterFormInputPlainTextController(
mandatory: true, mandatory: true,
id: "firstName", id: "firstName",
checkPageTitle: (dynamic firstName) { checkPageTitle: (dynamic firstName) {
@ -52,8 +52,8 @@ class _FormExampleState extends ConsumerState<FormExample> {
}, },
); );
ShellFormInputPlainTextController lastNameController = FlutterFormInputPlainTextController lastNameController =
ShellFormInputPlainTextController( FlutterFormInputPlainTextController(
mandatory: true, mandatory: true,
id: "lastName", id: "lastName",
checkPageTitle: (dynamic lastName) { checkPageTitle: (dynamic lastName) {
@ -64,7 +64,7 @@ class _FormExampleState extends ConsumerState<FormExample> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
carouselInputController = ShellFormInputCarouselController( carouselInputController = FlutterFormInputCarouselController(
id: 'carCarousel', id: 'carCarousel',
checkPageTitle: (dynamic index) { checkPageTitle: (dynamic index) {
return cars[index]["title"]; return cars[index]["title"];
@ -88,7 +88,7 @@ class _FormExampleState extends ConsumerState<FormExample> {
body: Center( body: Center(
child: FlutterForm( child: FlutterForm(
formController: formController, formController: formController,
options: ShellFormOptions( options: FlutterFormOptions(
onFinished: (Map<int, Map<String, dynamic>> results) { onFinished: (Map<int, Map<String, dynamic>> results) {
debugPrint("Final full results: $results"); debugPrint("Final full results: $results");
Navigator.of(context).pushNamed('/thanks'); Navigator.of(context).pushNamed('/thanks');
@ -172,19 +172,19 @@ class _FormExampleState extends ConsumerState<FormExample> {
return Container(); return Container();
}, },
pages: [ pages: [
ShellFormPage( FlutterFormPage(
child: AgePage( child: AgePage(
inputController: ageInputController, inputController: ageInputController,
), ),
), ),
ShellFormPage( FlutterFormPage(
child: NamePage( child: NamePage(
firstNameController: firstNameController, firstNameController: firstNameController,
lastNameController: lastNameController, lastNameController: lastNameController,
showLastName: showLastName, showLastName: showLastName,
), ),
), ),
ShellFormPage( FlutterFormPage(
child: CarouselPage( child: CarouselPage(
inputController: carouselInputController, inputController: carouselInputController,
cars: cars, cars: cars,

View file

@ -8,7 +8,7 @@ class TemplatePage extends StatelessWidget {
required this.title, required this.title,
required this.pageNumber, required this.pageNumber,
required this.amountOfPages, required this.amountOfPages,
required this.shellFormWidgets, required this.FlutterFormWidgets,
}); });
final Size size; final Size size;
@ -16,7 +16,7 @@ class TemplatePage extends StatelessWidget {
final String title; final String title;
final int pageNumber; final int pageNumber;
final int amountOfPages; final int amountOfPages;
final List<Widget> shellFormWidgets; final List<Widget> FlutterFormWidgets;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -54,7 +54,7 @@ class TemplatePage extends StatelessWidget {
), ),
), ),
const Spacer(), const Spacer(),
for (var widget in shellFormWidgets) ...[ for (var widget in FlutterFormWidgets) ...[
widget, widget,
], ],
const Spacer( const Spacer(

View file

@ -1,21 +1,21 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
/// The options used to set parameters to a [ShellForm]. /// The options used to set parameters to a [FlutterForm].
/// ///
/// The pages determine what pages the pageview will contain via a [List] of [ShellFormPage]s. /// The pages determine what pages the pageview will contain via a [List] of [FlutterFormPage]s.
/// ///
/// Using a checkpage gives the ability for the user to check all input values before commiting by [CheckPage]. /// Using a checkpage gives the ability for the user to check all input values before commiting by [CheckPage].
/// If [checkPage] is null no check page will be shown. /// If [checkPage] is null no check page will be shown.
/// ///
/// [nextButton] and [backButton] are both a way to give controls to user. /// [nextButton] and [backButton] are both a way to give controls to user.
/// Both are just plain widgets used in a [Stack]. So the widgets can be aligned where ever. /// Both are just plain widgets used in a [Stack]. So the widgets can be aligned where ever.
/// The formcontroller of [ShellForm] should be used to give control to the widgets/buttons. /// The formcontroller of [FlutterForm] should be used to give control to the widgets/buttons.
/// ///
/// [onFinished] and [onNext] are both callbacks which give the users results. /// [onFinished] and [onNext] are both callbacks which give the users results.
/// [onNext] is called when the user goes to the next page. /// [onNext] is called when the user goes to the next page.
/// [onFinished] is called when the form is finished. When checkpage is set [onFinished] is called when the checkpage is finished. /// [onFinished] is called when the form is finished. When checkpage is set [onFinished] is called when the checkpage is finished.
class ShellFormOptions { class FlutterFormOptions {
final List<ShellFormPage> pages; final List<FlutterFormPage> pages;
final CheckPage? checkPage; final CheckPage? checkPage;
final Widget Function(int pageNumber, bool checkingPages)? nextButton; final Widget Function(int pageNumber, bool checkingPages)? nextButton;
@ -24,7 +24,7 @@ class ShellFormOptions {
final void Function(Map<int, Map<String, dynamic>>) onFinished; final void Function(Map<int, Map<String, dynamic>>) onFinished;
final void Function(int pageNumber, Map<String, dynamic>) onNext; final void Function(int pageNumber, Map<String, dynamic>) onNext;
const ShellFormOptions({ const FlutterFormOptions({
required this.pages, required this.pages,
this.checkPage, this.checkPage,
this.nextButton, this.nextButton,
@ -34,16 +34,16 @@ class ShellFormOptions {
}); });
} }
/// The defines every page in a [ShellForm]. /// The defines every page in a [FlutterForm].
class ShellFormPage { class FlutterFormPage {
final Widget child; final Widget child;
ShellFormPage({ FlutterFormPage({
required this.child, required this.child,
}); });
} }
/// [CheckPage] is used to set a check page at the end of a [ShellForm]. /// [CheckPage] is used to set a check page at the end of a [FlutterForm].
/// A [CheckPage] is a page where the user can check all input values before commiting. /// A [CheckPage] is a page where the user can check all input values before commiting.
/// ///
/// [title] is the widget shown at the top of the page. /// [title] is the widget shown at the top of the page.

View file

@ -9,20 +9,20 @@ import 'utils/formstate.dart' as fs;
/// A wrapper for flutters [Form] that can be controlled by a controller and provides multiple pre-defined input types/fields /// A wrapper for flutters [Form] that can be controlled by a controller and provides multiple pre-defined input types/fields
/// [FlutterForm] also provides multi page forms and a check page for validation. /// [FlutterForm] also provides multi page forms and a check page for validation.
/// ///
/// A [ShellFormController] has to be given to control what happens to values and pages within the ShellForm. /// A [FlutterFormController] has to be given to control what happens to values and pages within the FlutterForm.
/// ///
/// [ShellFormOptions] have to be provided to control the appearance of the form. /// [FlutterFormOptions] have to be provided to control the appearance of the form.
/// ///
/// WARNING Define your FormInputController above your FlutterForm. Otherwise when rebuild the controller will differ from the registered ones. /// WARNING Define your FormInputController above your FlutterForm. Otherwise when rebuild the controller will differ from the registered ones.
/// ``` dart /// ``` dart
/// ShellFormInputEmailController emailController = /// FlutterFormInputEmailController emailController =
/// ShellFormInputEmailController(id: 'email'); /// FlutterFormInputEmailController(id: 'email');
/// ShellFormInputPasswordController passwordController = /// FlutterFormInputPasswordController passwordController =
/// ShellFormInputPasswordController(id: 'password'); /// FlutterFormInputPasswordController(id: 'password');
/// ///
/// ShellForm( /// FlutterForm(
/// formController: shellFormController, /// formController: FlutterFormController,
/// options: ShellFormOptions( /// options: FlutterFormOptions(
/// onFinished: (Map<int, Map<String, dynamic>> results) { /// onFinished: (Map<int, Map<String, dynamic>> results) {
/// // print(results); /// // print(results);
/// }, /// },
@ -38,7 +38,7 @@ import 'utils/formstate.dart' as fs;
/// ), /// ),
/// child: ElevatedButton( /// child: ElevatedButton(
/// onPressed: () { /// onPressed: () {
/// shellFormController.autoNextStep(); /// FlutterFormController.autoNextStep();
/// }, /// },
/// child: Text(checkingPages ? "Save" : "Next Page"), /// child: Text(checkingPages ? "Save" : "Next Page"),
/// ), /// ),
@ -54,7 +54,7 @@ import 'utils/formstate.dart' as fs;
/// padding: EdgeInsets.zero, /// padding: EdgeInsets.zero,
/// splashRadius: 29, /// splashRadius: 29,
/// onPressed: () { /// onPressed: () {
/// shellFormController.previousStep(); /// FlutterFormController.previousStep();
/// }, /// },
/// icon: const Icon(Icons.chevron_left), /// icon: const Icon(Icons.chevron_left),
/// ), /// ),
@ -64,7 +64,7 @@ import 'utils/formstate.dart' as fs;
/// return Container(); /// return Container();
/// }, /// },
/// pages: [ /// pages: [
/// ShellFormPage( /// FlutterFormPage(
/// child: Column( /// child: Column(
/// mainAxisAlignment: MainAxisAlignment.center, /// mainAxisAlignment: MainAxisAlignment.center,
/// children: [ /// children: [
@ -90,11 +90,11 @@ import 'utils/formstate.dart' as fs;
/// ), /// ),
/// ), /// ),
/// const Spacer(), /// const Spacer(),
/// ShellFormInputEmail(controller: emailController), /// FlutterFormInputEmail(controller: emailController),
/// const SizedBox( /// const SizedBox(
/// height: 25, /// height: 25,
/// ), /// ),
/// ShellFormInputPassword(controller: passwordController), /// FlutterFormInputPassword(controller: passwordController),
/// const Spacer(), /// const Spacer(),
/// ], /// ],
/// ), /// ),
@ -184,15 +184,15 @@ class FlutterForm extends ConsumerStatefulWidget {
required this.formController, required this.formController,
}) : super(key: key); }) : super(key: key);
final ShellFormOptions options; final FlutterFormOptions options;
final ShellFormController formController; final FlutterFormController formController;
@override @override
ConsumerState<FlutterForm> createState() => _ShellFormState(); ConsumerState<FlutterForm> createState() => _FlutterFormState();
} }
class _ShellFormState extends ConsumerState<FlutterForm> { class _FlutterFormState extends ConsumerState<FlutterForm> {
late ShellFormController _formController; late FlutterFormController _formController;
@override @override
void initState() { void initState() {
@ -200,11 +200,11 @@ class _ShellFormState extends ConsumerState<FlutterForm> {
_formController = widget.formController; _formController = widget.formController;
_formController.setShellFormOptions(widget.options); _formController.setFlutterFormOptions(widget.options);
List<GlobalKey<FormState>> keys = []; List<GlobalKey<FormState>> keys = [];
for (ShellFormPage _ in widget.options.pages) { for (FlutterFormPage _ in widget.options.pages) {
keys.add(GlobalKey<FormState>()); keys.add(GlobalKey<FormState>());
} }
@ -214,10 +214,10 @@ class _ShellFormState extends ConsumerState<FlutterForm> {
setState(() {}); setState(() {});
}); });
List<ShellFormPageController> controllers = []; List<FlutterFormPageController> controllers = [];
for (int i = 0; i < widget.options.pages.length; i++) { for (int i = 0; i < widget.options.pages.length; i++) {
controllers.add(ShellFormPageController()); controllers.add(FlutterFormPageController());
} }
_formController.setFormPageControllers(controllers); _formController.setFormPageControllers(controllers);
@ -304,7 +304,7 @@ class _ShellFormState extends ConsumerState<FlutterForm> {
_formController.getAllResults().forEach( _formController.getAllResults().forEach(
(pageNumber, pageResults) { (pageNumber, pageResults) {
pageResults.forEach((inputId, inputResult) { pageResults.forEach((inputId, inputResult) {
ShellFormInputController? inputController = _formController FlutterFormInputController? inputController = _formController
.getFormPageControllers()[pageNumber] .getFormPageControllers()[pageNumber]
.getController(inputId); .getController(inputId);
@ -406,8 +406,8 @@ class _ShellFormState extends ConsumerState<FlutterForm> {
} }
} }
class ShellFormController extends ChangeNotifier { class FlutterFormController extends ChangeNotifier {
late ShellFormOptions _options; late FlutterFormOptions _options;
int _currentStep = 0; int _currentStep = 0;
@ -417,13 +417,13 @@ class ShellFormController extends ChangeNotifier {
final PageController _pageController = PageController(); final PageController _pageController = PageController();
late List<ShellFormPageController> _formPageControllers; late List<FlutterFormPageController> _formPageControllers;
List<ShellFormPageController> getFormPageControllers() { List<FlutterFormPageController> getFormPageControllers() {
return _formPageControllers; return _formPageControllers;
} }
setFormPageControllers(List<ShellFormPageController> controllers) { setFormPageControllers(List<FlutterFormPageController> controllers) {
_formPageControllers = controllers; _formPageControllers = controllers;
} }
@ -544,7 +544,7 @@ class ShellFormController extends ChangeNotifier {
return allValues; return allValues;
} }
setShellFormOptions(ShellFormOptions options) { setFlutterFormOptions(FlutterFormOptions options) {
_options = options; _options = options;
} }

View file

@ -1,9 +1,9 @@
import 'package:flutter_form/flutter_form.dart'; import 'package:flutter_form/flutter_form.dart';
class ShellFormPageController { class FlutterFormPageController {
List<ShellFormInputController> _controllers = []; List<FlutterFormInputController> _controllers = [];
void register(ShellFormInputController inputController) { void register(FlutterFormInputController inputController) {
_controllers.add(inputController); _controllers.add(inputController);
} }
@ -15,7 +15,7 @@ class ShellFormPageController {
return _controllers.any((element) => (element.id == id)); return _controllers.any((element) => (element.id == id));
} }
ShellFormInputController? getController(String key) { FlutterFormInputController? getController(String key) {
if (_isRegisteredById(key)) { if (_isRegisteredById(key)) {
return _controllers.firstWhere((element) => element.id == key); return _controllers.firstWhere((element) => element.id == key);
} }
@ -25,7 +25,7 @@ class ShellFormPageController {
Map<String, dynamic> getAllValues() { Map<String, dynamic> getAllValues() {
Map<String, dynamic> values = {}; Map<String, dynamic> values = {};
for (ShellFormInputController controller in _controllers) { for (FlutterFormInputController controller in _controllers) {
if (controller.value != null) { if (controller.value != null) {
values.addAll({controller.id!: controller.value}); values.addAll({controller.id!: controller.value});
} }

View file

@ -8,7 +8,7 @@ class FormState extends InheritedWidget {
required this.formController, required this.formController,
}) : super(key: key, child: child); }) : super(key: key, child: child);
final ShellFormPageController formController; final FlutterFormPageController formController;
static FormState of(BuildContext context) { static FormState of(BuildContext context) {
final FormState? result = final FormState? result =

View file

@ -2,25 +2,25 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '/src/utils/formstate.dart' as fs; import '/src/utils/formstate.dart' as fs;
/// Abstract class for the input widgets used in a [ShellForm]. /// Abstract class for the input widgets used in a [FlutterForm].
/// ///
/// The controller [ShellFormInputController] has to be given to the widget. /// The controller [FlutterFormInputController] has to be given to the widget.
/// Whicht controller is used determines how to value will be handled. /// Whicht controller is used determines how to value will be handled.
/// ///
/// label is a standard parameter to normally sets the label of the input. /// label is a standard parameter to normally sets the label of the input.
abstract class ShellFormInputWidget extends ConsumerWidget { abstract class FlutterFormInputWidget extends ConsumerWidget {
const ShellFormInputWidget({ const FlutterFormInputWidget({
Key? key, Key? key,
required this.controller, required this.controller,
this.label, this.label,
String? hintText, String? hintText,
}) : super(key: key); }) : super(key: key);
final ShellFormInputController controller; final FlutterFormInputController controller;
final Widget? label; final Widget? label;
registerController(BuildContext context) { registerController(BuildContext context) {
ShellFormInputController? localController = FlutterFormInputController? localController =
fs.FormState.of(context).formController.getController(controller.id!); fs.FormState.of(context).formController.getController(controller.id!);
if (localController == null) { if (localController == null) {
@ -29,9 +29,9 @@ abstract class ShellFormInputWidget extends ConsumerWidget {
} }
} }
/// Abstract class for the controller for inputs used in a [ShellForm]. /// Abstract class for the controller for inputs used in a [FlutterForm].
/// ///
/// The [id] determines the key in the [Map] returned by the [ShellForm]. /// The [id] determines the key in the [Map] returned by the [FlutterForm].
/// ///
/// [value] is a way to set a initial value. /// [value] is a way to set a initial value.
/// ///
@ -49,7 +49,7 @@ abstract class ShellFormInputWidget extends ConsumerWidget {
/// ///
/// [checkPageDescription] is the same as checkPageTitle but for the description. /// [checkPageDescription] is the same as checkPageTitle but for the description.
/// If null no description will be shown. /// If null no description will be shown.
abstract class ShellFormInputController<T> { abstract class FlutterFormInputController<T> {
String? id; String? id;
T? value; T? value;
bool mandatory = false; bool mandatory = false;

View file

@ -10,11 +10,11 @@ import 'carousel_form.dart';
/// ///
/// [items] will be the [Widget]s to be displayed in the carousel. /// [items] will be the [Widget]s to be displayed in the carousel.
/// ///
/// Standard controller is [ShellFormInputCarouselController]. /// Standard controller is [FlutterFormInputCarouselController].
class ShellFormInputCarousel extends ShellFormInputWidget { class FlutterFormInputCarousel extends FlutterFormInputWidget {
const ShellFormInputCarousel({ const FlutterFormInputCarousel({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
required this.items, required this.items,
}) : super(key: key, controller: controller, label: label); }) : super(key: key, controller: controller, label: label);
@ -37,12 +37,12 @@ class ShellFormInputCarousel extends ShellFormInputWidget {
} }
} }
/// Controller for the carousel used by a [ShellFormInputWidget] used in a [FlutterForm]. /// Controller for the carousel used by a [FlutterFormInputWidget] used in a [FlutterForm].
/// ///
/// Mainly used by [ShellFormInputCarousel]. /// Mainly used by [FlutterFormInputCarousel].
class ShellFormInputCarouselController class FlutterFormInputCarouselController
implements ShellFormInputController<int> { implements FlutterFormInputController<int> {
ShellFormInputCarouselController({ FlutterFormInputCarouselController({
required this.id, required this.id,
this.mandatory = true, this.mandatory = true,
this.value, this.value,

View file

@ -6,11 +6,11 @@ import '../../../../flutter_form.dart';
/// Input for an email used in a [FlutterForm]. /// Input for an email used in a [FlutterForm].
/// ///
/// Standard controller is [ShellFormInputEmailController]. /// Standard controller is [FlutterFormInputEmailController].
class ShellFormInputEmail extends ShellFormInputWidget { class FlutterFormInputEmail extends FlutterFormInputWidget {
const ShellFormInputEmail({ const FlutterFormInputEmail({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
}) : super( }) : super(
key: key, key: key,
@ -39,12 +39,12 @@ class ShellFormInputEmail extends ShellFormInputWidget {
} }
} }
/// Controller for emails used by a [ShellFormInputWidget] used in a [FlutterForm]. /// Controller for emails used by a [FlutterFormInputWidget] used in a [FlutterForm].
/// ///
/// Mainly used by [ShellFormInputEmail]. /// Mainly used by [FlutterFormInputEmail].
class ShellFormInputEmailController class FlutterFormInputEmailController
implements ShellFormInputController<String> { implements FlutterFormInputController<String> {
ShellFormInputEmailController({ FlutterFormInputEmailController({
required this.id, required this.id,
this.mandatory = true, this.mandatory = true,
this.value, this.value,

View file

@ -5,10 +5,10 @@ import 'package:flutter_form/next_shell/translation_service.dart';
import 'numberpicker.dart'; import 'numberpicker.dart';
class ShellFormInputNumberPicker extends ShellFormInputWidget { class FlutterFormInputNumberPicker extends FlutterFormInputWidget {
const ShellFormInputNumberPicker({ const FlutterFormInputNumberPicker({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
this.minValue = 0, this.minValue = 0,
this.maxValue = 100, this.maxValue = 100,
@ -65,9 +65,9 @@ class NumberPickerFormField extends FormField<int> {
}); });
} }
class ShellFormInputNumberPickerController class FlutterFormInputNumberPickerController
implements ShellFormInputController<int> { implements FlutterFormInputController<int> {
ShellFormInputNumberPickerController({ FlutterFormInputNumberPickerController({
required this.id, required this.id,
this.mandatory = true, this.mandatory = true,
this.value, this.value,

View file

@ -5,11 +5,11 @@ import '../../../../../flutter_form.dart';
/// Input for a password used in a [FlutterForm]. /// Input for a password used in a [FlutterForm].
/// ///
/// Standard controller is [ShellFormInputEmailController]. /// Standard controller is [FlutterFormInputEmailController].
class ShellFormInputPassword extends ShellFormInputWidget { class FlutterFormInputPassword extends FlutterFormInputWidget {
const ShellFormInputPassword({ const FlutterFormInputPassword({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
}) : super(key: key, controller: controller, label: label); }) : super(key: key, controller: controller, label: label);
@ -24,12 +24,12 @@ class ShellFormInputPassword extends ShellFormInputWidget {
} }
} }
/// Controller for passwords used by a [ShellFormInputWidget] used in a [ShellFrom]. /// Controller for passwords used by a [FlutterFormInputWidget] used in a [ShellFrom].
/// ///
/// Mainly used by [ShellFormInputPassword]. /// Mainly used by [FlutterFormInputPassword].
class ShellFormInputPasswordController class FlutterFormInputPasswordController
implements ShellFormInputController<String> { implements FlutterFormInputController<String> {
ShellFormInputPasswordController({ FlutterFormInputPasswordController({
required this.id, required this.id,
this.mandatory = true, this.mandatory = true,
this.value, this.value,

View file

@ -3,11 +3,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../../../flutter_form.dart'; import '../../../../../flutter_form.dart';
import 'package:flutter_form/next_shell/translation_service.dart'; import 'package:flutter_form/next_shell/translation_service.dart';
/// Generates a [TextFormField] for passwords. It requires a [ShellFormInputController] /// Generates a [TextFormField] for passwords. It requires a [FlutterFormInputController]
/// as the [controller] parameter and an optional [Widget] as [label] /// as the [controller] parameter and an optional [Widget] as [label]
class PasswordTextField extends ConsumerStatefulWidget { class PasswordTextField extends ConsumerStatefulWidget {
final Widget? label; final Widget? label;
final ShellFormInputController controller; final FlutterFormInputController controller;
const PasswordTextField({ const PasswordTextField({
Key? key, Key? key,

View file

@ -6,11 +6,11 @@ import 'package:flutter_form/next_shell/translation_service.dart';
/// Input for plain text input used in a [FlutterForm]. /// Input for plain text input used in a [FlutterForm].
/// ///
/// Standard controller is [ShellFormInputPlainTextController]. /// Standard controller is [FlutterFormInputPlainTextController].
class ShellFormInputPlainText extends ShellFormInputWidget { class FlutterFormInputPlainText extends FlutterFormInputWidget {
const ShellFormInputPlainText({ const FlutterFormInputPlainText({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
}) : super(key: key, controller: controller, label: label); }) : super(key: key, controller: controller, label: label);
@ -34,11 +34,11 @@ class ShellFormInputPlainText extends ShellFormInputWidget {
/// Input for an plain text with extra styling used in a [FlutterForm]. /// Input for an plain text with extra styling used in a [FlutterForm].
/// ///
/// Standard controller is [ShellFormInputPlainTextController]. /// Standard controller is [FlutterFormInputPlainTextController].
class ShellFormInputPlainTextWhiteWithBorder extends ShellFormInputWidget { class FlutterFormInputPlainTextWhiteWithBorder extends FlutterFormInputWidget {
const ShellFormInputPlainTextWhiteWithBorder({ const FlutterFormInputPlainTextWhiteWithBorder({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
this.hint, this.hint,
}) : super(key: key, controller: controller, label: label); }) : super(key: key, controller: controller, label: label);
@ -73,12 +73,12 @@ class ShellFormInputPlainTextWhiteWithBorder extends ShellFormInputWidget {
} }
} }
/// Controller for plain text used by a [ShellFormInputWidget] used in a [FlutterForm]. /// Controller for plain text used by a [FlutterFormInputWidget] used in a [FlutterForm].
/// ///
/// Mainly used by [ShellFormInputPlainText]. /// Mainly used by [FlutterFormInputPlainText].
class ShellFormInputPlainTextController class FlutterFormInputPlainTextController
implements ShellFormInputController<String> { implements FlutterFormInputController<String> {
ShellFormInputPlainTextController({ FlutterFormInputPlainTextController({
required this.id, required this.id,
this.mandatory = false, this.mandatory = false,
this.value, this.value,

View file

@ -7,11 +7,11 @@ import '../../../../../flutter_form.dart';
/// Input for a number value between two values via a slider. Used in a [FlutterForm]. /// Input for a number value between two values via a slider. Used in a [FlutterForm].
/// ///
/// Standard controller is [ShellFormInputSliderController]. /// Standard controller is [FlutterFormInputSliderController].
class ShellFormInputSlider extends ShellFormInputWidget { class FlutterFormInputSlider extends FlutterFormInputWidget {
const ShellFormInputSlider({ const FlutterFormInputSlider({
Key? key, Key? key,
required ShellFormInputController controller, required FlutterFormInputController controller,
Widget? label, Widget? label,
this.minValue = 0, this.minValue = 0,
this.maxValue = 100, this.maxValue = 100,
@ -35,12 +35,12 @@ class ShellFormInputSlider extends ShellFormInputWidget {
} }
} }
/// Controller for slider used by a [ShellFormInputWidget] used in a [FlutterForm]. /// Controller for slider used by a [FlutterFormInputWidget] used in a [FlutterForm].
/// ///
/// Mainly used by [ShellFormInputSlider]. /// Mainly used by [FlutterFormInputSlider].
class ShellFormInputSliderController class FlutterFormInputSliderController
implements ShellFormInputController<double> { implements FlutterFormInputController<double> {
ShellFormInputSliderController({ FlutterFormInputSliderController({
required this.id, required this.id,
this.mandatory = true, this.mandatory = true,
this.value, this.value,