downloadingOrUploadingView function

dynamic downloadingOrUploadingView(
  1. String messageType,
  2. int progress,
  3. DownloadUploadViewStyle downloadUploadViewStyle
)

Implementation

downloadingOrUploadingView(String messageType, int progress,
    DownloadUploadViewStyle downloadUploadViewStyle) {
  debugPrint('downloadingOrUploadingView progress $progress');
  if (messageType == MessageType.audio.value ||
      messageType == MessageType.document.value) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 8.0),
      child: Container(
          width: 30,
          height: 30,
          decoration: downloadUploadViewStyle.decoration,
          /*decoration: BoxDecoration(
            border: Border.all(
              color: borderColor,
            ),
            borderRadius: const BorderRadius.all(Radius.circular(3)),
            // color: Colors.black45,
          ),*/
          child: Stack(
              alignment: Alignment.center,
              // mainAxisAlignment: MainAxisAlignment.center,
              children: [
                AppUtils.svgIcon(
                  icon: downloading,
                  fit: BoxFit.contain,
                  colorFilter: ColorFilter.mode(
                      downloadUploadViewStyle.iconStyle.iconColor,
                      BlendMode.srcIn),
                  // colorFilter: const ColorFilter.mode(playIconColor, BlendMode.srcIn),
                ),
                Align(
                  alignment: Alignment.bottomCenter,
                  child: SizedBox(
                    height: 2,
                    child: ProgressIndicatorTheme(
                      data: downloadUploadViewStyle.progressIndicatorThemeData,
                      child: LinearProgressIndicator(
                        valueColor: const AlwaysStoppedAnimation<Color>(
                          progressColor,
                        ),
                        value: progress == 0 || progress == 100
                            ? null
                            : (progress / 100),
                        // minHeight: 1,
                      ),
                    ),
                  ),
                ),
              ])),
    );
  } else {
    return Container(
        height: 35,
        width: 80,
        decoration: downloadUploadViewStyle.decoration,
        /*decoration: const BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(4)),
          color: Colors.black45,
        ),*/
        child: Stack(
            alignment: Alignment.center,
            // mainAxisAlignment: MainAxisAlignment.center,
            children: [
              AppUtils.svgIcon(
                icon: downloading,
                fit: BoxFit.contain,
                colorFilter: ColorFilter.mode(
                    downloadUploadViewStyle.iconStyle.iconColor,
                    BlendMode.srcIn),
              ),
              Align(
                alignment: Alignment.bottomCenter,
                child: SizedBox(
                  height: 2,
                  child: ProgressIndicatorTheme(
                    data: downloadUploadViewStyle.progressIndicatorThemeData,
                    child: LinearProgressIndicator(
                      valueColor: const AlwaysStoppedAnimation<Color>(
                        Colors.white,
                      ),
                      value: progress == 0 || progress == 100
                          ? null
                          : (progress / 100),
                      // minHeight: 1,
                    ),
                  ),
                ),
              ),
            ]));
  }
}