singleFilePanel method

Widget singleFilePanel(
  1. BuildContext context,
  2. ValueNotifier<List<PlatformFile>> selectedFiles
)

Implementation

Widget singleFilePanel(
    BuildContext context, ValueNotifier<List<PlatformFile>> selectedFiles) {
  return Row(
    mainAxisAlignment: MainAxisAlignment.spaceAround,
    children: [
      Expanded(
        child: GestureDetector(
          onTap: () {
            showActionSheet(
                context: context,
                actions: buildSourceList(
                    selectedFiles: selectedFiles, context: context));
          },
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 10),
            child: Container(
              height: 40,
              padding: const EdgeInsets.all(8),
              decoration: BoxDecoration(
                  border: Border.all(color: outlineColor),
                  borderRadius: BorderRadius.circular(10)),
              child: Row(
                children: [
                  if (selectedFiles.value.isNotEmpty)
                    FilePickerLogic.buildIcon(selectedFiles.value.first,
                        selectedFiles.value.first.extension!, 25),
                  const SizedBox(width: 15),
                  if (selectedFiles.value.isNotEmpty)
                    Expanded(
                      child: Text(
                        selectedFiles.value.first.name,
                        // textAlign: TextAlign.center,
                        overflow: TextOverflow.ellipsis,
                        style: const TextStyle(height: 1.5),
                      ),
                    ),
                ],
              ),
            ),
          ),
        ),
      ),
      //here
      Row(
        children: [
          HMIconButton(
              icon: const Icon(Icons.file_upload_outlined),
              fillColor: Colors.blue,
              iconColor: Colors.white,
              buttonVariant: HMButtonVariant.filled,
              size: HMIconButtonSize.sm,
              onPressed: () async {
                showActionSheet(
                    context: context,
                    actions: buildSourceList(
                        selectedFiles: selectedFiles, context: context));
                // FilePickerLogic.pickFile(selectedFile, fileType);
              }),
          const SizedBox(width: 10),
          HMIconButton(
              icon: const Icon(Icons.close),
              buttonVariant: HMButtonVariant.filled,
              fillColor: Colors.blue,
              size: HMIconButtonSize.sm,
              iconColor: Colors.white,
              onPressed: () {
                if (selectedFiles.value.isNotEmpty) {
                  selectedFiles.value = [];
                }
              }),
          // const SizedBox(width: 20),
        ],
      )
    ],
  );
}