getConfig method

dynamic getConfig(
  1. dynamic colorList,
  2. dynamic fullColorList,
  3. dynamic drawConfig
)

获取画线配置 colorList, drawConfig

Implementation

getConfig(colorList,fullColorList, drawConfig) {
  List<dynamic> colorAry = colorList ??
  [
  const Color.fromRGBO(131, 79, 215, 1),
  const Color.fromRGBO(252, 71, 71, 1),
  const Color.fromRGBO(254, 159, 64, 1),
  ];
  List<dynamic> fullColorAry = fullColorList ??
  [
  const Color.fromRGBO(131, 79, 215, 0.392),
  const Color.fromRGBO(252, 71, 71, 0.392),
  const Color.fromRGBO(254, 159, 64, 0.392),
  ];

  Map defalutConfig = {
    Line['ZX']: {
      'n': "直线",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['SPZX']: {
      'n': "水平直线",
      'tip': "",
      'take': 1,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['CZZX']: {
      'n': "垂直直线",
      'tip': "",
      'take': 1,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['SX']: {
      'n': "射线",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['SPSX']: {
      'n': "水平射线",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['JGX']: {
      'n': "价格线",
      'tip': "",
      'take': 1,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['XD']: {
      'n': "线段",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['SPXD']: {
      'n': "水平线段",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['JT']: {
      'n': "箭头",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': null},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['SJ']: {
      'n': "三角形",
      'tip': "",
      'take': 3,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['JX']: {
      'n': "矩形",
      'tip': "",
      'take': 2,
      'lock':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['PXSX']: {
      'n': "平行射线",
      'tip': "",
      'take': 3,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['PXZX']: {
      'n': "平行直线",
      'tip': "",
      'take': 3,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['TDX']: {
      'n': "通道线",
      'tip': "",
      'take': 3,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['FBNQ']: {
      'n': "斐波那契线",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['FBNQSX']: {
      'n': "斐波那契扇形线",
      'tip': "",
      'take': 2,
      'lock':false,
      'dottedLine':false,
      'drawStyle': {'strokeWidth': 1.0, 'color': colorAry[0], 'fillc': fullColorAry[0]},
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    },
    Line['CL']: {
      'n': "测量",
      'tip': "",
      'take': 2,
      'lock':false,
      'drawStyle': {
        'strokeWidth': 1.0,
        'color': colorAry[0],
        'fillc': fullColorAry[0]
      },
      'txtStyle': {'strokeWidth': 0.0,'color': colorAry[0]}
    }
  };

  for (var key in drawConfig.keys) {
    if (defalutConfig.containsKey(key)) {
      defalutConfig[key] = <String, dynamic>{
        ...defalutConfig[key],
        ...drawConfig[key]
      };
    }
  }
  return defalutConfig;
}