import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../app.dart';

class ItemQuantityCounter extends StatelessWidget {
  final VoidCallback decrementCallback;
  final VoidCallback incrementCallback;
  final String text;

  const ItemQuantityCounter({
    required this.decrementCallback,
    required this.incrementCallback,
    required this.text,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 35.h,
      decoration: new BoxDecoration(
        color: ThemeColor.colorEFF0F4,
        borderRadius: BorderRadius.circular(8),
      ),
      child: Row(
        children: [
          IncrementDecrementButton(
            callback: decrementCallback,
            icon: Icons.remove,
          ),
          Container(
            constraints: BoxConstraints(minWidth: 0.06.sw, maxWidth: 0.10.sw),
            child: Center(
              child: FittedBox(
                child: Text(
                  text,
                  style: new TextStyle(
                    fontSize: 12.sp,
                    fontWeight: FontWeight.bold,
                    color: ThemeColor.color3A3A3A,
                  ),
                  overflow: TextOverflow.ellipsis,
                ),
              ),
            ),
          ),
          IncrementDecrementButton(
            callback: incrementCallback,
            icon: Icons.add,
          ),
        ],
      ),
    );
  }
}
