mirror of
https://github.com/Iconica-Development/flutter_form_wizard.git
synced 2025-05-19 19:03:47 +02:00
Added docs to exported abstract classes
This commit is contained in:
parent
9f49961548
commit
eae6cda150
2 changed files with 32 additions and 3 deletions
|
@ -5,9 +5,11 @@ import '/src/utils/formstate.dart' as fs;
|
|||
/// Abstract class for the input widgets used in a [FlutterForm].
|
||||
///
|
||||
/// The controller [FlutterFormInputController] has to be given to the widget.
|
||||
/// Whicht controller is used determines how to value will be handled.
|
||||
/// Which controller is used determines how to value will be handled.
|
||||
///
|
||||
/// label is a standard parameter to normally sets the label of the input.
|
||||
///
|
||||
/// [registerController] should be called to register the given [controller] to the form page.
|
||||
abstract class FlutterFormInputWidget extends ConsumerWidget {
|
||||
const FlutterFormInputWidget({
|
||||
Key? key,
|
||||
|
@ -16,9 +18,13 @@ abstract class FlutterFormInputWidget extends ConsumerWidget {
|
|||
String? hintText,
|
||||
}) : super(key: key);
|
||||
|
||||
/// The [controller] which determines how the value is handled and how the value is shown on the checkpage.
|
||||
final FlutterFormInputController controller;
|
||||
|
||||
/// [label] is a standard parameter to normally sets the label of the input.
|
||||
final Widget? label;
|
||||
|
||||
/// [registerController] should be called to register the given [controller] to the form page.
|
||||
registerController(BuildContext context) {
|
||||
FlutterFormInputController? localController =
|
||||
fs.FormState.of(context).formController.getController(controller.id!);
|
||||
|
@ -33,7 +39,7 @@ abstract class FlutterFormInputWidget extends ConsumerWidget {
|
|||
///
|
||||
/// 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 and will be the value when change by the user.
|
||||
///
|
||||
/// [mandatory] determines if the input is mandatory.
|
||||
///
|
||||
|
@ -49,15 +55,39 @@ abstract class FlutterFormInputWidget extends ConsumerWidget {
|
|||
///
|
||||
/// [checkPageDescription] is the same as checkPageTitle but for the description.
|
||||
/// If null no description will be shown.
|
||||
///
|
||||
/// [onSaved] goes of when the save function is called for the page if [onValidate] return null.
|
||||
///
|
||||
/// [onValidate] is used to validate the given input by the user.
|
||||
abstract class FlutterFormInputController<T> {
|
||||
/// The [id] determines the key in the [Map] returned by the [FlutterForm].
|
||||
String? id;
|
||||
|
||||
/// [value] is a way to set a initial value and will be the value when change by the user.
|
||||
T? value;
|
||||
|
||||
/// [mandatory] determines if the input is mandatory.
|
||||
bool mandatory = false;
|
||||
|
||||
/// [checkPageTitle] is a function where you can transform the value from the input into something representable.
|
||||
/// This value will be given when defining the check page widgets.
|
||||
/// If this function is not set, the value will be used as is.
|
||||
/// Example:
|
||||
/// ``` dart
|
||||
/// checkPageTitle: (dynamic amount) {
|
||||
/// return "$amount persons";
|
||||
/// },
|
||||
/// ```
|
||||
String Function(T value)? checkPageTitle;
|
||||
|
||||
/// [checkPageDescription] is the same as checkPageTitle but for the description.
|
||||
/// If null no description will be shown.
|
||||
String Function(T value)? checkPageDescription;
|
||||
|
||||
/// [onSaved] goes of when the save function is called for the page if [onValidate] return null.
|
||||
void onSaved(T value);
|
||||
|
||||
/// [onValidate] is used to validate the given input by the user.
|
||||
String? onValidate(
|
||||
T value, String Function(String, {List<String>? params}) translator);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export 'input_carousel/input_carousel.dart';
|
||||
export 'input_carousel/input_carousel.dart';
|
||||
export 'input_email.dart';
|
||||
export 'input_number_picker/input_number_picker.dart';
|
||||
export 'input_password/input_password.dart';
|
||||
|
|
Loading…
Reference in a new issue