Skip to content

Commit 51227a9

Browse files
authored
Add missing parameters to RadioListTile (#120117)
1 parent 3a51417 commit 51227a9

File tree

3 files changed

+486
-2
lines changed

3 files changed

+486
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,20 @@ class Radio<T> extends StatefulWidget {
264264
/// [ThemeData.focusColor] is used.
265265
final Color? focusColor;
266266

267+
/// {@template flutter.material.radio.hoverColor}
267268
/// The color for the radio's [Material] when a pointer is hovering over it.
268269
///
269270
/// If [overlayColor] returns a non-null color in the [MaterialState.hovered]
270271
/// state, it will be used instead.
272+
/// {@endtemplate}
271273
///
272274
/// If null, then the value of [RadioThemeData.overlayColor] is used in the
273275
/// hovered state. If that is also null, then the value of
274276
/// [ThemeData.hoverColor] is used.
275277
final Color? hoverColor;
276278

277279
/// {@template flutter.material.radio.overlayColor}
278-
/// The color for the checkbox's [Material].
280+
/// The color for the radio's [Material].
279281
///
280282
/// Resolves in the following states:
281283
/// * [MaterialState.pressed].

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

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,14 @@ class RadioListTile<T> extends StatelessWidget {
162162
required this.value,
163163
required this.groupValue,
164164
required this.onChanged,
165+
this.mouseCursor,
165166
this.toggleable = false,
166167
this.activeColor,
168+
this.fillColor,
169+
this.hoverColor,
170+
this.overlayColor,
171+
this.splashRadius,
172+
this.materialTapTargetSize,
167173
this.title,
168174
this.subtitle,
169175
this.isThreeLine = false,
@@ -220,6 +226,20 @@ class RadioListTile<T> extends StatelessWidget {
220226
/// ```
221227
final ValueChanged<T?>? onChanged;
222228

229+
/// The cursor for a mouse pointer when it enters or is hovering over the
230+
/// widget.
231+
///
232+
/// If [mouseCursor] is a [MaterialStateProperty<MouseCursor>],
233+
/// [MaterialStateProperty.resolve] is used for the following [MaterialState]s:
234+
///
235+
/// * [MaterialState.selected].
236+
/// * [MaterialState.hovered].
237+
/// * [MaterialState.disabled].
238+
///
239+
/// If null, then the value of [RadioThemeData.mouseCursor] is used.
240+
/// If that is also null, then [MaterialStateMouseCursor.clickable] is used.
241+
final MouseCursor? mouseCursor;
242+
223243
/// Set to true if this radio list tile is allowed to be returned to an
224244
/// indeterminate state by selecting it again when selected.
225245
///
@@ -250,6 +270,45 @@ class RadioListTile<T> extends StatelessWidget {
250270
/// Defaults to [ColorScheme.secondary] of the current [Theme].
251271
final Color? activeColor;
252272

273+
/// The color that fills the radio button.
274+
///
275+
/// Resolves in the following states:
276+
/// * [MaterialState.selected].
277+
/// * [MaterialState.hovered].
278+
/// * [MaterialState.disabled].
279+
///
280+
/// If null, then the value of [activeColor] is used in the selected state. If
281+
/// that is also null, then the value of [RadioThemeData.fillColor] is used.
282+
/// If that is also null, then the default value is used.
283+
final MaterialStateProperty<Color?>? fillColor;
284+
285+
/// {@macro flutter.material.radio.materialTapTargetSize}
286+
///
287+
/// Defaults to [MaterialTapTargetSize.shrinkWrap].
288+
final MaterialTapTargetSize? materialTapTargetSize;
289+
290+
/// {@macro flutter.material.radio.hoverColor}
291+
final Color? hoverColor;
292+
293+
/// The color for the radio's [Material].
294+
///
295+
/// Resolves in the following states:
296+
/// * [MaterialState.pressed].
297+
/// * [MaterialState.selected].
298+
/// * [MaterialState.hovered].
299+
///
300+
/// If null, then the value of [activeColor] with alpha [kRadialReactionAlpha]
301+
/// and [hoverColor] is used in the pressed and hovered state. If that is also
302+
/// null, the value of [SwitchThemeData.overlayColor] is used. If that is
303+
/// also null, then the default value is used in the pressed and hovered state.
304+
final MaterialStateProperty<Color?>? overlayColor;
305+
306+
/// {@macro flutter.material.radio.splashRadius}
307+
///
308+
/// If null, then the value of [RadioThemeData.splashRadius] is used. If that
309+
/// is also null, then [kRadialReactionRadius] is used.
310+
final double? splashRadius;
311+
253312
/// The primary content of the list tile.
254313
///
255314
/// Typically a [Text] widget.
@@ -341,8 +400,13 @@ class RadioListTile<T> extends StatelessWidget {
341400
onChanged: onChanged,
342401
toggleable: toggleable,
343402
activeColor: activeColor,
344-
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
403+
materialTapTargetSize: materialTapTargetSize ?? MaterialTapTargetSize.shrinkWrap,
345404
autofocus: autofocus,
405+
fillColor: fillColor,
406+
mouseCursor: mouseCursor,
407+
hoverColor: hoverColor,
408+
overlayColor: overlayColor,
409+
splashRadius: splashRadius,
346410
);
347411
Widget? leading, trailing;
348412
switch (controlAffinity) {

0 commit comments

Comments
 (0)