import 'package:flutter/material.dart';
import 'package:syncrow_web/utils/color_manager.dart';

class IncrementDecrementWidget extends StatelessWidget {
  final String value;
  final String description;
  final VoidCallback onIncrement;
  final VoidCallback onDecrement;
  final Color? descriptionColor;

  const IncrementDecrementWidget({
    super.key,
    required this.value,
    required this.description,
    required this.onIncrement,
    required this.onDecrement,
    this.descriptionColor,
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        Material(
          type: MaterialType.transparency,
          child: ClipRRect(
            borderRadius: BorderRadius.circular(100),
            child: InkWell(
              splashColor: Colors.transparent,
              highlightColor: Colors.transparent,
              onTap: onDecrement,
              child: const Padding(
                padding: EdgeInsets.all(8.0),
                child: Icon(
                  Icons.remove,
                  color: ColorsManager.greyColor,
                  size: 28,
                ),
              ),
            ),
          ),
        ),
        Expanded(
          child: FittedBox(
            fit: BoxFit.scaleDown,
            child: RichText(
              text: TextSpan(
                text: '',
                children: [
                  TextSpan(
                    text: value,
                    style: TextStyle(
                      fontSize: 40,
                      color: ColorsManager.dialogBlueTitle,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  TextSpan(
                    text: description,
                    style: TextStyle(
                      fontSize: 16,
                      color: descriptionColor ?? ColorsManager.blackColor,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
        Material(
          type: MaterialType.transparency,
          child: ClipRRect(
            borderRadius: BorderRadius.circular(100),
            child: InkWell(
              splashColor: Colors.transparent,
              highlightColor: Colors.transparent,
              onTap: onIncrement,
              child: const Padding(
                padding: EdgeInsets.all(8.0),
                child: Icon(
                  Icons.add,
                  color: ColorsManager.greyColor,
                  size: 28,
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}
