import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';

class AttachmentsFragment extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: double.infinity,
      child: ListView.separated(
        itemCount: 2,
        padding: EdgeInsets.all(21),
        itemBuilder: (context, index) {
          return showItem(attachmentsList[index]);
        },
        separatorBuilder: (BuildContext context, int index) {
          return 21.height;
        },
      ),
    );
  }

  Widget showItem(Attachments attachments) {
    return Container(
      width: double.infinity,
      padding: EdgeInsets.all(21),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(15),
        boxShadow: [
          BoxShadow(
            color: const Color(0xff000000).withOpacity(.05),
            blurRadius: 26,
            offset: const Offset(0, -3),
          ),
        ],
      ),
      child: Row(
        children: [
          SvgPicture.asset(attachments.icon),
          12.width,
          attachments.title.toText16()
        ],
      ),
    );
  }
}

class Attachments {
  String title;
  String icon;

  Attachments(this.title, this.icon);
}

List<Attachments> attachmentsList = [
  Attachments("Attachment File Name.png", "assets/images/png.svg"),
  Attachments("Attachment File Name.pdf", "assets/images/pdf.svg"),
];
