view property
DateRangePickerView?
get
view
The current visible DateRangePickerView of SfDateRangePicker.
Implementation
DateRangePickerView? get view => _view;
set
view
(DateRangePickerView? value)
Set the SfDateRangePickerView
for the SfDateRangePicker.
The SfDateRangePicker will display the view sets to this property.
See also:
- SfDateRangePicker.view, which used to display the required view on the date range picker initially.
- SfDateRangePicker.onViewChanged, the callback which notifies when the current view visible date changed on the date range picker.
- DateRangePickerView, to know more about the available view options in date range picker.
- Knowledge base: How to do programmatic navigation
- Knowledge base: How to programmatically navigate to adjacent dates
- Knowledge base: How to programmatically navigate
class MyAppState extends State<MyApp> {
DateRangePickerController _pickerController = DateRangePickerController();
@override
void initState() {
_pickerController.view = DateRangePickerView.year;
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SfDateRangePicker(
controller: _pickerController,
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.single,
),
),
);
}
}
Implementation
set view(DateRangePickerView? value) {
if (_view == value) {
return;
}
_view = value;
notifyPropertyChangedListeners('view');
}