Untitled

mail@pastecode.io avatar
unknown
dart
a year ago
2.3 kB
1
Indexable
Never
import 'package:centro/app/modules/Common/MeetingRequest/controller/meeting_request_controller.dart';
import 'package:centro/app/services/authentication/auth_manager.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';

import '../../../../utilities/constants/app_colors.dart';

class AttachmentsTile extends GetView<MeetingRequestController> {
  const AttachmentsTile({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Obx(() => ListView.builder(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemCount: controller.listOfAttachments.length,
          itemBuilder: (context, index) {
            return Container(
                margin: const EdgeInsets.symmetric(vertical: 8),
                decoration: BoxDecoration(
                  color: AppColors.white,
                  borderRadius: BorderRadius.circular(10),
                  border: Border.all(
                    color: AppColors.limeGreen,
                  ),
                ),
                child: ListTile(
                  trailing: IconButton(
                    icon: SvgPicture.asset('assets/icons/trash.svg'),
                    onPressed: () async {
                      await appTools.deleteDialog(context);
                      controller.listOfAttachments.removeAt(index);
                    },
                  ),
                  leading: SvgPicture.asset(controller.index.value == 0
                      ? 'assets/icons/PDF.svg'
                      : controller.index.value == 1
                          ? 'assets/icons/png.svg'
                          : controller.index.value == 2
                              ? 'assets/icons/mp3.svg'
                              : controller.index.value == 3
                                  ? 'assets/icons/anyFile.svg'
                                  : ''),
                  title: Text(
                    controller.listOfAttachments[index].path,
                    style: textTheme.headline6.copyWith(color: AppColors.black),
                  ),
                ));
          },
        ));
  }
}