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';
import 'package:syncrow_web/utils/extension/build_context_x.dart';

class IconNameStatusContainer extends StatelessWidget {
  const IconNameStatusContainer({
    super.key,
    required this.name,
    required this.icon,
    required this.onTap,
    required this.status,
    required this.textColor,
    this.paddingAmount = 12,
    required this.isFullIcon,
  });

  final String name;
  final String icon;
  final GestureTapCallback onTap;
  final bool status;
  final Color textColor;
  final double? paddingAmount;
  final bool isFullIcon;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: DeviceControlsContainer(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            if (isFullIcon)
              ClipOval(
                child: SvgPicture.asset(
                  icon,
                  fit: BoxFit.contain,
                ),
              )
            else
              ClipOval(
                  child: Container(
                height: 60,
                width: 60,
                padding: EdgeInsets.all(paddingAmount ?? 8),
                color: ColorsManager.whiteColors,
                child: SvgPicture.asset(
                  icon,
                  width: 35,
                  height: 35,
                  fit: BoxFit.contain,
                ),
              )),
            const Spacer(),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 6),
              child: Text(
                name,
                textAlign: TextAlign.start,
                style: context.textTheme.titleMedium!.copyWith(
                  fontWeight: FontWeight.w400,
                  color: textColor,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
