buildTrailing method
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)
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 EdgeInsets.only(left: 2, right: 12),
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: enabled
? Theme.of(context).colorScheme.onSurface
: Theme.of(context).disabledColor,
),
),
],
);
}