import 'package:flutter/material.dart';

import '../../../../../../common/theme/theme.dart';
import '../../../../../components/spaces/space.dart';

class SettingTile extends StatelessWidget {
  final int index;
  final int currentIndex;
  final String title;
  final String subtitle;
  final IconData icon;
  final Function() onTap;

  const SettingTile({
    super.key,
    required this.title,
    required this.subtitle,
    required this.icon,
    required this.onTap,
    required this.index,
    required this.currentIndex,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: const EdgeInsets.all(12.0),
        decoration: BoxDecoration(
          border: Border(
            right: BorderSide(
              color: currentIndex == index
                  ? AppColor.primary
                  : Colors.transparent,
              width: 4.0,
            ),
          ),
        ),
        child: Row(
          children: [
            Icon(
              icon,
              size: 24.0,
              color: currentIndex == index
                  ? AppColor.primary
                  : AppColor.textSecondary,
            ),
            const SpaceWidth(12),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    title,
                    style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
                  ),
                  const SpaceHeight(4.0),
                  Text(
                    subtitle,
                    style: AppStyle.md.copyWith(color: AppColor.textSecondary),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
