import 'package:flutter/material.dart';

import 'package:im_app/core/ui/base/context_theme_ext.dart';

/// 单个主题选项行
///
/// 纯展示 + 事件透传，不感知任何 Provider。
/// 父级传入 [isSelected] 决定是否显示勾选图标，[onTap] 处理切换。
///
/// 用法：
/// ```dart
/// ThemeOptionTile(
///   label: '黑色模式',
///   isSelected: current == ThemeMode.dark,
///   onTap: () => ref.read(themeViewModelProvider.notifier).setMode(ThemeMode.dark),
/// )
/// ```
class ThemeOptionTile extends StatelessWidget {
  const ThemeOptionTile({
    super.key,
    required this.label,
    required this.isSelected,
    required this.onTap,
  });

  final String label;
  final bool isSelected;
  final VoidCallback onTap;

  @override
  Widget build(BuildContext context) {
    final s = context.styles;

    return ListTile(
      title: Text(label),
      trailing: isSelected ? Icon(Icons.check, color: s.primary) : null,
      onTap: onTap,
    );
  }
}
