buildNoteList method

Widget buildNoteList(
  1. GenericUploadController controller
)

Implementation

Widget buildNoteList(GenericUploadController controller) {
  return Obx(
        () => controller.notes.isEmpty
        ? const NoDataFound()
        : ListView.separated(
      shrinkWrap: true,
      itemCount: controller.notes.length,
      itemBuilder: (context, index) {
        final note = controller.notes[index];
        return Container(
          padding: const EdgeInsets.all(10),
          decoration: BoxDecoration(
            border: Border.all(color: Colors.grey, width: 0.5),
            borderRadius: BorderRadius.circular(8),
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            spacing: 5,
            children: [
              AppText(
                note.funRefVal?.trim() ?? '',
                style: TextStyles.normalBold(Get.context!),
                maxLines: 5,
                softWrap: true,
              ),
              AppText(
                '${note.createdOn != null ? note.createdOn.toString() : AppDateUtils.toDayMonthYear(DateTime.now())}  ${note.userDisplayName != null ? note.userDisplayName?.trim() : '(ME)'}',
                style: TextStyles.normal(Get.context!),
                maxLines: 5,
                softWrap: true,
              ),
              !controller.isViewScreen.value
                  ? Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Row(
                    spacing: 5,
                    children: [
                      actionButton(
                          icon: Icons.delete,
                          onTap: () =>
                              controller.deleteNote(note),
                          color: Colors.red),
                      actionButton(
                        icon: Icons.edit,
                        onTap: () => controller.editNote(note),
                      ),
                    ],
                  ),
                ],
              )
                  : const SizedBox.shrink(),
            ],
          ),
        );
      },
      separatorBuilder: (context, index) => const SizedBox(height: 10),
    ),
  );
}