Merge pull request #20 from Iconica-Development/feature/add_focus_nodes

Add FocusNode option to inputs
This commit is contained in:
Thomas Klein Langenhorst 2023-01-12 14:41:57 +01:00 committed by GitHub
commit f87c080d90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 10 deletions

View file

@ -47,3 +47,7 @@
## 5.0.0 - November 29th 2022
- `flutter_input_library` now enforces 24h time requirements
## 5.0.3 - January 12th 2023
- Add FocusNode option to inputs

View file

@ -61,16 +61,16 @@ packages:
path: ".."
relative: true
source: path
version: "5.0.1"
version: "5.0.2"
flutter_input_library:
dependency: transitive
description:
path: "."
ref: "1.0.1"
resolved-ref: "5afec9410503358c354d9324666a4eb11acbedb2"
ref: "1.0.2"
resolved-ref: ab6d840c0d326b1b1d5f738b2c7360a841d01015
url: "https://github.com/Iconica-Development/flutter_input_library"
source: git
version: "1.0.0"
version: "1.0.2"
flutter_lints:
dependency: "direct dev"
description:

View file

@ -18,6 +18,7 @@ abstract class FlutterFormInputWidget<T> extends ConsumerWidget {
const FlutterFormInputWidget({
Key? key,
required this.controller,
this.focusNode,
this.label,
String? hintText,
}) : super(key: key);
@ -28,6 +29,8 @@ abstract class FlutterFormInputWidget<T> extends ConsumerWidget {
/// [label] is a standard parameter to normally sets the label of the input.
final Widget? label;
final FocusNode? focusNode;
/// [registerController] should be called to register the given [controller] to the form page.
registerController(BuildContext context) {
FlutterFormInputController? localController =

View file

@ -16,10 +16,12 @@ class FlutterFormInputEmail extends FlutterFormInputWidget<String> {
const FlutterFormInputEmail({
Key? key,
required FlutterFormInputController<String> controller,
FocusNode? focusNode,
Widget? label,
}) : super(
key: key,
controller: controller,
focusNode: focusNode,
label: label,
);
@ -35,6 +37,7 @@ class FlutterFormInputEmail extends FlutterFormInputWidget<String> {
onSaved: (value) {
controller.onSaved(value);
},
focusNode: focusNode,
validator: (value) => controller.onValidate(value, _),
onChanged: (value) => controller.onChanged?.call(value),
decoration: InputDecoration(

View file

@ -19,6 +19,7 @@ class FlutterFormInputNumberPicker extends FlutterFormInputWidget<int> {
Key? key,
required FlutterFormInputController<int> controller,
Widget? label,
FocusNode? focusNode,
this.minValue = 0,
this.maxValue = 100,
}) : assert(minValue < maxValue),

View file

@ -15,8 +15,13 @@ class FlutterFormInputPassword extends FlutterFormInputWidget<String> {
const FlutterFormInputPassword({
Key? key,
required FlutterFormInputController<String> controller,
FocusNode? focusNode,
Widget? label,
}) : super(key: key, controller: controller, label: label);
}) : super(
key: key,
controller: controller,
focusNode: focusNode,
label: label);
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -27,6 +32,7 @@ class FlutterFormInputPassword extends FlutterFormInputWidget<String> {
return input.FlutterFormInputPassword(
initialValue: controller.value,
focusNode: focusNode,
onSaved: (value) => controller.onSaved(value),
validator: (value) => controller.onValidate(value, _),
onChanged: (value) => controller.onChanged?.call(value),

View file

@ -16,6 +16,7 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
const FlutterFormInputPlainText({
Key? key,
required FlutterFormInputController<String> controller,
FocusNode? focusNode,
Widget? label,
this.decoration,
this.textAlignVertical,
@ -24,7 +25,11 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
this.scrollPadding,
this.maxLength,
this.keyboardType,
}) : super(key: key, controller: controller, label: label);
}) : super(
key: key,
controller: controller,
focusNode: focusNode,
label: label);
final InputDecoration? decoration;
final TextAlignVertical? textAlignVertical;
@ -49,6 +54,7 @@ class FlutterFormInputPlainText extends FlutterFormInputWidget<String> {
return input.FlutterFormInputPlainText(
scrollPadding: scrollPadding ?? const EdgeInsets.all(20.0),
initialValue: controller.value,
focusNode: focusNode,
onSaved: (value) => controller.onSaved(value),
validator: (value) => controller.onValidate(value, _),
onChanged: (value) => controller.onChanged?.call(value),

View file

@ -16,11 +16,16 @@ class FlutterFormInputSlider extends FlutterFormInputWidget<double> {
const FlutterFormInputSlider({
Key? key,
required FlutterFormInputController<double> controller,
FocusNode? focusNode,
Widget? label,
this.minValue = 0,
this.maxValue = 100,
}) : assert(minValue < maxValue),
super(key: key, controller: controller, label: label);
super(
key: key,
controller: controller,
focusNode: focusNode,
label: label);
final int minValue;
final int maxValue;
@ -33,6 +38,7 @@ class FlutterFormInputSlider extends FlutterFormInputWidget<double> {
super.registerController(context);
return input.FlutterFormInputSlider(
focusNode: focusNode,
onSaved: (value) => controller.onSaved(value),
validator: (value) => controller.onValidate(value, _),
);

View file

@ -15,8 +15,13 @@ class FlutterFormInputSwitch extends FlutterFormInputWidget<bool> {
const FlutterFormInputSwitch({
Key? key,
required FlutterFormInputController<bool> controller,
FocusNode? focusNode,
Widget? label,
}) : super(key: key, controller: controller, label: label);
}) : super(
key: key,
controller: controller,
focusNode: focusNode,
label: label);
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -26,6 +31,7 @@ class FlutterFormInputSwitch extends FlutterFormInputWidget<bool> {
super.registerController(context);
return input.FlutterFormInputSwitch(
focusNode: focusNode,
onSaved: (value) => controller.onSaved(value),
onChanged: controller.onChanged,
validator: (value) => controller.onValidate(value, _),

View file

@ -1,6 +1,6 @@
name: flutter_form_wizard
description: A new Flutter package project.
version: 5.0.2
version: 5.0.3
homepage: https://github.com/Iconica-Development/flutter_form_wizard
publish_to: none