getSlideDetails static method

List<Widget> getSlideDetails(
  1. GetSlideParam params
)

Function for getting slide details

Implementation

static List<Widget> getSlideDetails(GetSlideParam params) {
  List<Widget> tempSlide = [];
  List<Widget> tempShapes = [];
  List<Widget> slideWidget = [];
  double maxWidth = 600;
  double maxHeight = 450;
  double divisionFactor = 12700;
  if (params.slide.slideLayout != null) {
    for (int j = 0; j < params.slide.slideLayout!.components.length; j++) {
      Map<String, double> maxWidthHeight = {"maxWidth": maxWidth, "maxHeight": maxHeight};
      switch (params.slide.slideLayout!.components[j].runtimeType.toString()) {
        case "PresentationPresetShapes":
          List<Widget> tempGetShapes = showPresetShape(
              params.slide.slideLayout!.components[j], params.slide.clearMap, params.slide.colorSchemes, divisionFactor, maxWidthHeight);
          tempShapes.addAll(tempGetShapes);
          break;
        case "PresentationCustomDiagram":
          List<Widget> tempGetCustomDiagrams = showCustomDiagram(
              params.slide.slideLayout!.components[j], params.slide.clearMap, params.slide.colorSchemes, divisionFactor, maxWidthHeight);
          tempShapes.addAll(tempGetCustomDiagrams);
          break;
        case "PresentationTextBox":
          List<Widget> tempGetTextBoxes = showTextBox(params.slide.slideLayout!.components[j], divisionFactor, maxWidthHeight,
              params.slide.slideLayout, params.slide.clearMap, params.slide.colorSchemes);
          tempShapes.addAll(tempGetTextBoxes);
          break;
      }
      maxWidth = maxWidthHeight["maxWidth"]!;
      maxHeight = maxWidthHeight["maxHeight"]!;
    }
    /*for (int j = 0; j < params.slide.slideLayout!.presetShapes.length; j++) {
      if (params.slide.slideLayout!.presetShapes[j].type == "roundRect") {
        String color = "0xff000000";
        if (params.slide.slideLayout!.presetShapes[j].fillColorScheme.isNotEmpty) {
          String clrSchemeVal = params.slide.slideLayout!.presetShapes[j].fillColorScheme;
          if (params.slide.clearMap[clrSchemeVal] != null) {
            clrSchemeVal = params.slide.clearMap[clrSchemeVal]!;
          }
          var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
            //print(clrSch.name);
            return clrSch.name == clrSchemeVal;
          });
          if (clrScheme != null) {
            if (clrScheme.sysClrLast.isNotEmpty) {
              color = "0xff${clrScheme.sysClrLast}";
            } else if (clrScheme.srgbClr.isNotEmpty) {
              color = "0xff${clrScheme.srgbClr}";
            }
          }
        }
        Color adjustedColor=Color(int.parse(color));
        if(params.slide.slideLayout!.presetShapes[j].lumMod!=null||params.slide.slideLayout!.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.slideLayout!.presetShapes[j].lumMod,params.slide.slideLayout!.presetShapes[j].lumOff);
        }
        double borderRadius = 0;
        if (params.slide.slideLayout!.presetShapes[j].adjValue.isNotEmpty) {
          String tempBorderRadius = params.slide.slideLayout!.presetShapes[j].adjValue.replaceAll("val ", "");
          borderRadius = double.parse(tempBorderRadius) / 1000;
          //print(borderRadius);
        }
        if (params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].width / divisionFactor >
            maxWidth) {
          maxWidth = params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].width / divisionFactor;
        }
        if (params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].height / divisionFactor >
            maxHeight) {
          maxHeight = params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].height / divisionFactor;
        }
        tempShapes.add(Positioned(
            top: params.slide.slideLayout!.presetShapes[j].top != 0 ? params.slide.slideLayout!.presetShapes[j].top / divisionFactor : 0,
            left: params.slide.slideLayout!.presetShapes[j].left != 0 ? params.slide.slideLayout!.presetShapes[j].left / divisionFactor : 0,
            child: Container(
              width: params.slide.slideLayout!.presetShapes[j].width / (divisionFactor),
              height: params.slide.slideLayout!.presetShapes[j].height / divisionFactor,
              decoration: BoxDecoration(color: adjustedColor, borderRadius: BorderRadius.circular(borderRadius.toDouble())),
            )));
      }else if (params.slide.slideLayout!.presetShapes[j].type == "rect") {
        String color = "";
        if (params.slide.slideLayout!.presetShapes[j].fillColorScheme.isNotEmpty) {
          String clrSchemeVal = params.slide.slideLayout!.presetShapes[j].fillColorScheme;
          if (params.slide.clearMap[clrSchemeVal] != null) {
            clrSchemeVal = params.slide.clearMap[clrSchemeVal]!;
          }
          var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
            //print(clrSch.name);
            return clrSch.name == clrSchemeVal;
          });
          if (clrScheme != null) {
            if (clrScheme.sysClrLast.isNotEmpty) {
              color = "0xff${clrScheme.sysClrLast}";
            } else if (clrScheme.srgbClr.isNotEmpty) {
              color = "0xff${clrScheme.srgbClr}";
            }
          }
        }
        Color adjustedColor=Colors.transparent;
        print("slidelayout preset diagrams rect");
        print(params.slide.fileName);
        print(color);
        if(color.isNotEmpty){
          adjustedColor=Color(int.parse(color));
          print(adjustedColor.value.toRadixString(16));
          if(params.slide.slideLayout!.presetShapes[j].lumMod!=null||params.slide.slideLayout!.presetShapes[j].lumOff!=null){
            print(params.slide.slideLayout!.presetShapes[j].lumMod);
            print(params.slide.slideLayout!.presetShapes[j].lumOff);
            adjustedColor=modifyColor(adjustedColor,params.slide.slideLayout!.presetShapes[j].lumMod,params.slide.slideLayout!.presetShapes[j].lumOff);
          }
        }
        print(adjustedColor.value.toRadixString(16));
        if (params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].width / divisionFactor >
            maxWidth) {
          maxWidth = params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].width / divisionFactor;
        }
        if (params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].height / divisionFactor >
            maxHeight) {
          maxHeight = params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].height / divisionFactor;
        }

        tempShapes.add(Positioned(
            top: params.slide.slideLayout!.presetShapes[j].top != 0 ? params.slide.slideLayout!.presetShapes[j].top / divisionFactor : 0,
            left: params.slide.slideLayout!.presetShapes[j].left != 0 ? params.slide.slideLayout!.presetShapes[j].left / divisionFactor : 0,
            child: Container(
              width: params.slide.slideLayout!.presetShapes[j].width / (divisionFactor),
              height: params.slide.slideLayout!.presetShapes[j].height / divisionFactor,
              decoration: BoxDecoration(color: color.isNotEmpty?adjustedColor:Colors.transparent, ),
            )));
      }else if (params.slide.slideLayout!.presetShapes[j].type == "round2SameRect") {
        String color = "0xff000000";
        if (params.slide.slideLayout!.presetShapes[j].fillColorScheme.isNotEmpty) {
          String clrSchemeVal = params.slide.slideLayout!.presetShapes[j].fillColorScheme;
          if (params.slide.clearMap[clrSchemeVal] != null) {
            clrSchemeVal = params.slide.clearMap[clrSchemeVal]!;
          }
          var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
            //print(clrSch.name);
            return clrSch.name == clrSchemeVal;
          });
          if (clrScheme != null) {
            if (clrScheme.sysClrLast.isNotEmpty) {
              color = "0xff${clrScheme.sysClrLast}";
            } else if (clrScheme.srgbClr.isNotEmpty) {
              color = "0xff${clrScheme.srgbClr}";
            }
          }
        }
        Color adjustedColor=Color(int.parse(color));
        if(params.slide.slideLayout!.presetShapes[j].lumMod!=null||params.slide.slideLayout!.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.slideLayout!.presetShapes[j].lumMod,params.slide.slideLayout!.presetShapes[j].lumOff);
        }
        double borderRadius = 0;
        if (params.slide.slideLayout!.presetShapes[j].adjValue.isNotEmpty) {
          String tempBorderRadius = params.slide.slideLayout!.presetShapes[j].adjValue.replaceAll("val ", "");
          borderRadius = double.parse(tempBorderRadius) / 1000;
          //print(borderRadius);
        }
        if (params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].width / divisionFactor >
            maxWidth) {
          maxWidth = params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].width / divisionFactor;
        }
        if (params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].height / divisionFactor >
            maxHeight) {
          maxHeight = params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].height / divisionFactor;
        }
        tempShapes.add(Positioned(
            top: params.slide.slideLayout!.presetShapes[j].top != 0 ? params.slide.slideLayout!.presetShapes[j].top / divisionFactor : 0,
            left: params.slide.slideLayout!.presetShapes[j].left != 0 ? params.slide.slideLayout!.presetShapes[j].left / divisionFactor : 0,
            child: Container(
              width: params.slide.slideLayout!.presetShapes[j].width / (divisionFactor),
              height: params.slide.slideLayout!.presetShapes[j].height / divisionFactor,
              decoration: BoxDecoration(color: adjustedColor, borderRadius: BorderRadius.only(topRight: Radius.circular(borderRadius.toDouble()),topLeft: Radius.circular(borderRadius))),
            )));
      }else if (params.slide.slideLayout!.presetShapes[j].type == "ellipse") {
        String color = "0xff000000";
        if (params.slide.slideLayout!.presetShapes[j].fillColorScheme.isNotEmpty) {
          String clrSchemeVal = params.slide.slideLayout!.presetShapes[j].fillColorScheme;
          if (params.slide.clearMap[clrSchemeVal] != null) {
            clrSchemeVal = params.slide.clearMap[clrSchemeVal]!;
          }
          var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
            //print(clrSch.name);
            return clrSch.name == clrSchemeVal;
          });
          if (clrScheme != null) {
            if (clrScheme.sysClrLast.isNotEmpty) {
              color = "0xff${clrScheme.sysClrLast}";
            } else if (clrScheme.srgbClr.isNotEmpty) {
              color = "0xff${clrScheme.srgbClr}";
            }
          }
        }
        Color adjustedColor=Color(int.parse(color));
        if(params.slide.slideLayout!.presetShapes[j].lumMod!=null||params.slide.slideLayout!.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.slideLayout!.presetShapes[j].lumMod,params.slide.slideLayout!.presetShapes[j].lumOff);
        }

        if (params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].width / divisionFactor >
            maxWidth) {
          maxWidth = params.slide.slideLayout!.presetShapes[j].left / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].width / divisionFactor;
        }
        if (params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
            params.slide.slideLayout!.presetShapes[j].height / divisionFactor >
            maxHeight) {
          maxHeight = params.slide.slideLayout!.presetShapes[j].top / divisionFactor +
              params.slide.slideLayout!.presetShapes[j].height / divisionFactor;
        }
        tempShapes.add(Positioned(
            top: params.slide.slideLayout!.presetShapes[j].top != 0 ? params.slide.slideLayout!.presetShapes[j].top / divisionFactor : 0,
            left: params.slide.slideLayout!.presetShapes[j].left != 0 ? params.slide.slideLayout!.presetShapes[j].left / divisionFactor : 0,
            child: Container(
              width: params.slide.slideLayout!.presetShapes[j].width / (divisionFactor),
              height: params.slide.slideLayout!.presetShapes[j].height / divisionFactor,
              decoration: BoxDecoration(color: adjustedColor, shape: BoxShape.circle,),
            )));
      }
    }

    for(int j=0;j<params.slide.slideLayout!.customDiagrams.length;j++){

      String clrSchemeVal=params.slide.slideLayout!.customDiagrams[j].clrScheme??"";
      String color="";
      if(params.slide.slideLayout!.customDiagrams[j].srgbClr!.isNotEmpty) {
        color="0xff${params.slide.slideLayout!.customDiagrams[j].srgbClr}";
      }else{
        if (params.slide.clearMap[clrSchemeVal] != null) {
          clrSchemeVal = params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if (clrScheme != null) {
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }
      Color adjustedColor=Colors.transparent;
      if(color.isNotEmpty){
        adjustedColor=Color(int.parse(color));
        if(params.slide.slideLayout!.customDiagrams[j].lumMod!=null||params.slide.slideLayout!.customDiagrams[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.slideLayout!.customDiagrams[j].lumMod,params.slide.slideLayout!.customDiagrams[j].lumOff);
        }
      }
      double rotate=0;
      if(params.slide.slideLayout!.customDiagrams[j].rotate!=null){
        rotate=params.slide.slideLayout!.customDiagrams[j].rotate!*pi/180;

      }

      if (params.slide.slideLayout!.customDiagrams[j].x / divisionFactor +
          params.slide.slideLayout!.customDiagrams[j].width / divisionFactor >
          maxWidth) {
        maxWidth = params.slide.slideLayout!.customDiagrams[j].x / divisionFactor +
            params.slide.slideLayout!.customDiagrams[j].width / divisionFactor;
      }
      if (params.slide.slideLayout!.customDiagrams[j].y / divisionFactor +
          params.slide.slideLayout!.customDiagrams[j].height / divisionFactor >
          maxHeight) {
        maxHeight = params.slide.slideLayout!.customDiagrams[j].y / divisionFactor +
            params.slide.slideLayout!.customDiagrams[j].height / divisionFactor;
      }
      tempShapes.add(Positioned(
          top: params.slide.slideLayout!.customDiagrams[j].y!=0?params.slide.slideLayout!.customDiagrams[j].y/divisionFactor:0,
          left: params.slide.slideLayout!.customDiagrams[j].x!=0?params.slide.slideLayout!.customDiagrams[j].x/divisionFactor:0,
          child: Container(
              width: params.slide.slideLayout!.customDiagrams[j].width.toDouble()/divisionFactor,
              height: params.slide.slideLayout!.customDiagrams[j].height.toDouble()/divisionFactor,
              child: Transform.rotate(
                  angle: rotate,
                  child: CustomPaint(child: Container(), painter: CustomDiagram(params.slide.slideLayout!.customDiagrams[j],divisionFactor.toDouble(),adjustedColor))))));
    }*/
  }
  for (int j = 0; j < params.slide.components.length; j++) {
    Map<String, double> maxWidthHeight = {"maxWidth": maxWidth, "maxHeight": maxHeight};
    switch (params.slide.components[j].runtimeType.toString()) {
      case "PresentationPresetShapes":
        print(params.slide.fileName);
        List<Widget> tempGetShapes =
            showPresetShape(params.slide.components[j], params.slide.clearMap, params.slide.colorSchemes, divisionFactor, maxWidthHeight);
        tempShapes.addAll(tempGetShapes);
        break;
      case "PresentationCustomDiagram":
        List<Widget> tempGetCustomDiagrams =
            showCustomDiagram(params.slide.components[j], params.slide.clearMap, params.slide.colorSchemes, divisionFactor, maxWidthHeight);
        tempShapes.addAll(tempGetCustomDiagrams);
        break;
      case "PresentationTextBox":
        List<Widget> tempGetTextBoxes = showTextBox(
            params.slide.components[j], divisionFactor, maxWidthHeight, params.slide.slideLayout, params.slide.clearMap, params.slide.colorSchemes);
        tempShapes.addAll(tempGetTextBoxes);
        break;
    }
    maxWidth = maxWidthHeight["maxWidth"]!;
    maxHeight = maxWidthHeight["maxHeight"]!;
  }
  /*for(int j=0;j<params.slide.presetShapes.length;j++){
    if(params.slide.presetShapes[j].type=="roundRect") {
      String color="0xff000000";
      if(params.slide.presetShapes[j].fillColorScheme.isNotEmpty) {
        String clrSchemeVal=params.slide.presetShapes[j].fillColorScheme;
        if(params.slide.clearMap[clrSchemeVal]!=null){
          clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if(clrScheme!=null){
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }

        Color adjustedColor=Color(int.parse(color));
        if(params.slide.presetShapes[j].lumMod!=null||params.slide.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.presetShapes[j].lumMod,params.slide.presetShapes[j].lumOff);
        }

      double borderRadius=0;
      if(params.slide.presetShapes[j].adjValue.isNotEmpty){
        String tempBorderRadius=params.slide.presetShapes[j].adjValue.replaceAll("val ", "");
        borderRadius=double.parse(tempBorderRadius)/1000;
        //print(borderRadius);
      }
      tempShapes.add(Positioned(
          top: params.slide.presetShapes[j].top != 0 ? params.slide.presetShapes[j].top / divisionFactor : 0,
          left: params.slide.presetShapes[j].left != 0 ? params.slide.presetShapes[j].left / divisionFactor : 0,
          child: Container(
            width: params.slide.presetShapes[j].width/(divisionFactor),
            height: params.slide.presetShapes[j].height/divisionFactor,
            decoration: BoxDecoration(color: adjustedColor,borderRadius: BorderRadius.circular(borderRadius.toDouble())),
          )));
    }else if(params.slide.presetShapes[j].type=="rect") {
      String color="";
      if(params.slide.presetShapes[j].fillColorScheme.isNotEmpty) {
        String clrSchemeVal=params.slide.presetShapes[j].fillColorScheme;
        if(params.slide.clearMap[clrSchemeVal]!=null){
          clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if(clrScheme!=null){
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }
      Color adjustedColor=Colors.transparent;
      if(color.isNotEmpty){
        adjustedColor=Color(int.parse(color));
        if(params.slide.presetShapes[j].lumMod!=null||params.slide.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.presetShapes[j].lumMod,params.slide.presetShapes[j].lumOff);
        }
      }
      tempShapes.add(Positioned(
          top: params.slide.presetShapes[j].top != 0 ? params.slide.presetShapes[j].top / divisionFactor : 0,
          left: params.slide.presetShapes[j].left != 0 ? params.slide.presetShapes[j].left / divisionFactor : 0,
          child: Container(
            width: params.slide.presetShapes[j].width/(divisionFactor),
            height: params.slide.presetShapes[j].height/divisionFactor,
            decoration: BoxDecoration(color: color.isNotEmpty?adjustedColor:Colors.transparent,),
          )));
    }else if(params.slide.presetShapes[j].type=="blockArc"){
      String color="";
      if(params.slide.presetShapes[j].fillColorScheme.isNotEmpty) {
        String clrSchemeVal=params.slide.presetShapes[j].fillColorScheme;
        if(params.slide.clearMap[clrSchemeVal]!=null){
          clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if(clrScheme!=null){
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }
      Color adjustedColor=Colors.transparent;
      if(color.isNotEmpty){
        adjustedColor=Color(int.parse(color));
        if(params.slide.presetShapes[j].lumMod!=null||params.slide.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.presetShapes[j].lumMod,params.slide.presetShapes[j].lumOff);
        }
      }
      double rotate=0;
      if(params.slide.presetShapes[j].rotate!=null){
        rotate=params.slide.presetShapes[j].rotate!*pi/180;

      }
      tempShapes.add(Positioned(
          top: params.slide.presetShapes[j].top!=0?params.slide.presetShapes[j].top/divisionFactor:0,
          left: params.slide.presetShapes[j].left!=0?params.slide.presetShapes[j].left/divisionFactor:0,
          child: Transform.rotate(
            angle: rotate,
            child: Container(
                width: params.slide.presetShapes[j].width.toDouble()/divisionFactor,
                height: params.slide.presetShapes[j].height.toDouble()/divisionFactor,
                child: CustomPaint(child: Container(), painter: PresetDiagram(params.slide.presetShapes[j],divisionFactor.toDouble(),adjustedColor))),
          )));
    }else if(params.slide.presetShapes[j].type=="round2SameRect") {
      String color="0xff000000";
      if(params.slide.presetShapes[j].fillColorScheme.isNotEmpty) {
        String clrSchemeVal=params.slide.presetShapes[j].fillColorScheme;
        if(params.slide.clearMap[clrSchemeVal]!=null){
          clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if(clrScheme!=null){
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }
      Color adjustedColor=Colors.transparent;
      if(color.isNotEmpty){
        adjustedColor=Color(int.parse(color));
        if(params.slide.presetShapes[j].lumMod!=null||params.slide.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.presetShapes[j].lumMod,params.slide.presetShapes[j].lumOff);
        }
      }
      double borderRadius=0;
      if(params.slide.presetShapes[j].adjValue.isNotEmpty){
        String tempBorderRadius=params.slide.presetShapes[j].adjValue.replaceAll("val ", "");
        borderRadius=double.parse(tempBorderRadius)/1000;
        //print(borderRadius);
      }
      tempShapes.add(Positioned(
          top: params.slide.presetShapes[j].top != 0 ? params.slide.presetShapes[j].top / divisionFactor : 0,
          left: params.slide.presetShapes[j].left != 0 ? params.slide.presetShapes[j].left / divisionFactor : 0,
          child: Container(
            width: params.slide.presetShapes[j].width/(divisionFactor),
            height: params.slide.presetShapes[j].height/divisionFactor,
            decoration: BoxDecoration(color: adjustedColor,borderRadius: BorderRadius.only(topLeft: Radius.circular(borderRadius.toDouble()),topRight: Radius.circular(borderRadius))),
          )));
    }else if(params.slide.presetShapes[j].type=="parallelogram"){
      String color="";
      if(params.slide.presetShapes[j].fillColorScheme.isNotEmpty) {
        String clrSchemeVal=params.slide.presetShapes[j].fillColorScheme;
        if(params.slide.clearMap[clrSchemeVal]!=null){
          clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if(clrScheme!=null){
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }
      Color adjustedColor=Colors.transparent;
      if(color.isNotEmpty){
        adjustedColor=Color(int.parse(color));
        if(params.slide.presetShapes[j].lumMod!=null||params.slide.presetShapes[j].lumOff!=null){
          adjustedColor=modifyColor(adjustedColor,params.slide.presetShapes[j].lumMod,params.slide.presetShapes[j].lumOff);
        }
      }
      double rotate=0;
      if(params.slide.presetShapes[j].rotate!=null){
        rotate=params.slide.presetShapes[j].rotate!*pi/180;

      }
      tempShapes.add(Positioned(
          top: params.slide.presetShapes[j].top!=0?params.slide.presetShapes[j].top/divisionFactor:0,
          left: params.slide.presetShapes[j].left!=0?params.slide.presetShapes[j].left/divisionFactor:0,
          child: Transform.rotate(
            angle: rotate,
            child: Container(
                width: params.slide.presetShapes[j].width.toDouble()/divisionFactor,
                height: params.slide.presetShapes[j].height.toDouble()/divisionFactor,
                child: CustomPaint(child: Container(), painter: PresetParallelogram(int.parse(params.slide.presetShapes[j].adjValue.replaceAll("val ", "")),adjustedColor,divisionFactor))),
          )));
    }else if(params.slide.presetShapes[j].type=="ellipse") {
      String color="0xff000000";
      if(params.slide.presetShapes[j].fillColorScheme.isNotEmpty) {
        String clrSchemeVal=params.slide.presetShapes[j].fillColorScheme;
        if(params.slide.clearMap[clrSchemeVal]!=null){
          clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
        }
        var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
          //print(clrSch.name);
          return clrSch.name == clrSchemeVal;
        });
        if(clrScheme!=null){
          if (clrScheme.sysClrLast.isNotEmpty) {
            color = "0xff${clrScheme.sysClrLast}";
          } else if (clrScheme.srgbClr.isNotEmpty) {
            color = "0xff${clrScheme.srgbClr}";
          }
        }
      }

      Color adjustedColor=Color(int.parse(color));
      if(params.slide.presetShapes[j].lumMod!=null||params.slide.presetShapes[j].lumOff!=null){
        adjustedColor=modifyColor(adjustedColor,params.slide.presetShapes[j].lumMod,params.slide.presetShapes[j].lumOff);
      }
      print(params.slide.fileName);
      print(params.slide.presetShapes[j].top/divisionFactor);
      print(params.slide.presetShapes[j].left/divisionFactor);
      tempShapes.add(Positioned(
          top: params.slide.presetShapes[j].top != 0 ? params.slide.presetShapes[j].top / divisionFactor : 0,
          left: params.slide.presetShapes[j].left != 0 ? params.slide.presetShapes[j].left / divisionFactor : 0,
          child: Container(
            width: params.slide.presetShapes[j].width/(divisionFactor),
            height: params.slide.presetShapes[j].height/divisionFactor,
            decoration: BoxDecoration(color: adjustedColor,shape: BoxShape.circle),
          )));
    }
  }
  for (int j = 0; j < params.slide.presentationTextBoxes.length; j++) {
    if (params.slide.presentationTextBoxes[j].offset.dx / divisionFactor +
        params.slide.presentationTextBoxes[j].size.width / divisionFactor >
        maxWidth) {
      maxWidth = params.slide.presentationTextBoxes[j].offset.dx / divisionFactor +
          params.slide.presentationTextBoxes[j].size.width / divisionFactor;
    }
    if (params.slide.presentationTextBoxes[j].offset.dy / divisionFactor +
        params.slide.presentationTextBoxes[j].size.height / divisionFactor >
        maxHeight) {
      maxHeight = params.slide.presentationTextBoxes[j].offset.dy / divisionFactor +
          params.slide.presentationTextBoxes[j].size.height / divisionFactor;
    }
    List<Widget> textBoxTexts = [];
    String align="";
    String paraColorScheme="";
    String paraLumMod="";
    String paraLumOff="";
    double paraFontSize=0;
    double paraX=0;
    double paraY=0;
    int paraWidth=0;
    int paraHeight=0;
    for (int k = 0;
        k < params.slide.presentationTextBoxes[j].presentationParas.length;
        k++) {
      List<TextSpan> textSpans = [];
      if(params.slide.presentationTextBoxes[j].presentationParas[k].align!=null){
        align=params.slide.presentationTextBoxes[j].presentationParas[k].align!;
      }
      if(params.slide.presentationTextBoxes[j].presentationParas[k].type!=null&&params.slide.presentationTextBoxes[j].presentationParas[k].idx!=null){
        var paraDetails=params.slide.slideLayout?.paragraphs.firstWhereOrNull((para){
          return para.type==params.slide.presentationTextBoxes[j].presentationParas[k].type&&para.idx==params.slide.presentationTextBoxes[j].presentationParas[k].idx;
        });
        if(paraDetails!=null){
          align=paraDetails.anchor;
          paraColorScheme=paraDetails.schemeClr;
          paraFontSize=paraDetails.defaultSz/180;
          paraX=paraDetails.x??0;
          paraY=paraDetails.y??0;
          paraWidth=paraDetails.width??0;
          paraHeight=paraDetails.height??0;
          if(paraDetails.lumOff!=null){
            paraLumOff=paraDetails.lumOff!;
          }
          if(paraDetails.lumMod!=null){
            paraLumMod=paraDetails.lumMod!;
          }
        }
      }
      for (int l = 0;
          l <
              params.slide.presentationTextBoxes[j].presentationParas[k].textSpans
                  .length;
          l++) {
        double fontSize=params.slide.presentationTextBoxes[j].presentationParas[k]
            .textSpans[l].fontSize;
        if(paraFontSize!=0){
          fontSize=paraFontSize.toDouble();
        }
        bool isBold=false;
        if(params.slide.presentationTextBoxes[j].presentationParas[k]
            .textSpans[l].isBold){
          isBold=true;
        }
        TextStyle textStyle=TextStyle(
            fontSize: fontSize,fontWeight: isBold?FontWeight.bold:FontWeight.normal,
            color: Colors.black);
        if(params.slide.presentationTextBoxes[j].presentationParas[k]
            .textSpans[l].colorScheme!=null||paraColorScheme.isNotEmpty){
          //print("---");
          //print(params.slide.presentationTextBoxes[j].presentationParas[k]
          //    .textSpans[l].colorScheme);
          String clrSchemeVal=params.slide.presentationTextBoxes[j].presentationParas[k]
              .textSpans[l].colorScheme??paraColorScheme;
          if(params.slide.clearMap[clrSchemeVal]!=null){
            clrSchemeVal=params.slide.clearMap[clrSchemeVal]!;
          }
          var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
            //print(clrSch.name);
            return clrSch.name == clrSchemeVal;
          });
          //print("----");

          if (clrScheme != null) {
            //print("---");
            //print(clrScheme.name);
            String color="";
            if (clrScheme.sysClrLast.isNotEmpty) {
              color = "0xff${clrScheme.sysClrLast}";
            } else if (clrScheme.srgbClr.isNotEmpty) {
              color = "0xff${clrScheme.srgbClr}";
            }
            Color adjustedColor=Colors.transparent;
            if(color.isNotEmpty){
              adjustedColor=Color(int.parse(color));
              if(params.slide.presentationTextBoxes[j].presentationParas[k].textSpans[l].lumMod!=null||params.slide.presentationTextBoxes[j].presentationParas[k].textSpans[l].lumOff!=null){
                adjustedColor=modifyColor(adjustedColor,params.slide.presentationTextBoxes[j].presentationParas[k].textSpans[l].lumMod,params.slide.presentationTextBoxes[j].presentationParas[k].textSpans[l].lumOff);
              }
            }
            //print(color);
            //textStyle=textStyle..copyWith(color: Color(int.parse(color)));
            textStyle=TextStyle(
                fontSize: fontSize,fontWeight: isBold?FontWeight.bold:FontWeight.normal,
                color: adjustedColor);
            //print(textStyle.color.toString());
          }

        }
        textSpans.add(TextSpan(
            text: params.slide.presentationTextBoxes[j].presentationParas[k]
                .textSpans[l].text,
            style: textStyle));
      }
      textBoxTexts.add(Expanded(child: RichText(text: TextSpan(children: textSpans),textAlign: TextAlign.start,)));
    }
    double offsetX=params.slide.presentationTextBoxes[j].offset.dx;
    double offsetY=params.slide.presentationTextBoxes[j].offset.dy;
    if(offsetX==0&&offsetY==0&&paraX!=0&&paraY!=0){
      offsetX=paraX;
      offsetY=paraY;
    }
    if (params.slide.presentationTextBoxes[j].size.height != 0 &&
        params.slide.presentationTextBoxes[j].size.width != 0) {
      tempShapes.add(Positioned(
          top:  offsetY/ divisionFactor,
          left: offsetX / divisionFactor,
          child: SizedBox(

            height:
            params.slide.presentationTextBoxes[j].size.height / divisionFactor,
            width: params.slide.presentationTextBoxes[j].size.width / divisionFactor,
            child: Column(
              crossAxisAlignment: align == "ctr" ? CrossAxisAlignment.center : CrossAxisAlignment.start,
              children: textBoxTexts,
            ),
          )));
    }else if(paraHeight!=0&&paraWidth!=0){
      tempShapes.add(Positioned(
          top:  offsetY/ divisionFactor,
          left: offsetX / divisionFactor,
          child: SizedBox(

            height:
            paraHeight / divisionFactor,
            width: paraWidth / divisionFactor,
            child: Column(
              crossAxisAlignment: align == "ctr" ? CrossAxisAlignment.center : CrossAxisAlignment.start,
              children: textBoxTexts,
            ),
          )));
    } else {
      tempShapes.add(Positioned(
          top: offsetY / divisionFactor,
          left: offsetX / divisionFactor,
          child: Column(
            crossAxisAlignment: align=="ctr"?CrossAxisAlignment.center:CrossAxisAlignment.start,
            children: textBoxTexts,
          )));
    }
  }
  for (int j = 0; j < params.slide.presentationShapes.length; j++) {
    if (params.slide.presentationShapes[j].offset.dx / divisionFactor +
        params.slide.presentationShapes[j].size.width / divisionFactor >
        maxWidth) {
      maxWidth = params.slide.presentationShapes[j].offset.dx / divisionFactor +
          params.slide.presentationShapes[j].size.width / divisionFactor;
    }
    if (params.slide.presentationShapes[j].offset.dy / divisionFactor +
        params.slide.presentationShapes[j].size.height / divisionFactor >
        maxHeight) {
      maxHeight = params.slide.presentationShapes[j].offset.dy / divisionFactor +
          params.slide.presentationShapes[j].size.height / divisionFactor;
    }
    tempShapes.add(Positioned(
        top: params.slide.presentationShapes[j].offset.dy / divisionFactor,
        left: params.slide.presentationShapes[j].offset.dx / divisionFactor,
        child: Container(
          decoration: BoxDecoration(border: Border.all(color: Colors.blue)),
          height: params.slide.presentationShapes[j].size.height / divisionFactor,
          width: params.slide.presentationShapes[j].size.width / divisionFactor,
          child: Center(
              child: Text(
                params.slide.presentationShapes[j].text,
          )),
        )));
  }
  for(int j=0;j<params.slide.presentationCustomDiagrams.length;j++){
    String clrSchemeVal=params.slide.presentationCustomDiagrams[j].clrScheme??"";
    String color="";
    if(params.slide.presentationCustomDiagrams[j].srgbClr!.isNotEmpty) {
      color="0xff${params.slide.presentationCustomDiagrams[j].srgbClr}";
    }else{
      if (params.slide.clearMap[clrSchemeVal] != null) {
        clrSchemeVal = params.slide.clearMap[clrSchemeVal]!;
      }
      var clrScheme = params.slide.colorSchemes.firstWhereOrNull((clrSch) {
        //print(clrSch.name);
        return clrSch.name == clrSchemeVal;
      });
      if (clrScheme != null) {
        if (clrScheme.sysClrLast.isNotEmpty) {
          color = "0xff${clrScheme.sysClrLast}";
        } else if (clrScheme.srgbClr.isNotEmpty) {
          color = "0xff${clrScheme.srgbClr}";
        }
      }
    }
    Color adjustedColor=Colors.transparent;
    if(color.isNotEmpty){
      adjustedColor=Color(int.parse(color));
      if(params.slide.presentationCustomDiagrams[j].lumMod!=null||params.slide.presentationCustomDiagrams[j].lumOff!=null){
        adjustedColor=modifyColor(adjustedColor,params.slide.presentationCustomDiagrams[j].lumMod,params.slide.presentationCustomDiagrams[j].lumOff);
      }
    }
    double rotate=0;
    if(params.slide.presentationCustomDiagrams[j].rotate!=null){
      rotate=params.slide.presentationCustomDiagrams[j].rotate!*pi/180;

    }
    tempShapes.add(Positioned(
        top: params.slide.presentationCustomDiagrams[j].y!=0?params.slide.presentationCustomDiagrams[j].y/divisionFactor:0,
        left: params.slide.presentationCustomDiagrams[j].x!=0?params.slide.presentationCustomDiagrams[j].x/divisionFactor:0,
        child: Container(
            width: params.slide.presentationCustomDiagrams[j].width.toDouble()/divisionFactor,
            height: params.slide.presentationCustomDiagrams[j].height.toDouble()/divisionFactor,
            child: Transform.rotate(
                angle: rotate,
                child: CustomPaint(child: Container(), painter: CustomDiagram(params.slide.presentationCustomDiagrams[j],divisionFactor.toDouble(),adjustedColor))))));
  }*/

  if (tempShapes.isNotEmpty) {
    tempSlide.add(SizedBox(
        height: maxHeight,
        width: maxWidth,
        child: Stack(
          children: tempShapes,
        )));
  }

  slideWidget.add(SingleChildScrollView(
    scrollDirection: Axis.horizontal,
    child: Container(
      constraints: BoxConstraints(
          minHeight: params.height != null ? params.height!.toDouble() / 914400 : 450,
          minWidth: params.width != null ? params.width!.toDouble() / 914400 : 450),
      decoration: params.slide.backgroundImagePath != ""
          ? BoxDecoration(
              color: Colors.white,
              image: DecorationImage(
                image: FileImage(File(params.slide.backgroundImagePath)),
                fit: BoxFit.fill,
              ),
            )
          : const BoxDecoration(
              color: Colors.white,
            ),
      width: maxWidth,
      margin: const EdgeInsets.all(8),
      child: Column(
        children: tempSlide,
      ),
    ),
  ));
  return slideWidget;
}