import 'package:cims_apps/application/assets/path_assets.dart';
import 'package:cims_apps/application/component/image/image_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:flutter/material.dart';

class ListTileView extends StatelessWidget {
  final String title;
  final VoidCallback? onPressed;
  final Widget? prefixIcon, suffixIcon;
  final Color? colorTitle;
  const ListTileView(
      {Key? key,
      required this.title,
      this.onPressed,
      this.prefixIcon,
      this.suffixIcon,
      this.colorTitle})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: SizeConfig.width,
      padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0),
      margin: const EdgeInsets.symmetric(vertical: 16.0),
      decoration: BoxDecoration(
        color: ColorPalette.blue50,
        borderRadius: BorderRadius.circular(10),
        border: Border.all(
          color: ColorPalette.greyLights,
          width: 1,
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          prefixIcon ??
              const ImageView(
                image: PathAssets.iconChecklistOutlined,
                width: 38,
                height: 38,
              ),
          const SizedBox(
            width: 16,
          ),
          Expanded(
            child: Text(
              title,
              style: TextStyle(
                fontWeight: FontWeight.w600,
                color: colorTitle ?? ColorPalette.slate500,
              ),
            ),
          ),
          suffixIcon != null
              ? IconButton(
                  onPressed: onPressed,
                  icon: const Icon(
                    Icons.arrow_forward_ios,
                    color: ColorPalette.primary,
                    size: 20,
                  ),
                )
              : const SizedBox(),
        ],
      ),
    );
  }
}
