mirror of
https://github.com/Iconica-Development/flutter_input_library.git
synced 2025-05-18 17:03:45 +02:00
Merge pull request #24 from Iconica-Development/feature/plain-text-field-format-input
feat: add formatInputs parameter to FlutterFormInputPlainText
This commit is contained in:
commit
3cffe40f34
4 changed files with 14 additions and 2 deletions
|
@ -43,4 +43,8 @@
|
||||||
* FlutterFormInputDateTime now also had the enabled parameter to provide to DateTimeInputField
|
* FlutterFormInputDateTime now also had the enabled parameter to provide to DateTimeInputField
|
||||||
|
|
||||||
## 2.5.0
|
## 2.5.0
|
||||||
* Addition of the ScrollPicker input field.
|
* Addition of the ScrollPicker input field.
|
||||||
|
|
||||||
|
## 2.5.1
|
||||||
|
* Addition of `formatInputs` parameter to `FlutterFormInputPlainText` widget.
|
||||||
|
* Addition of `formatInputs` parameter to `FlutterFormInputPassword` widget.
|
|
@ -3,6 +3,7 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
/// Generates a [TextFormField] for passwords. It requires a [FlutterFormInputController]
|
/// 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]
|
||||||
|
@ -10,6 +11,7 @@ class FlutterFormInputPassword extends StatefulWidget {
|
||||||
final Widget? label;
|
final Widget? label;
|
||||||
final FocusNode? focusNode;
|
final FocusNode? focusNode;
|
||||||
final String? initialValue;
|
final String? initialValue;
|
||||||
|
final List<TextInputFormatter>? inputFormatters;
|
||||||
final Function(String?)? onSaved;
|
final Function(String?)? onSaved;
|
||||||
final String? Function(String?)? validator;
|
final String? Function(String?)? validator;
|
||||||
final Function(String?)? onChanged;
|
final Function(String?)? onChanged;
|
||||||
|
@ -21,6 +23,7 @@ class FlutterFormInputPassword extends StatefulWidget {
|
||||||
this.label,
|
this.label,
|
||||||
this.focusNode,
|
this.focusNode,
|
||||||
this.initialValue,
|
this.initialValue,
|
||||||
|
this.inputFormatters,
|
||||||
this.onSaved,
|
this.onSaved,
|
||||||
this.validator,
|
this.validator,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
|
@ -39,6 +42,7 @@ class _PasswordTextFieldState extends State<FlutterFormInputPassword> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
initialValue: widget.initialValue,
|
initialValue: widget.initialValue,
|
||||||
|
inputFormatters: widget.inputFormatters,
|
||||||
obscureText: obscured,
|
obscureText: obscured,
|
||||||
focusNode: widget.focusNode,
|
focusNode: widget.focusNode,
|
||||||
onSaved: (value) => widget.onSaved?.call(value),
|
onSaved: (value) => widget.onSaved?.call(value),
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class FlutterFormInputPlainText extends StatelessWidget {
|
class FlutterFormInputPlainText extends StatelessWidget {
|
||||||
const FlutterFormInputPlainText({
|
const FlutterFormInputPlainText({
|
||||||
|
@ -22,6 +23,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
||||||
this.validator,
|
this.validator,
|
||||||
this.onFieldSubmitted,
|
this.onFieldSubmitted,
|
||||||
this.style,
|
this.style,
|
||||||
|
this.formatInputs,
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
}) : super(
|
}) : super(
|
||||||
key: key,
|
key: key,
|
||||||
|
@ -42,6 +44,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
||||||
final Function(String?)? onChanged;
|
final Function(String?)? onChanged;
|
||||||
final Function(String?)? onFieldSubmitted;
|
final Function(String?)? onFieldSubmitted;
|
||||||
final TextStyle? style;
|
final TextStyle? style;
|
||||||
|
final List<TextInputFormatter>? formatInputs;
|
||||||
final bool enabled;
|
final bool enabled;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -53,6 +56,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
||||||
|
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
style: style,
|
style: style,
|
||||||
|
inputFormatters: formatInputs,
|
||||||
scrollPadding: scrollPadding ?? const EdgeInsets.all(20.0),
|
scrollPadding: scrollPadding ?? const EdgeInsets.all(20.0),
|
||||||
initialValue: initialValue,
|
initialValue: initialValue,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_input_library
|
name: flutter_input_library
|
||||||
description: A new Flutter package project.
|
description: A new Flutter package project.
|
||||||
version: 2.5.0
|
version: 2.5.1
|
||||||
repository: https://github.com/Iconica-Development/flutter_input_library
|
repository: https://github.com/Iconica-Development/flutter_input_library
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue