In the Flutter date range picker, you can programmatically navigate to the picker view using view property of the DateRangePickerController. Inside the state, initialize the controller for the date picker. final DateRangePickerController _controller = DateRangePickerController(); @override void initState() { _controller.view=DateRangePickerView.year; super.initState(); } Use the view property the date range picker controller inside the ElevatedButton pressed callback. Container( margin: const EdgeInsets.fromLTRB(50, 130, 50, 0), child: ElevatedButton(child: Text('Change view'),onPressed: (){ _controller.view=DateRangePickerView.month; },), ), Assign controller to the controller property of the date picker. child: SfDateRangePicker( controller: _controller ),
|
This page will automatically be redirected to the sign-in page in 10 seconds.