Skip to content

Commit 26c7582

Browse files
Merge pull request #1295 from syncfusion-content/FLUT-965289-UG-datepicker-hotfix
FLUT-965289 - [Feature] Updated ug pages for Date Range Picker widget in hotfix branch.
2 parents ffe63db + d3eb85e commit 26c7582

13 files changed

+978
-821
lines changed

Flutter/DateRangePicker/Callbacks.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,29 @@ documentation: ug
88
---
99

1010
# Callbacks in Flutter Date Range Picker (SfDateRangePicker)
11-
Calendar supports the `ViewChangedCallback` and `SelectionChangedCallback` to interact with the Flutter date range picker.
11+
12+
Calendar supports the [ViewChangedCallback](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/DateRangePickerViewChangedCallback.html) and [SelectionChangedCallback](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/DateRangePickerSelectionChangedCallback.html) to interact with the Flutter date range picker.
1213

1314
## View changed callback
15+
1416
The [onViewChanged](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker/onViewChanged.html) callback triggers when the current view swiped to previous or next view, picker view switched to another picker view.
1517

16-
* `visibleDateRange` - returns the start and end dates of the current visible month.
18+
* [visibleDateRange](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/DateRangePickerViewChangedArgs/visibleDateRange.html) - returns the start and end dates of the current visible month.
1719

1820
{% tabs %}
1921
{% highlight dart hl_lines="6 7 8" %}
2022

21-
@override
22-
Widget build(BuildContext context) {
23-
return Scaffold(
24-
body: SfDateRangePicker(
25-
view: DateRangePickerView.month,
26-
onViewChanged: (DateRangePickerViewChangedArgs args) {
27-
var visibleDates = args.visibleDateRange;
28-
},
29-
),
30-
);
31-
}
23+
@override
24+
Widget build(BuildContext context) {
25+
return Scaffold(
26+
body: SfDateRangePicker(
27+
view: DateRangePickerView.month,
28+
onViewChanged: (DateRangePickerViewChangedArgs args) {
29+
var visibleDates = args.visibleDateRange;
30+
},
31+
),
32+
);
33+
}
3234

3335
{% endhighlight %}
3436
{% endtabs %}
@@ -37,34 +39,35 @@ Widget build(BuildContext context) {
3739
* Use [HijriDatePickerViewChangedArgs](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/HijriDatePickerViewChangedArgs-class.html) for the [SfHijriDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfHijriDateRangePicker-class.html).
3840

3941
## Selection changed callback
42+
4043
The [onSelectionChanged](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker/onSelectionChanged.html) callback triggers when selecting the dates from the date picker.
4144

4245
* `args.value` - returns the dates based on the selection mode.
4346

4447
{% tabs %}
4548
{% highlight dart hl_lines="7 8 9 10 11 12 13 14 15 16 17 18" %}
4649

47-
@override
48-
Widget build(BuildContext context) {
49-
return Scaffold(
50-
body: SfDateRangePicker(
51-
view: DateRangePickerView.month,
52-
selectionMode: DateRangePickerSelectionMode.range,
53-
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
54-
if (args.value is PickerDateRange) {
55-
final DateTime rangeStartDate = args.value.startDate;
56-
final DateTime rangeEndDate = args.value.endDate;
57-
} else if (args.value is DateTime) {
58-
final DateTime selectedDate = args.value;
59-
} else if (args.value is List<DateTime>) {
60-
final List<DateTime> selectedDates = args.value;
61-
} else {
62-
final List<PickerDateRange> selectedRanges = args.value;
63-
}
64-
},
65-
),
66-
);
67-
}
50+
@override
51+
Widget build(BuildContext context) {
52+
return Scaffold(
53+
body: SfDateRangePicker(
54+
view: DateRangePickerView.month,
55+
selectionMode: DateRangePickerSelectionMode.range,
56+
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
57+
if (args.value is PickerDateRange) {
58+
final DateTime rangeStartDate = args.value.startDate;
59+
final DateTime rangeEndDate = args.value.endDate;
60+
} else if (args.value is DateTime) {
61+
final DateTime selectedDate = args.value;
62+
} else if (args.value is List<DateTime>) {
63+
final List<DateTime> selectedDates = args.value;
64+
} else {
65+
final List<PickerDateRange> selectedRanges = args.value;
66+
}
67+
},
68+
),
69+
);
70+
}
6871

