import 'package:flutter/material.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';

class ServiceItemWithPriceCheckBox extends StatelessWidget {
  final bool isSelected;
  final String title, description;
  final Widget priceWidget;

  final Function(bool) onSelection;

  const ServiceItemWithPriceCheckBox({
    required this.isSelected,
    required this.title,
    required this.description,
    this.priceWidget = const SizedBox(),
    required this.onSelection,
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: double.infinity,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Checkbox(
            value: isSelected,
            onChanged: (bool? v) {
              onSelection(v ?? false);
            },
          ),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                title.toText(fontSize: 16, isBold: true).paddingOnly(top: 10),
                description.toText(fontSize: 12, color: MyColors.lightTextColor),
                priceWidget,
              ],
            ),
          ),
        ],
      ),
    );
  }
}
