mirror of
https://github.com/Iconica-Development/flutter_input_library.git
synced 2025-05-19 09:23:43 +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
|
## 1.0.4
|
||||||
* fix datetimepicker format and validator
|
* fix datetimepicker format and validator
|
||||||
|
|
||||||
|
## 1.0.5
|
||||||
|
* add style to datetime
|
||||||
|
|
|
@ -61,18 +61,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
Container(height: 50),
|
Container(height: 50),
|
||||||
const Text('FlutterFormInputDateTime'),
|
const Text('FlutterFormInputDateTime'),
|
||||||
FlutterFormInputDateTime(
|
FlutterFormInputDateTime(
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
decoration: const InputDecoration(label: Text('test')),
|
decoration: const InputDecoration(label: Text('test')),
|
||||||
autovalidateMode: AutovalidateMode.always,
|
inputType: FlutterFormDateTimeType.time,
|
||||||
validator: (p0) {
|
dateFormat: DateFormat('HH:mm'),
|
||||||
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'),
|
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
debugPrint('Date changed to $v');
|
debugPrint('Date changed to $v');
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,6 +17,7 @@ enum FlutterFormDateTimeType {
|
||||||
class FlutterFormInputDateTime extends ConsumerWidget {
|
class FlutterFormInputDateTime extends ConsumerWidget {
|
||||||
const FlutterFormInputDateTime(
|
const FlutterFormInputDateTime(
|
||||||
{this.decoration,
|
{this.decoration,
|
||||||
|
this.style,
|
||||||
Key? key,
|
Key? key,
|
||||||
this.label,
|
this.label,
|
||||||
this.showIcon = true,
|
this.showIcon = true,
|
||||||
|
@ -35,6 +36,7 @@ class FlutterFormInputDateTime extends ConsumerWidget {
|
||||||
: super(
|
: super(
|
||||||
key: key,
|
key: key,
|
||||||
);
|
);
|
||||||
|
final TextStyle? style;
|
||||||
final InputDecoration? decoration;
|
final InputDecoration? decoration;
|
||||||
final Widget? label;
|
final Widget? label;
|
||||||
final bool showIcon;
|
final bool showIcon;
|
||||||
|
@ -54,6 +56,7 @@ class FlutterFormInputDateTime extends ConsumerWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return DateTimeInputField(
|
return DateTimeInputField(
|
||||||
|
style: style,
|
||||||
decoration: decoration,
|
decoration: decoration,
|
||||||
autovalidateMode: autovalidateMode,
|
autovalidateMode: autovalidateMode,
|
||||||
validator: validator,
|
validator: validator,
|
||||||
|
|
|
@ -27,9 +27,11 @@ class DateTimeInputField extends ConsumerStatefulWidget {
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.onSaved,
|
this.onSaved,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
required this.style,
|
||||||
}) : super(
|
}) : super(
|
||||||
key: key,
|
key: key,
|
||||||
);
|
);
|
||||||
|
final TextStyle? style;
|
||||||
final InputDecoration? decoration;
|
final InputDecoration? decoration;
|
||||||
final AutovalidateMode autovalidateMode;
|
final AutovalidateMode autovalidateMode;
|
||||||
final FlutterFormDateTimeType inputType;
|
final FlutterFormDateTimeType inputType;
|
||||||
|
@ -149,6 +151,7 @@ class _DateInputFieldState extends ConsumerState<DateTimeInputField> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
|
style: widget.style,
|
||||||
autovalidateMode: widget.autovalidateMode,
|
autovalidateMode: widget.autovalidateMode,
|
||||||
keyboardType: TextInputType.none,
|
keyboardType: TextInputType.none,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
|
|
|
@ -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: 1.0.4
|
version: 1.0.5
|
||||||
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