import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:satu/shared/app_colors.dart';
import 'package:satu/widgets/ui/product_title_widget.dart';

class AddProductListItem extends StatelessWidget {
  const AddProductListItem(
      {required this.name,
      Key? key,
      this.ean,
      this.categoryName,
      this.price,
      this.count,
      this.onPress})
      : super(key: key);

  final String name;
  final String? ean;
  final String? categoryName;
  final num? price;
  final num? count;

  final Function? onPress;

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.transparent,
      child: InkWell(
        onTap: () => onPress!(),
        child: Container(
          decoration: const BoxDecoration(color: whiteColor),
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Flexible(
                  flex: 3,
                  child: ProductTitleWidget(
                    name: name,
                    ean: ean,
                    categoryName: categoryName,
                  ),
                ),
                Flexible(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.end,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        '$price ₸',
                        style: TextStyle(
                            fontSize: ScreenUtil().setSp(20.0),
                            fontWeight: FontWeight.bold),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
