import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';

class ProfileSwitchTile extends StatelessWidget {
  final IconData icon;
  final String title;
  final String? subtitle;
  final bool value;
  final ValueChanged<bool> onChanged;
  const ProfileSwitchTile({
    super.key,
    required this.icon,
    required this.title,
    this.subtitle,
    required this.value,
    required this.onChanged,
  });

  @override
  Widget build(BuildContext context) {
    return ListTile(
      leading: Container(
        padding: const EdgeInsets.all(8),
        decoration: BoxDecoration(
          color: AppColor.primary.withOpacity(0.1),
          borderRadius: BorderRadius.circular(8),
        ),
        child: Icon(icon, color: AppColor.primary, size: 20),
      ),
      title: Text(
        title,
        style: AppStyle.lg.copyWith(
          fontWeight: FontWeight.w500,
          color: AppColor.textPrimary,
        ),
      ),
      subtitle: subtitle != null
          ? Text(
              subtitle!,
              style: AppStyle.md.copyWith(color: AppColor.textSecondary),
            )
          : null,
      trailing: Switch(
        value: value,
        onChanged: onChanged,
        activeColor: AppColor.primary,
      ),
    );
  }
}
