mirror of
https://github.com/Iconica-Development/flutter_input_library.git
synced 2025-05-19 01:13:45 +02:00
Merge pull request #21 from Iconica-Development/develop/enabled
Develop/enabled
This commit is contained in:
commit
8e4eb901a6
5 changed files with 47 additions and 28 deletions
|
@ -34,3 +34,6 @@
|
|||
|
||||
## 2.2.1
|
||||
* Initial time optional on input from the user, defaulting to current time
|
||||
|
||||
## 2.3.0
|
||||
* The ability to set the enabled parameter of TextFormFields
|
|
@ -29,6 +29,7 @@ class DateTimeInputField extends StatefulWidget {
|
|||
this.validator,
|
||||
required this.timePickerEntryMode,
|
||||
required this.style,
|
||||
this.enabled = true,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
@ -50,6 +51,7 @@ class DateTimeInputField extends StatefulWidget {
|
|||
final void Function(String?)? onSaved;
|
||||
final void Function(String?)? onChanged;
|
||||
final TimePickerEntryMode timePickerEntryMode;
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
State<DateTimeInputField> createState() => _DateInputFieldState();
|
||||
|
@ -128,6 +130,7 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
});
|
||||
break;
|
||||
case FlutterFormDateTimeType.range:
|
||||
if (context.mounted) {
|
||||
userInput = (await showDateRangePicker(
|
||||
context: context,
|
||||
firstDate: firstDate,
|
||||
|
@ -139,8 +142,10 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
: '';
|
||||
}))
|
||||
.toString();
|
||||
}
|
||||
break;
|
||||
case FlutterFormDateTimeType.time:
|
||||
if (context.mounted) {
|
||||
userInput = await showTimePicker(
|
||||
initialEntryMode: widget.timePickerEntryMode,
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
|
@ -157,6 +162,7 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
: MaterialLocalizations.of(context)
|
||||
.formatTimeOfDay(value, alwaysUse24HourFormat: true));
|
||||
}
|
||||
}
|
||||
return userInput;
|
||||
}
|
||||
|
||||
|
@ -185,6 +191,7 @@ class _DateInputFieldState extends State<DateTimeInputField> {
|
|||
focusColor: Theme.of(context).primaryColor,
|
||||
label: widget.label ?? const Text("Date"),
|
||||
),
|
||||
enabled: widget.enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ class FlutterFormInputPassword extends StatefulWidget {
|
|||
final String? Function(String?)? validator;
|
||||
final Function(String?)? onChanged;
|
||||
final Function(String?)? onFieldSubmitted;
|
||||
final bool enabled;
|
||||
|
||||
const FlutterFormInputPassword({
|
||||
Key? key,
|
||||
|
@ -24,6 +25,7 @@ class FlutterFormInputPassword extends StatefulWidget {
|
|||
this.validator,
|
||||
this.onChanged,
|
||||
this.onFieldSubmitted,
|
||||
this.enabled = true,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -54,6 +56,7 @@ class _PasswordTextFieldState extends State<FlutterFormInputPassword> {
|
|||
icon: Icon(obscured ? Icons.visibility_off : Icons.visibility),
|
||||
),
|
||||
),
|
||||
enabled: widget.enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
|||
this.validator,
|
||||
this.onFieldSubmitted,
|
||||
this.style,
|
||||
this.enabled = true,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
@ -41,6 +42,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
|||
final Function(String?)? onChanged;
|
||||
final Function(String?)? onFieldSubmitted;
|
||||
final TextStyle? style;
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -64,6 +66,7 @@ class FlutterFormInputPlainText extends StatelessWidget {
|
|||
maxLines: maxLines,
|
||||
maxLength: maxLength,
|
||||
keyboardType: keyboardType,
|
||||
enabled: enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +78,7 @@ class FlutterFormInputMultiLine extends StatelessWidget {
|
|||
this.focusNode,
|
||||
this.hint,
|
||||
this.maxCharacters,
|
||||
this.enabled = true,
|
||||
this.scrollPadding,
|
||||
this.keyboardType,
|
||||
this.initialValue,
|
||||
|
@ -89,6 +93,7 @@ class FlutterFormInputMultiLine extends StatelessWidget {
|
|||
final FocusNode? focusNode;
|
||||
final String? hint;
|
||||
final int? maxCharacters;
|
||||
final bool enabled;
|
||||
|
||||
final InputDecoration? decoration;
|
||||
final EdgeInsets? scrollPadding;
|
||||
|
@ -131,6 +136,7 @@ class FlutterFormInputMultiLine extends StatelessWidget {
|
|||
),
|
||||
filled: true,
|
||||
),
|
||||
enabled: enabled,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_input_library
|
||||
description: A new Flutter package project.
|
||||
version: 2.2.1
|
||||
version: 2.3.0
|
||||
repository: https://github.com/Iconica-Development/flutter_input_library
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue