import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
import 'package:flutter/material.dart';

class AddonItemCounter extends StatelessWidget {
  final AddOnUpgrade addonUpgrade;
  final int quantity;
  final VoidCallback onIncrement;
  final VoidCallback onDecrement;

  const AddonItemCounter({
    super.key,
    required this.addonUpgrade,
    required this.quantity,
    required this.onIncrement,
    required this.onDecrement,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

    return Container(
      color: Theme.of(context).colorScheme.surface,
      child: Padding(
        padding: const EdgeInsets.only(
          left: 16.0,
          right: 16.0,
          top: 16.0,
          bottom: 40,
        ),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Row(
              children: [
                InkWell(
                  onTap: onDecrement,
                  borderRadius: BorderRadius.circular(24),
                  child: Container(
                    width: 44,
                    height: 44,
                    decoration: BoxDecoration(
                      color: Theme.of(context).colorScheme.onSurface,
                      shape: BoxShape.circle,
                    ),
                    child: Icon(Icons.remove, color: Theme.of(context).colorScheme.surface),
                  ),
                ),
                const SizedBox(width: 16),
                Text('$quantity', style: theme.textTheme.headlineMedium),
                const SizedBox(width: 16),
                // Plus button
                InkWell(
                  onTap: onIncrement,
                  borderRadius: BorderRadius.circular(24),
                  child: Container(
                    width: 44,
                    height: 44,
                    decoration: BoxDecoration(
                      color: Theme.of(context).colorScheme.onSurface,
                      shape: BoxShape.circle,
                    ),
                    child: Icon(Icons.add, color: Theme.of(context).colorScheme.surface),
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}