import 'package:flutter/cupertino.dart';
import 'package:nut_player_example/src/common/models/option_data.dart';

class RadioListOption extends StatelessWidget {
  final OptionData data;
  final bool isSelected;
  final Function? onTap;

  const RadioListOption(this.data, this.isSelected, this.onTap, {super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoListTile(
        key: data.key,
        onTap: () { if (onTap != null) { onTap!(); } },
        leading: Container(
          width: 24,
          height: 24,
          decoration: BoxDecoration(
              borderRadius: const BorderRadius.all(Radius.circular(12)),
              border: Border.all(color: CupertinoColors.link, width: 2.5),
              color: isSelected ? CupertinoColors.link : CupertinoColors.white
          ),
        ),
        title: Text(data.title, style: const TextStyle(decoration: TextDecoration.none, fontSize: 17))
    );
  }
}