buildTrailing method

Widget buildTrailing(
  1. BuildContext context
)

Implementation

Widget buildTrailing(BuildContext context) {
  return Row(
    children: [
      if (trailing != null)
        Padding(
          padding: const EdgeInsetsDirectional.only(end: 4),
          child: trailing!,
        ),
      if (tileType == SettingsTileType.switchTile)
        Transform.scale(
          scale: 0.85,
          child: Switch(
            value: initialValue ?? true,
            onChanged: (enabled) ? onToggle : null,
          ),
        ),
      if (tileType == SettingsTileType.checkboxTile)
        Checkbox(
          tristate: true,
          value: initialValue,
          onChanged: (enabled) ? onToggle : null,
        ),
      if (tileType == SettingsTileType.radioTile)
        Radio<T>(
          value: radioValue,
          groupValue: groupValue,
          onChanged: (enabled) ? onChanged : null,
        ),
      if (value != null)
        DefaultTextStyle(
          style: TextStyle(
            color: enabled
                ? Theme.of(context).colorScheme.onSurfaceVariant
                : Theme.of(context).disabledColor,
            fontSize: 14,
          ),
          child: value!,
        ),
      if (tileType == SettingsTileType.navigationTile)
        Padding(
          padding: const EdgeInsetsDirectional.only(start: 2, end: 2),
          child: Icon(
            Icons.keyboard_arrow_right_rounded,
            color: enabled
                ? Theme.of(context).colorScheme.onSurface
                : Theme.of(context).disabledColor,
          ),
        ),
    ],
  );
}