Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions lib/src/web_date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Future<DateTimeRange?> showWebDatePicker({
bool autoCloseOnDateSelect = false,
bool showDisabledCursor = false,
void Function()? onReset,
String? todayButtonText,
}) {
if (asDialog) {
final renderBox = context.findRenderObject()! as RenderBox;
Expand Down Expand Up @@ -69,6 +70,7 @@ Future<DateTimeRange?> showWebDatePicker({
showCancelButton: showCancelButton,
showDisabledCursor: showDisabledCursor,
onReset: onReset,
todayButtonText: todayButtonText,
),
),
),
Expand Down Expand Up @@ -99,6 +101,7 @@ Future<DateTimeRange?> showWebDatePicker({
showCancelButton: showCancelButton,
showDisabledCursor: showDisabledCursor,
onReset: onReset,
todayButtonText: todayButtonText,
),
asDropDown: true,
useTargetWidth: width != null ? false : true,
Expand Down Expand Up @@ -130,6 +133,7 @@ class _WebDatePicker extends StatefulWidget {
this.autoCloseOnDateSelect = false,
this.showDisabledCursor = false,
this.onReset,
this.todayButtonText,
});

final List<DateTime> blockedDates;
Expand All @@ -153,6 +157,7 @@ class _WebDatePicker extends StatefulWidget {
final bool autoCloseOnDateSelect;
final bool showDisabledCursor;
final void Function()? onReset;
final String? todayButtonText;

@override
State<_WebDatePicker> createState() => _WebDatePickerState();
Expand Down Expand Up @@ -719,11 +724,23 @@ class _WebDatePickerState extends State<_WebDatePicker> {

/// Today
if (widget.showTodayButton)
_iconWidget(
Icons.today,
tooltip: localizations.currentDateLabel,
onTap: _onStartDateChanged,
),
if (widget.todayButtonText != null)
TextButton(
onPressed: () => _onStartDateChanged(),
child: Text(
widget.todayButtonText!,
style: TextStyle(
color: widget.confirmButtonColor ?? theme.colorScheme.primary,
),
),
)
else
_iconWidget(
Icons.today,
tooltip: localizations.currentDateLabel,
onTap: _onStartDateChanged,
),

const Spacer(),

/// CANCEL
Expand Down