Skip to content

Commit af56fba

Browse files
committed
reactive_date_time_picker 4.4.0
1 parent f7fb23e commit af56fba

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

packages/reactive_date_time_picker/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [4.4.0]
2+
3+
* valueBuilder method
4+
15
## [4.3.0]
26

37
* mouse cursor

packages/reactive_date_time_picker/example/lib/main.dart

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,34 @@ class MyApp extends StatelessWidget {
7575
),
7676
),
7777
const SizedBox(height: 8),
78-
ReactiveDateTimePicker(
79-
formControlName: 'dateTime',
80-
type: ReactiveDatePickerFieldType.dateTime,
81-
decoration: const InputDecoration(
82-
labelText: 'Date & Time',
83-
border: OutlineInputBorder(),
84-
helperText: '',
85-
suffixIcon: Icon(Icons.calendar_today),
86-
),
78+
Row(
79+
children: [
80+
Expanded(
81+
child: ReactiveDateTimePicker(
82+
formControlName: 'dateTime',
83+
type: ReactiveDatePickerFieldType.dateTime,
84+
decoration: const InputDecoration(
85+
labelText: 'Date & Time',
86+
border: OutlineInputBorder(),
87+
helperText: '',
88+
suffixIcon: Icon(Icons.calendar_today),
89+
),
90+
valueBuilder: (_, value) => Text(
91+
value ?? '',
92+
overflow: TextOverflow.ellipsis,
93+
),
94+
),
95+
),
96+
Expanded(
97+
child: TextField(
98+
decoration: const InputDecoration(
99+
labelText: 'Date & Time',
100+
border: OutlineInputBorder(),
101+
helperText: '',
102+
suffixIcon: Icon(Icons.calendar_today),
103+
)),
104+
),
105+
],
87106
),
88107
const SizedBox(height: 8),
89108
ReactiveDateTimePicker(

packages/reactive_date_time_picker/lib/reactive_date_time_picker.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class ReactiveDateTimePicker
110110
TextAlignVertical? textAlignVertical,
111111
bool expands = false,
112112
MouseCursor cursor = SystemMouseCursors.click,
113+
Widget Function(BuildContext context, String? value)? valueBuilder,
113114
}) : super(
114115
valueAccessor:
115116
valueAccessor ?? _effectiveValueAccessor(type, dateFormat),
@@ -262,8 +263,7 @@ class ReactiveDateTimePicker
262263
)
263264
: null,
264265
),
265-
child: Text(
266-
field.value ?? '',
266+
child: DefaultTextStyle.merge(
267267
style: Theme.of(field.context)
268268
.textTheme
269269
.titleMedium
@@ -273,6 +273,9 @@ class ReactiveDateTimePicker
273273
? Theme.of(field.context).disabledColor
274274
: null,
275275
),
276+
child: valueBuilder?.call(field.context, field.value) ?? Text(
277+
field.value ?? '',
278+
),
276279
),
277280
),
278281
),

packages/reactive_date_time_picker/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: reactive_date_time_picker
22
description: Wrapper around showDatePicker and showTimePicker to work with reactive_forms
3-
version: 4.3.0
3+
version: 4.4.0
44
repository: https://github.com/artflutter/reactive_forms_widgets/tree/master/packages/reactive_date_time_picker
55
issue_tracker: https://github.com/artflutter/reactive_forms_widgets/issues
66

0 commit comments

Comments
 (0)