Skip to content

Commit 5e506ae

Browse files
authored
Add missing parameters to SwitchListTile (#120115)
* Add missing parameters to SwitchListTile * Update SwitchListTile doc * Update doc for existing APIs * Address comment * Fix typo --------- Co-authored-by: Qun Cheng <[email protected]>
1 parent 9996126 commit 5e506ae

File tree

3 files changed

+836
-46
lines changed

3 files changed

+836
-46
lines changed

packages/flutter/lib/src/material/switch.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,19 @@ class Switch extends StatelessWidget {
197197
/// ```
198198
final ValueChanged<bool>? onChanged;
199199

200+
/// {@template flutter.material.switch.activeColor}
200201
/// The color to use when this switch is on.
202+
/// {@endtemplate}
201203
///
202204
/// Defaults to [ColorScheme.secondary].
203205
///
204206
/// If [thumbColor] returns a non-null color in the [MaterialState.selected]
205207
/// state, it will be used instead of this color.
206208
final Color? activeColor;
207209

210+
/// {@template flutter.material.switch.activeTrackColor}
208211
/// The color to use on the track when this switch is on.
212+
/// {@endtemplate}
209213
///
210214
/// Defaults to [ColorScheme.secondary] with the opacity set at 50%.
211215
///
@@ -215,7 +219,9 @@ class Switch extends StatelessWidget {
215219
/// state, it will be used instead of this color.
216220
final Color? activeTrackColor;
217221

222+
/// {@template flutter.material.switch.inactiveThumbColor}
218223
/// The color to use on the thumb when this switch is off.
224+
/// {@endtemplate}
219225
///
220226
/// Defaults to the colors described in the Material design specification.
221227
///
@@ -225,7 +231,9 @@ class Switch extends StatelessWidget {
225231
/// used instead of this color.
226232
final Color? inactiveThumbColor;
227233

234+
/// {@template flutter.material.switch.inactiveTrackColor}
228235
/// The color to use on the track when this switch is off.
236+
/// {@endtemplate}
229237
///
230238
/// Defaults to the colors described in the Material design specification.
231239
///
@@ -235,22 +243,30 @@ class Switch extends StatelessWidget {
235243
/// used instead of this color.
236244
final Color? inactiveTrackColor;
237245

246+
/// {@template flutter.material.switch.activeThumbImage}
238247
/// An image to use on the thumb of this switch when the switch is on.
248+
/// {@endtemplate}
239249
///
240250
/// Ignored if this switch is created with [Switch.adaptive].
241251
final ImageProvider? activeThumbImage;
242252

253+
/// {@template flutter.material.switch.onActiveThumbImageError}
243254
/// An optional error callback for errors emitted when loading
244255
/// [activeThumbImage].
256+
/// {@endtemplate}
245257
final ImageErrorListener? onActiveThumbImageError;
246258

259+
/// {@template flutter.material.switch.inactiveThumbImage}
247260
/// An image to use on the thumb of this switch when the switch is off.
261+
/// {@endtemplate}
248262
///
249263
/// Ignored if this switch is created with [Switch.adaptive].
250264
final ImageProvider? inactiveThumbImage;
251265

266+
/// {@template flutter.material.switch.onInactiveThumbImageError}
252267
/// An optional error callback for errors emitted when loading
253268
/// [inactiveThumbImage].
269+
/// {@endtemplate}
254270
final ImageErrorListener? onInactiveThumbImageError;
255271

256272
/// {@template flutter.material.switch.thumbColor}

0 commit comments

Comments
 (0)