import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';

class ScheduleControlButton extends StatelessWidget {
  final VoidCallback onTap;
  final String mainText;
  final String subtitle;
  final String iconPath;

  const ScheduleControlButton({
    super.key,
    required this.onTap,
    required this.mainText,
    required this.subtitle,
    required this.iconPath,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: DeviceControlsContainer(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              width: 60,
              height: 60,
              decoration: const BoxDecoration(
                shape: BoxShape.circle,
                color: ColorsManager.whiteColors,
              ),
              margin: const EdgeInsets.symmetric(horizontal: 4),
              padding: const EdgeInsets.all(12),
              child: ClipOval(
                child: SvgPicture.asset(
                  iconPath,
                  fit: BoxFit.fill,
                ),
              ),
            ),
            const Spacer(),
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  mainText,
                  textAlign: TextAlign.center,
                  style: Theme.of(context).textTheme.titleMedium!.copyWith(
                        fontWeight: FontWeight.w200,
                        fontSize: 12,
                        color: ColorsManager.blackColor,
                      ),
                ),
                Text(
                  subtitle,
                  textAlign: TextAlign.center,
                  style: Theme.of(context).textTheme.titleMedium!.copyWith(
                        fontWeight: FontWeight.w400,
                        color: ColorsManager.blackColor,
                      ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