6972
{% endhighlight %}
7073
{% endtabs %}

Flutter/DateRangePicker/accessibility.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ documentation: ug
1010
# Accessibility in Flutter DateRangePicker (SfDateRangePicker)
1111

1212
## Screen reader support
13-
The `SfDateRangePicker` can easily be accessed by screen readers. Please find the following table to get spoken feedback about the inner element contents of the screen.
13+
The [SfDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker-class.html) can easily be accessed by screen readers. Please find the following table to get spoken feedback about the inner element contents of the screen.
1414

1515
### Month view
1616

@@ -56,7 +56,7 @@ The `SfDateRangePicker` can easily be accessed by screen readers. Please find th
5656

5757
## Sufficient contrast
5858

59-
The `SfDateRangePicker` [theming](https://help.syncfusion.com/flutter/themes) support offers a consistent and standardized look, as well as the ability to set the colors for all the UI elements.
59+
The [SfDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker-class.html) [theming](https://help.syncfusion.com/flutter/themes) support offers a consistent and standardized look, as well as the ability to set the colors for all the UI elements.
6060

6161
The following APIs allows you to customize the colors of the following elements.
6262
* [viewHeaderStyle](https://help.syncfusion.com/flutter/daterangepicker/headers#view-header)
@@ -75,7 +75,7 @@ The following APIs allows you to customize the colors of the following elements.
7575

7676
## Large fonts
7777

78-
The `SfDateRangePicker` font size can be adjusted automatically based on device settings and the font size scaled based on the `MediaQueryData.textScaleFactor`. It also allows you to change the font size of all elements in date range picker.
78+
The [SfDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker-class.html) font size can be adjusted automatically based on device settings and the font size scaled based on the [MediaQueryData.textScaleFactor](https://api.flutter.dev/flutter/widgets/MediaQueryData/textScaleFactor.html). It also allows you to change the font size of all elements in date range picker.
7979
* [todayTextStyle](https://help.syncfusion.com/flutter/daterangepicker/customizations)
8080
* [leadingDatesTextStyle](https://help.syncfusion.com/flutter/daterangepicker/customizations)
8181
* [trailingDatesTextStyle](https://help.syncfusion.com/flutter/daterangepicker/customizations)
@@ -89,7 +89,7 @@ The `SfDateRangePicker` font size can be adjusted automatically based on device
8989

9090
## Keyboard navigation
9191

92-
The following keyboard interactions are supported by the `SfDateRangePicker`.
92+
The following keyboard interactions are supported by the [SfDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker-class.html).
9393

9494
| Key | Description |
9595
|-----------------------|----------------------------------------------------------------------------------------------------------------|

Flutter/DateRangePicker/builders.md

Lines changed: 50 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ control: SfDateRangePicker
77
documentation: ug
88
---
99
# Builders in Flutter Date Range Picker (SfDateRangePicker)
10+
1011
The date range picker allows you to create a responsive UI with the conditions based on a widget’s details, and to design and create your custom view to the month cells and year cells in the date range picker.
1112

1213
## Cell builder
14+
1315
The [DateRangePickerCellBuilder](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/DateRangePickerCellBuilder.html) allows you to design your custom view and assign the view to the month and year view cells of the date range picker by returning an appropriate widget in the [cellBuilder](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker/cellBuilder.html) of [SfDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfDateRangePicker-class.html).
1416

1517
[DateRangePickerCellDetails](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/DateRangePickerCellDetails-class.html): Returns the details of the cell.
@@ -29,63 +31,56 @@ class MyAppState extends State<MyApp> {
2931
return MaterialApp(
3032
debugShowCheckedModeBanner: false,
3133
home: Scaffold(
32-
body: SafeArea(
33-
child: SfDateRangePicker(
34-
controller: _controller,
35-
cellBuilder:
36-
(BuildContext context, DateRangePickerCellDetails details) {
37-
final bool isToday = isSameDate(details.date, DateTime.now());
38-
final bool isBlackOut = isBlackedDate(details.date);
39-
final bool isSpecialDate = isSpecialDay(details.date);
40-
return Container(
41-
margin: EdgeInsets.all(2),
42-
padding: EdgeInsets.only(top: 10),
43-
decoration: BoxDecoration(
34+
body: SafeArea(
35+
child: SfDateRangePicker(
36+
controller: _controller,
37+
cellBuilder: (
38+
BuildContext context,
39+
DateRangePickerCellDetails details,
40+
) {
41+
final bool isToday = isSameDate(details.date, DateTime.now());
42+
final bool isBlackOut = isBlackedDate(details.date);
43+
final bool isSpecialDate = isSpecialDay(details.date);
44+
return Container(
45+
margin: EdgeInsets.all(2),
46+
padding: EdgeInsets.only(top: 10),
47+
decoration: BoxDecoration(
4448
color: Colors.blueAccent,
45-
border: isToday
46-
? Border.all(color: Colors.black, width: 2)
47-
: null),
48-
child: Column(
49-
mainAxisSize: MainAxisSize.max,
50-
mainAxisAlignment: MainAxisAlignment.spaceAround,
51-
children: <Widget>[
52-
Text(
53-
details.date.day.toString(),
54-
style: TextStyle(
55-
fontSize: 13,
56-
fontWeight: FontWeight.bold,
49+
border:
50+
isToday
51+
? Border.all(color: Colors.black, width: 2)
52+
: null,
53+
),
54+
child: Column(
55+
mainAxisSize: MainAxisSize.max,
56+
mainAxisAlignment: MainAxisAlignment.spaceAround,
57+
children: <Widget>[
58+
Text(
59+
details.date.day.toString(),
60+
style: TextStyle(
61+
fontSize: 13,
62+
fontWeight: FontWeight.bold,
63+
),
5764
),
58-
),
59-
isBlackOut
60-
? Icon(
61-
Icons.block_sharp,
62-
size: 13,
65+
isBlackOut
66+
? Icon(Icons.block_sharp, size: 13)
67+
: isSpecialDate
68+
? Row(
69+
mainAxisAlignment: MainAxisAlignment.center,
70+
children: [
71+
Icon(Icons.cake, size: 13),
72+
Icon(Icons.celebration, size: 13),
73+
Icon(Icons.audiotrack, size: 13),
74+
],
6375
)
64-
: isSpecialDate
65-
? Row(
66-
mainAxisAlignment: MainAxisAlignment.center,
67-
children: [
68-
Icon(
69-
Icons.cake,
70-
size: 13,
71-
),
72-
Icon(
73-
Icons.celebration,
74-
size: 13,
75-
),
76-
Icon(
77-
Icons.audiotrack,
78-
size: 13,
79-
)
80-
],
81-
)
82-
: Container()
83-
],
84-
),
85-
);
86-
},
76+
: Container(),
77+
],
78+
),
79+
);
80+
},
81+
),
8782
),
88-
)),
83+
),
8984
);
9085
}
9186

@@ -114,18 +109,17 @@ class MyAppState extends State<MyApp> {
114109
}
115110
}
116111

117-
118112
{% endhighlight %}
119113
{% endtabs %}
120114

121115
![Cell builder](images/builders/cell-builder.jpg)
122116

123117
>**NOTE**
124-
* Use [HijriDateRangePickerCellDetails]() for the [SfHijriDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfHijriDateRangePicker-class.html).
118+
* Use [HijriDateRangePickerCellDetails](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/HijriDateRangePickerCellDetails-class.html) for the [SfHijriDateRangePicker](https://pub.dev/documentation/syncfusion_flutter_datepicker/latest/datepicker/SfHijriDateRangePicker-class.html).
125119

126120

127121
## See also
128122

129123
* [How to customize the date range picker cells using builder in the Flutter (SfDateRangePicker)](https://support.syncfusion.com/kb/article/10711/how-to-customize-the-date-range-picker-cells-using-builder-in-the-flutter-sfdaterangepicker)
130124
* [How to create timeline Date Picker in Flutter](https://support.syncfusion.com/kb/article/10992/how-to-create-timeline-date-picker-in-flutter)
131-
* [How to customize the special dates using builder in the Flutter Date Range Picker](https://support.syncfusion.com/kb/article/10750/how-to-customize-the-special-dates-using-builder-in-the-flutter-date-range-picker)
125+
* [How to customize the special dates using builder in the Flutter Date Range Picker](https://support.syncfusion.com/kb/article/10750/how-to-customize-the-special-dates-using-builder-in-the-flutter-date-range-picker)

0 commit comments

Comments
 (0)