afgprogrammer/Flutter-file-select-upload

Show animation progress with Index in Listview builder

Closed this issue ยท 2 comments

Your example is working perfectly but I want to show progress in list view builder with loading controller.value for that index how can we do this.

my working code without animation

Map<int, double> fileDownloadProgress = {};

ListView.builder(
                   itemCount: doc.getDocument.length + 1,
                   physics: const BouncingScrollPhysics(),
                   shrinkWrap: true,
                   itemBuilder: (ctx, index) {
                     progress = downloadProgress[index];
                     if (index == 0) {
                       return InkWell(
                         onTap: () => _getUserSelfie(index),
                         child: DocumentsWidget(
                           fileName:
                               AppLocalizations.of(context)!.upload_selfie,
                           percentage: progress,
                         ),
                       );
                     } else {
                       fileProgress = fileDownloadProgress[index - 1];
                       return GestureDetector(
                         onTap: () => _showBottomFilePicker(index - 1, doc),
                         child: DocumentsWidget(
                           fileName: doc.docData[index - 1].name,
                           percentage: fileProgress,
                         ),
                       );
                     }
                   },
                 ),

on upload Image method

 var percentage = byteCount / totalByteLength * 100;
 loadingController.forward();
  setState(() {
          valuePercentage = percentage / 100;
      
          fileDownloadProgress[i] = valuePercentage;
        
          debugPrint('downloadProgress => ${fileDownloadProgress[i]}');
        });

I've Fixed the problem with simple solution ๐Ÿ˜€ ๐Ÿ˜…

Assign the animation controller value to fileProgress.

if (fileProgress != null) {
    fileProgress = loadingController.value;
}

I've Fixed the problem with simple solution ๐Ÿ˜€ ๐Ÿ˜…

Assign the animation controller value to fileProgress.

if (fileProgress != null) {
    fileProgress = loadingController.value;
}