File tree 1 file changed +6
-2
lines changed
packages/flutter/lib/src/material
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import 'theme.dart';
11
11
import 'theme_data.dart' ;
12
12
13
13
// Examples can assume:
14
+ // bool? _throwShotAway = false;
14
15
// void setState(VoidCallback fn) { }
15
16
16
17
/// A [ListTile] with a [Checkbox] . In other words, a checkbox with a label.
@@ -163,21 +164,24 @@ class CheckboxListTile extends StatelessWidget {
163
164
///
164
165
/// If null, the checkbox will be displayed as disabled.
165
166
///
167
+ /// {@tool snippet}
168
+ ///
166
169
/// The callback provided to [onChanged] should update the state of the parent
167
170
/// [StatefulWidget] using the [State.setState] method, so that the parent
168
171
/// gets rebuilt; for example:
169
172
///
170
173
/// ```dart
171
174
/// CheckboxListTile(
172
175
/// value: _throwShotAway,
173
- /// onChanged: (bool newValue) {
176
+ /// onChanged: (bool? newValue) {
174
177
/// setState(() {
175
178
/// _throwShotAway = newValue;
176
179
/// });
177
180
/// },
178
- /// title: Text('Throw away your shot'),
181
+ /// title: const Text('Throw away your shot'),
179
182
/// )
180
183
/// ```
184
+ /// {@end-tool}
181
185
final ValueChanged <bool ?>? onChanged;
182
186
183
187
/// The color to use when this checkbox is checked.
You can’t perform that action at this time.
0 commit comments