mirror of
https://github.com/Iconica-Development/flutter_input_library.git
synced 2025-05-18 17:03:45 +02:00
add style to date picker
This commit is contained in:
parent
2832867b63
commit
7529009469
5 changed files with 13 additions and 12 deletions
|
@ -16,3 +16,6 @@
|
|||
|
||||
## 1.0.4
|
||||
* fix datetimepicker format and validator
|
||||
|
||||
## 1.0.5
|
||||
* add style to datetime
|
||||
|
|
|
@ -61,18 +61,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
Container(height: 50),
|
||||
const Text('FlutterFormInputDateTime'),
|
||||
FlutterFormInputDateTime(
|
||||
style: const TextStyle(color: Colors.red),
|
||||
decoration: const InputDecoration(label: Text('test')),
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
validator: (p0) {
|
||||
if (p0 == null || p0.isEmpty) return null;
|
||||
return DateFormat('dd/MMMM/yyyy HH:mm')
|
||||
.parse(p0)
|
||||
.isAfter(DateTime.now())
|
||||
? null
|
||||
: 'Date must be in the future';
|
||||
},
|
||||
inputType: FlutterFormDateTimeType.dateTime,
|
||||
dateFormat: DateFormat('dd/MMMM/yyyy HH:mm'),
|
||||
inputType: FlutterFormDateTimeType.time,
|
||||
dateFormat: DateFormat('HH:mm'),
|
||||
onChanged: (v) {
|
||||
debugPrint('Date changed to $v');
|
||||
},
|
||||
|
|
|
@ -17,6 +17,7 @@ enum FlutterFormDateTimeType {
|
|||
class FlutterFormInputDateTime extends ConsumerWidget {
|
||||
const FlutterFormInputDateTime(
|
||||
{this.decoration,
|
||||
this.style,
|
||||
Key? key,
|
||||
this.label,
|
||||
this.showIcon = true,
|
||||
|
@ -35,6 +36,7 @@ class FlutterFormInputDateTime extends ConsumerWidget {
|
|||
: super(
|
||||
key: key,
|
||||
);
|
||||
final TextStyle? style;
|
||||
final InputDecoration? decoration;
|
||||
final Widget? label;
|
||||
final bool showIcon;
|
||||
|
@ -54,6 +56,7 @@ class FlutterFormInputDateTime extends ConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return DateTimeInputField(
|
||||
style: style,
|
||||
decoration: decoration,
|
||||
autovalidateMode: autovalidateMode,
|
||||
validator: validator,
|
||||
|
|
|
@ -27,9 +27,11 @@ class DateTimeInputField extends ConsumerStatefulWidget {
|
|||
this.onChanged,
|
||||
this.onSaved,
|
||||
this.validator,
|
||||
required this.style,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
final TextStyle? style;
|
||||
final InputDecoration? decoration;
|
||||
final AutovalidateMode autovalidateMode;
|
||||
final FlutterFormDateTimeType inputType;
|
||||
|
@ -149,6 +151,7 @@ class _DateInputFieldState extends ConsumerState<DateTimeInputField> {
|
|||
}
|
||||
|
||||
return TextFormField(
|
||||
style: widget.style,
|
||||
autovalidateMode: widget.autovalidateMode,
|
||||
keyboardType: TextInputType.none,
|
||||
readOnly: true,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_input_library
|
||||
description: A new Flutter package project.
|
||||
version: 1.0.4
|
||||
version: 1.0.5
|
||||
repository: https://github.com/Iconica-Development/flutter_input_library
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue