downloadingOrUploadingView function

dynamic downloadingOrUploadingView(
  1. String messageType,
  2. int progress,
  3. bool isSentByMe
)

Implementation

downloadingOrUploadingView(String messageType, int progress, bool isSentByMe) {
  debugPrint('downloadingOrUploadingView progress $progress');
  if (messageType == Constants.mAudio || messageType == Constants.mDocument) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 8.0),
      child: Container(
          width: 24,
          height: 24,
          decoration: BoxDecoration(
            border: Border.all(
              color: isSentByMe
                  ? MirrorflyUikit
                      .getTheme!.chatBubblePrimaryColor.textPrimaryColor
                  : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor
                      .textPrimaryColor, //borderColor,
            ),
            borderRadius: const BorderRadius.all(Radius.circular(3)),
            // color: Colors.black45,
          ),
          child: Stack(
              alignment: Alignment.center,
              // mainAxisAlignment: MainAxisAlignment.center,
              children: [
                SvgPicture.asset(
                  package: package,
                  downloading,
                  fit: BoxFit.contain,
                  colorFilter: ColorFilter.mode(
                      isSentByMe
                          ? MirrorflyUikit
                              .getTheme!.chatBubblePrimaryColor.textPrimaryColor
                          : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor
                              .textPrimaryColor,
                      BlendMode.srcIn), //playIconColor,
                ),
                Align(
                  alignment: Alignment.bottomCenter,
                  child: SizedBox(
                    height: 1,
                    child: LinearProgressIndicator(
                      valueColor: AlwaysStoppedAnimation<Color>(
                        isSentByMe
                            ? MirrorflyUikit.getTheme!.chatBubblePrimaryColor
                                .textPrimaryColor
                            : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor
                                .textPrimaryColor,
                      ),
                      value: progress == 0 || progress == 100
                          ? null
                          : (progress / 100),
                      backgroundColor: Colors.transparent,
                      // minHeight: 1,
                    ),
                  ),
                ),
              ])),
    );
  } else {
    return Container(
        height: 30,
        width: 80,
        decoration: BoxDecoration(
          border: Border.all(
            color: isSentByMe
                ? MirrorflyUikit
                    .getTheme!.chatBubblePrimaryColor.textSecondaryColor
                : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor
                    .textSecondaryColor, //textColor,
          ),
          borderRadius: const BorderRadius.all(Radius.circular(4)),
          color: isSentByMe
              ? MirrorflyUikit.getTheme!.chatBubblePrimaryColor.color
                  .withOpacity(0.2)
              : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor.color
                  .withOpacity(0.2), //Colors.black45,
        ),
        child: Stack(
            alignment: Alignment.center,
            // mainAxisAlignment: MainAxisAlignment.center,
            children: [
              SvgPicture.asset(
                package: package,
                downloading,
                fit: BoxFit.contain,
                colorFilter: ColorFilter.mode(
                    isSentByMe
                        ? MirrorflyUikit
                            .getTheme!.chatBubblePrimaryColor.textPrimaryColor
                        : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor
                            .textPrimaryColor,
                    BlendMode.srcIn),
              ),
              Align(
                alignment: Alignment.bottomCenter,
                child: SizedBox(
                  height: 2,
                  child: LinearProgressIndicator(
                    valueColor: AlwaysStoppedAnimation<Color>(
                      isSentByMe
                          ? MirrorflyUikit
                              .getTheme!.chatBubblePrimaryColor.textPrimaryColor
                          : MirrorflyUikit.getTheme!.chatBubbleSecondaryColor
                              .textPrimaryColor,
                    ),
                    value: progress == 0 || progress == 100
                        ? null
                        : (progress / 100),
                    backgroundColor: Colors.transparent,
                    // minHeight: 1,
                  ),
                ),
              ),
            ]));
  }
}