buildTrailing method

Widget buildTrailing(
  1. BuildContext context
)

Implementation

Widget buildTrailing(BuildContext context) {
  return Row(
    children: [
      if (trailing != null)
        Padding(
          padding: const EdgeInsets.only(right: 16),
          child: trailing!,
        ),
      if (tileType == SettingsTileType.switchTile)
        Padding(
          padding: const EdgeInsets.only(right: 12),
          child: Transform.scale(
            scale: 0.85,
            child: Switch(
              thumbIcon: thumbIcon,
              value: initialValue ?? true,
              onChanged: (enabled) ? onToggle : null,
            ),
          ),
        ),
      if (tileType == SettingsTileType.checkboxTile)
        Padding(
          padding: const EdgeInsets.only(right: 12),
          child: Checkbox(
            tristate: true,
            value: initialValue,
            onChanged: (enabled) ? onToggle : null,
          ),
        ),
      if (tileType == SettingsTileType.radioTile)
        Padding(
          padding: const EdgeInsets.only(right: 12),
          child: Radio<T>(
            value: radioValue,
            groupValue: groupValue,
            onChanged: (enabled) ? onChanged : null,
          ),
        ),
      if (value != null)
        Padding(
          padding: const EdgeInsets.only(right: 16),
          child: DefaultTextStyle(
            style: TextStyle(
              color: enabled
                  ? Theme.of(context).hintColor
                  : Theme.of(context).disabledColor,
              fontWeight: FontWeight.w500,
              fontSize: 13,
            ),
            child: value!,
          ),
        ),
    ],
  );
}