Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit b21f26a

Browse files
TedSandernshahan
authored andcommitted
Migrate datepicker to use final for messages.
PiperOrigin-RevId: 199236008
1 parent b2cebcf commit b21f26a

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

lib/material_datepicker/date_input.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class DateInputDirective implements OnDestroy {
358358
return thisYear;
359359
}
360360

361-
String get invalidDateMsg => Intl.message('Enter a date',
361+
static final invalidDateMsg = Intl.message('Enter a date',
362362
name: 'invalidDateMsg',
363363
meaning: 'Error message',
364364
desc: 'Displayed when the user types text into a date input field which '

lib/material_datepicker/date_range_editor.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class DateRangeEditorComponent implements OnInit, AfterViewInit, Focusable {
109109

110110
bool _supportsComparison = true;
111111

112-
String get comparisonHeaderMsg => Intl.message('Compare',
112+
static final comparisonHeaderMsg = Intl.message('Compare',
113113
name: 'comparisonHeaderMsg',
114114
desc: 'Label for a toggle that turns time comparison on/off.');
115115

@@ -503,43 +503,43 @@ class DateRangeEditorComponent implements OnInit, AfterViewInit, Focusable {
503503

504504
String get customRangeDescription => formatRange(model.range.value);
505505

506-
String get navigateBeforeMsg => Intl.message('Previous date range',
506+
static final navigateBeforeMsg = Intl.message('Previous date range',
507507
name: 'navigateBeforeMsg',
508508
meaning: 'Update the calendar display to show the previous time period.',
509509
desc: 'Label for control button which changes the range of dates shown in'
510510
'the calendar to the previous range of dates.');
511511

512-
String get navigateNextMsg => Intl.message('Next date range',
512+
static final navigateNextMsg = Intl.message('Next date range',
513513
name: 'navigateNextMsg',
514514
meaning: 'Update the calendar display to show the next time period',
515515
desc: 'Label for control button which changes the range of dates shown in'
516516
'the calendar to the next range of dates.');
517517

518-
String get clearRangeMsg => Intl.message('Clear date range',
518+
static final clearRangeMsg = Intl.message('Clear date range',
519519
name: 'DateRangeEditorComponent_clearRangeMsg',
520520
meaning: 'Clear the current range.',
521521
desc: 'Label for an option in the preset list at the left which '
522522
'clears the current selection.');
523523

524-
String get customRangeMsg => Intl.message('Custom',
524+
static final customRangeMsg = Intl.message('Custom',
525525
name: 'DateRangeEditorComponent_customRangeMsg',
526526
meaning: 'Replace the current range with a Custom range that has the '
527527
'same endpoints.',
528528
desc: 'Label for an option in the preset list at the left which '
529529
'replaces the current selection with a "Custom" range.');
530530

531531
// TODO(google): Check if some locales require text before the input.
532-
String get daysToTodayMsg => Intl.message('days up to today',
532+
static final daysToTodayMsg = Intl.message('days up to today',
533533
name: 'daysToTodayMsg',
534534
desc: 'Label for number input which changes the range of dates shown in'
535535
' the calendar to [today - number, today].');
536536

537-
String get daysToYesterdayMsg => Intl.message('days up to yesterday',
537+
static final daysToYesterdayMsg = Intl.message('days up to yesterday',
538538
name: 'daysToYesterdayMsg',
539539
desc: 'Label for number input which changes the range of dates shown in'
540540
' the calendar to [yesterday - number, yesterday].');
541541

542-
String get rangeDisabledTooltip => Intl.message('No days available',
542+
static final rangeDisabledTooltip = Intl.message('No days available',
543543
name: 'DateRangeEditorComponent_rangeDisabledTooltip',
544544
desc: 'Message that explains why a date range is invalid.');
545545
}

lib/material_datepicker/date_range_input.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ class DateRangeInputComponent implements OnInit, OnDestroy {
198198
@Input()
199199
Date minDate = new Date(1000, DateTime.JANUARY, 1);
200200

201-
String get startDateMsg => Intl.message('Start date',
201+
final startDateMsg = Intl.message('Start date',
202202
name: 'DateRangeInputComponent_startDateMsg',
203203
desc: 'ARIA label for the input specifying the start of the date range');
204204

205-
String get endDateMsg => Intl.message('End date',
205+
final endDateMsg = Intl.message('End date',
206206
name: 'DateRangeInputComponent_endDateMsg',
207207
desc: 'ARIA label for the input specifying the end of the date range');
208208
}

lib/material_datepicker/material_date_range_picker.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,14 @@ class MaterialDateRangePickerComponent extends KeyboardHandlerMixin
550550
}
551551
}
552552

553-
String get cancelButtonMsg => Intl.message('Cancel',
553+
static final cancelButtonMsg = Intl.message('Cancel',
554554
meaning: 'Button in a date picker',
555555
desc: 'Label for a "cancel" button -- abandon the current date selection '
556556
'and go back to whatever it was before the user opened the date picker');
557557

558558
String get applyButtonMsg => applyButtonLabel ?? _applyButtonMsg;
559559

560-
String get _applyButtonMsg => Intl.message('Apply',
560+
static final _applyButtonMsg = Intl.message('Apply',
561561
name: '_applyButtonMsg',
562562
meaning: 'Button in a date picker',
563563
desc: 'Label for an "Apply" button -- accept and apply the date range '
@@ -569,7 +569,7 @@ class MaterialDateRangePickerComponent extends KeyboardHandlerMixin
569569
args: [to],
570570
examples: const {'to': 'Jul 21, 2014 - Aug 3, 2015'});
571571

572-
String get _placeHolderMsg => Intl.message('Select a date range',
572+
static final _placeHolderMsg = Intl.message('Select a date range',
573573
name: '_placeHolderMsg',
574574
desc: 'Placeholder text for a date range picker with an empty range.');
575575
}

lib/material_datepicker/material_datepicker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class MaterialDatepickerComponent extends KeyboardHandlerMixin
215215
desc: 'Placeholder text for an empty date picker text box.');
216216

217217
/// Gets the i18n'ed "Custom" label text.
218-
String get customDateMsg => Intl.message('Custom',
218+
static final customDateMsg = Intl.message('Custom',
219219
name: 'customDateMsg',
220220
desc: 'Indicates that a single custom date is selected');
221221

lib/material_datepicker/material_time_picker.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ class MaterialTimePickerComponent extends KeyboardHandlerMixin
322322
event.stopPropagation();
323323
}
324324

325-
String get dropdownPlaceholderMsg => Intl.message('Select time',
325+
static final dropdownPlaceholderMsg = Intl.message('Select time',
326326
name: 'MaterialTimePickerComponent_dropdownPlaceholderMsg',
327327
desc: 'Placeholder text for an empty time picker dropdown button.');
328328

329-
String get inputPlaceholderMsg => Intl.message('Enter time',
329+
static final inputPlaceholderMsg = Intl.message('Enter time',
330330
name: 'MaterialTimePickerComponent_inputPlaceholderMsg',
331331
desc: 'Placeholder text for an empty time picker input box.');
332332

lib/material_datepicker/next_prev_buttons.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ class NextPrevComponent implements OnDestroy {
110110
/// Whether the next button is disabled.
111111
bool get isNextDisabled => disabled || !hasNext;
112112

113-
static String get _genericNextMsg => Intl.message('Next',
113+
static final _genericNextMsg = Intl.message('Next',
114114
name: '_genericNextMsg',
115115
meaning: 'For a button which moves to the next item',
116116
desc: 'Label for a button to move to the next item of some series.');
117117

118-
static String get _genericPrevMsg => Intl.message('Previous',
118+
static final _genericPrevMsg = Intl.message('Previous',
119119
name: '_genericPrevMsg',
120120
meaning: 'For a button which moves to the previous item',
121121
desc: 'Label for a button to move to the previous item of some series.');

lib/material_datepicker/range.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ List<DatepickerDateRange> commonRanges(Clock clock) => [
900900
allTime,
901901
];
902902

903-
String get _customDateRangeMsg => Intl.message('Custom',
903+
final _customDateRangeMsg = Intl.message('Custom',
904904
name: '_customDateRangeMsg',
905905
meaning: 'Name of a date range',
906906
desc: 'Name of a user-specified date range, as opposed to a predefined '

lib/src/material_datepicker/comparison_range_editor.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ComparisonRangeEditorComponent {
4848
ComparisonOption.custom
4949
];
5050

51-
String get comparisonHeaderMsg => Intl.message('Compare',
51+
static final comparisonHeaderMsg = Intl.message('Compare',
5252
name: 'comparisonHeaderMsg',
5353
desc: 'Label for a toggle that turns time comparison on/off.');
5454

@@ -59,20 +59,20 @@ class ComparisonRangeEditorComponent {
5959
return prev?.isPredefined == true ? prev.title : _previousPeriodMsg;
6060
}
6161

62-
String get _previousPeriodMsg => Intl.message('Previous period',
62+
static final _previousPeriodMsg = Intl.message('Previous period',
6363
name: '_previousPeriodMsg',
6464
meaning: 'Name for a time comparison option',
6565
desc: 'Setting to compare the selected date range with the previous '
6666
'period. E.g. if the selected range were May, this would be April.');
6767

68-
String get samePeriodLastYearMsg => Intl.message('Previous year',
68+
static final samePeriodLastYearMsg = Intl.message('Previous year',
6969
name: 'samePeriodLastYearMsg',
7070
meaning: 'Name for a time comparison option',
7171
desc: 'Setting to compare the selected date range with the same range '
7272
'last year. E.g. if the selected range were May 2015, this would be '
7373
'May 2014.');
7474

75-
String get customMsg => Intl.message('Custom',
75+
static final customMsg = Intl.message('Custom',
7676
name: 'customMsg',
7777
meaning: 'Name for a time comparison option',
7878
desc: 'Setting to compare the selected date range with another arbitrary '

0 commit comments

Comments
 (0)