Skip to content

Commit ad3775b

Browse files
committed
improved documentation
1 parent be03eac commit ad3775b

19 files changed

+360
-9
lines changed

.pubignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
.vscode/*
2-
example
32
images

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Releases
22

3+
## [3.1.4] - 2022-04-08
4+
5+
- added example back in
6+
- improved documentation
7+
38
## [3.1.3] - 2022-04-07
49

510
- Updated dependency versions

lib/dialogs/checkbox_picker_dialog.dart

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import 'responsive_dialog.dart';
1010

1111
/// This is a support widget that returns an Dialog with checkboxes as a Widget.
1212
/// It is designed to be used in the showDialog method of other fields.
13-
class CheckboxPickerDialog<T> extends StatefulWidget implements ICommonDialogProperties {
13+
class CheckboxPickerDialog<T> extends StatefulWidget
14+
implements ICommonDialogProperties {
1415
CheckboxPickerDialog({
1516
this.title,
1617
required this.items,
@@ -50,13 +51,16 @@ class CheckboxPickerDialog<T> extends StatefulWidget implements ICommonDialogPro
5051
final String? cancelText;
5152

5253
@override
53-
State<CheckboxPickerDialog> createState() => _CheckboxPickerDialogState<T>(selectedItems);
54+
State<CheckboxPickerDialog> createState() =>
55+
_CheckboxPickerDialogState<T>(selectedItems);
5456
}
5557

5658
class _CheckboxPickerDialogState<T> extends State<CheckboxPickerDialog<T>> {
5759
_CheckboxPickerDialogState(List<T>? selectedItems) {
5860
// make a shallow copy so we don't modify the original list
59-
this.selectedItems = (selectedItems == null) ? List<T>.empty(growable: true) : List<T>.from(selectedItems);
61+
this.selectedItems = (selectedItems == null)
62+
? List<T>.empty(growable: true)
63+
: List<T>.from(selectedItems);
6064
}
6165

6266
late List<T> selectedItems;

lib/dialogs/radio_picker_dialog.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import 'responsive_dialog.dart';
1010

1111
/// This is a support widget that returns an Dialog with checkboxes as a Widget.
1212
/// It is designed to be used in the showDialog method of other fields.
13-
class RadioPickerDialog<T> extends StatefulWidget implements ICommonDialogProperties {
13+
class RadioPickerDialog<T> extends StatefulWidget
14+
implements ICommonDialogProperties {
1415
RadioPickerDialog({
1516
this.title,
1617
required this.items,
@@ -50,7 +51,8 @@ class RadioPickerDialog<T> extends StatefulWidget implements ICommonDialogProper
5051
final String? cancelText;
5152

5253
@override
53-
State<RadioPickerDialog> createState() => _RadioPickerDialogState<T>(selectedItem);
54+
State<RadioPickerDialog> createState() =>
55+
_RadioPickerDialogState<T>(selectedItem);
5456
}
5557

5658
class _RadioPickerDialogState<T> extends State<RadioPickerDialog<T>> {

lib/helpers/show_checkbox_picker.dart

+31
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,51 @@ import '../flutter_material_pickers.dart';
99
/// Allows selection of many values from a checkbox list.
1010
Future<List<T>?> showMaterialCheckboxPicker<T>({
1111
required BuildContext context,
12+
13+
/// The title for the dialog box
1214
String? title,
15+
16+
/// The list of items to use with the picker
1317
required List<T> items,
18+
19+
/// The item that will be initially selected
1420
List<T>? selectedItems,
21+
22+
/// The dialog header color (overrides theme)
1523
Color? headerColor,
24+
25+
/// The dialog header text color (overrides theme)
1626
Color? headerTextColor,
27+
28+
/// The dialog background color (overrides theme)
1729
Color? backgroundColor,
30+
31+
/// The button text color (overrides theme)
1832
Color? buttonTextColor,
33+
34+
/// Text to display in the confirm button
1935
String? confirmText,
36+
37+
/// Text to display in the cancel button
2038
String? cancelText,
39+
40+
/// Used to restrict how tall the dialog can be.
2141
double? maxLongSide,
42+
43+
/// Used to restrict how wide the dialog can be.
2244
double? maxShortSide,
45+
46+
/// Function that gets called when the value is changed
2347
ValueChanged<List<T>>? onChanged,
48+
49+
/// Function that gets called when the confirm button is pressed
2450
VoidCallback? onConfirmed,
51+
52+
/// Function that gets called when the cancel button is pressed
2553
VoidCallback? onCancelled,
54+
55+
/// Function that is called when each items renders which can be used to transform the content
56+
/// This is helpful, for example, to provide translations to other languages
2657
Transformer<T>? transformer,
2758
}) {
2859
return showDialog<List<T>>(

lib/helpers/show_color_picker.dart

+26
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,44 @@ import 'package:flutter_material_pickers/dialogs/responsive_dialog.dart';
88
/// Allows RGB selection of a color.
99
Future<Color?> showMaterialColorPicker({
1010
required BuildContext context,
11+
12+
/// The title for the dialog box
1113
String title = "Pick a color",
14+
15+
/// The color that is initially selected
1216
required Color selectedColor,
17+
18+
/// The dialog header color (overrides theme)
1319
Color? headerColor,
20+
21+
/// The dialog header text color (overrides theme)
1422
Color? headerTextColor,
23+
24+
/// The dialog background color (overrides theme)
1525
Color? backgroundColor,
26+
27+
/// The button text color (overrides theme)
1628
Color? buttonTextColor,
29+
30+
/// Text to display in the confirm button
1731
String? confirmText,
32+
33+
/// Text to display in the cancel button
1834
String? cancelText,
35+
36+
/// Used to restrict how tall the dialog can be.
1937
double? maxLongSide,
38+
39+
/// Used to restrict how wide the dialog can be.
2040
double? maxShortSide,
41+
42+
/// Function that gets called when the value is changed
2143
ValueChanged<Color>? onChanged,
44+
45+
/// Function that gets called when the confirm button is pressed
2246
VoidCallback? onConfirmed,
47+
48+
/// Function that gets called when the cancel button is pressed
2349
VoidCallback? onCancelled,
2450
}) {
2551
return showDialog<Color>(

lib/helpers/show_date_picker.dart

+30
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,50 @@ import 'package:flutter_material_pickers/dialogs/responsive_dialog.dart';
77
/// Allows selection of a date.
88
Future<DateTime?> showMaterialDatePicker({
99
required BuildContext context,
10+
11+
/// The title for the dialog box
1012
String? title,
13+
14+
/// The intiial first date in the selection range
1115
required DateTime firstDate,
16+
17+
/// The intiial last date in the selection range
1218
required DateTime lastDate,
19+
20+
/// The initial single selected date
1321
required DateTime selectedDate,
22+
23+
/// The dialog header color (overrides theme)
1424
Color? headerColor,
25+
26+
/// The dialog header text color (overrides theme)
1527
Color? headerTextColor,
28+
29+
/// The dialog background color (overrides theme)
1630
Color? backgroundColor,
31+
32+
/// The button text color (overrides theme)
1733
Color? buttonTextColor,
34+
35+
/// Text to display in the confirm button
1836
String? confirmText,
37+
38+
/// Text to display in the cancel button
1939
String? cancelText,
40+
41+
/// Used to restrict how tall the dialog can be.
2042
double? maxLongSide,
43+
44+
/// Used to restrict how wide the dialog can be.
2145
double? maxShortSide,
46+
47+
/// Function that gets called when the value is changed
2248
ValueChanged<DateTime>? onChanged,
49+
50+
/// Function that gets called when the confirm button is pressed
2351
VoidCallback? onConfirmed,
52+
53+
/// Function that gets called when the cancel button is pressed
2454
VoidCallback? onCancelled,
2555
}) {
2656
return showDialog<DateTime>(

lib/helpers/show_file_picker.dart

+6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ import 'package:flutter/material.dart';
99
/// Allows selection of a file.
1010
Future<void> showMaterialFilePicker({
1111
BuildContext? context,
12+
13+
/// The type of the file to retrieve (filter)
1214
FileType fileType = FileType.any,
15+
16+
/// What allowed extensions to look for
1317
List<String>? allowedExtensions,
18+
19+
/// Function that gets called when the value is changed
1420
ValueChanged<PlatformFile>? onChanged,
1521
}) async {
1622
FilePickerResult? result = await FilePicker.platform.pickFiles(

lib/helpers/show_number_picker.dart

+35
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,57 @@ import '../flutter_material_pickers.dart';
99
/// Allows selection of a number via a slot machine carousel
1010
Future<int?> showMaterialNumberPicker({
1111
required BuildContext context,
12+
13+
/// The title for the dialog box
1214
String? title,
15+
16+
/// The lowest or starting number for the selections
1317
required final int minNumber,
18+
19+
/// The highest or max number for the selections
1420
required final int maxNumber,
21+
22+
/// The number to begin on
1523
final int? selectedNumber,
24+
25+
/// The number step, in case you don't to skip ranges.
1626
final int step = 1,
27+
28+
/// The dialog header color (overrides theme)
1729
Color? headerColor,
30+
31+
/// The dialog header text color (overrides theme)
1832
Color? headerTextColor,
33+
34+
/// The dialog background color (overrides theme)
1935
Color? backgroundColor,
36+
37+
/// The button text color (overrides theme)
2038
Color? buttonTextColor,
39+
40+
/// Text to display in the confirm button
2141
String? confirmText,
42+
43+
/// Text to display in the cancel button
2244
String? cancelText,
45+
46+
/// Used to restrict how tall the dialog can be.
2347
double? maxLongSide,
48+
49+
/// Used to restrict how wide the dialog can be.
2450
double? maxShortSide,
51+
52+
/// Function that gets called when the value is changed
2553
ValueChanged<int>? onChanged,
54+
55+
/// Function that gets called when the confirm button is pressed
2656
VoidCallback? onConfirmed,
57+
58+
/// Function that gets called when the cancel button is pressed
2759
VoidCallback? onCancelled,
60+
61+
/// Function that is called when each items renders which can be used to transform the content
62+
/// This is helpful, for example, to provide translations to other languages
2863
Transformer<int>? transformer,
2964
}) {
3065
List<int> items = [];

lib/helpers/show_palette_picker.dart

+26
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,44 @@ import 'package:flutter_material_pickers/dialogs/responsive_dialog.dart';
88
/// Allows Material palette selection of a color
99
Future<Color?> showMaterialPalettePicker({
1010
required BuildContext context,
11+
12+
/// The title for the dialog box
1113
String title = "Pick a color",
14+
15+
/// The color that is initially selected
1216
required Color selectedColor,
17+
18+
/// The dialog header color (overrides theme)
1319
Color? headerColor,
20+
21+
/// The dialog header text color (overrides theme)
1422
Color? headerTextColor,
23+
24+
/// The dialog background color (overrides theme)
1525
Color? backgroundColor,
26+
27+
/// The button text color (overrides theme)
1628
Color? buttonTextColor,
29+
30+
/// Text to display in the confirm button
1731
String? confirmText,
32+
33+
/// Text to display in the cancel button
1834
String? cancelText,
35+
36+
/// Used to restrict how tall the dialog can be.
1937
double? maxLongSide,
38+
39+
/// Used to restrict how wide the dialog can be.
2040
double? maxShortSide,
41+
42+
/// Function that gets called when the value is changed
2143
ValueChanged<Color>? onChanged,
44+
45+
/// Function that gets called when the confirm button is pressed
2246
VoidCallback? onConfirmed,
47+
48+
/// Function that gets called when the cancel button is pressed
2349
VoidCallback? onCancelled,
2450
}) {
2551
return showDialog<Color>(

lib/helpers/show_radio_picker.dart

+31
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,51 @@ import '../flutter_material_pickers.dart';
99
/// Allows selection of a single from a radio list
1010
Future<T?> showMaterialRadioPicker<T>({
1111
required BuildContext context,
12+
13+
/// The title for the dialog box
1214
String? title,
15+
16+
/// The list of items to use with the picker
1317
required List<T> items,
18+
19+
/// The item that will be initially selected
1420
T? selectedItem,
21+
22+
/// The dialog header color (overrides theme)
1523
Color? headerColor,
24+
25+
/// The dialog header text color (overrides theme)
1626
Color? headerTextColor,
27+
28+
/// The dialog background color (overrides theme)
1729
Color? backgroundColor,
30+
31+
/// The button text color (overrides theme)
1832
Color? buttonTextColor,
33+
34+
/// Text to display in the confirm button
1935
String? confirmText,
36+
37+
/// Text to display in the cancel button
2038
String? cancelText,
39+
40+
/// Used to restrict how tall the dialog can be.
2141
double? maxLongSide,
42+
43+
/// Used to restrict how wide the dialog can be.
2244
double? maxShortSide,
45+
46+
/// Function that gets called when the value is changed
2347
ValueChanged<T>? onChanged,
48+
49+
/// Function that gets called when the confirm button is pressed
2450
VoidCallback? onConfirmed,
51+
52+
/// Function that gets called when the cancel button is pressed
2553
VoidCallback? onCancelled,
54+
55+
/// Function that is called when each items renders which can be used to transform the content
56+
/// This is helpful, for example, to provide translations to other languages
2657
Transformer<T>? transformer,
2758
}) {
2859
return showDialog<T>(

0 commit comments

Comments
 (0)