import 'package:flutter/cupertino.dart';

class ToggleView extends StatelessWidget {
  final String title;
  final bool isSelected;
  final Function(bool)? onChange;

  const ToggleView({super.key, required this.title, required this.isSelected, this.onChange});

  @override
  Widget build(BuildContext context) {
    return CupertinoListTile(
        key: key,
        trailing: CupertinoSwitch(
          value: isSelected,
          activeColor: CupertinoColors.activeGreen,
          onChanged: (bool value) {
            onChange?.call(value);
          },
        ),
        title: Text(title, style: const TextStyle(decoration: TextDecoration.none, fontSize: 17))
    );
  }
}