build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Describes the part of the UI represented by this widget.

Implementation

@override
Widget build(BuildContext context) {
  final isSelected = value == groupValue;
  final interactive = enabled && onChanged != null;
  final control = Radio<T>(
    value: value,
    groupValue: groupValue,
    onChanged: interactive ? onChanged : null,
    enabled: enabled,
  );

  return ListTile(
    title: title,
    subtitle: subtitle,
    leading: controlAffinity == ListTileControlAffinity.leading
        ? control
        : secondary,
    trailing: controlAffinity == ListTileControlAffinity.trailing
        ? control
        : secondary,
    selected: selected || isSelected,
    dense: dense,
    enabled: enabled,
    padding: contentPadding,
    onTap: interactive && !isSelected
        ? () {
            return onChanged?.call(value);
          }
        : null,
  );
}