SfChartThemeData constructor

SfChartThemeData({
  1. Brightness? brightness,
  2. Color? backgroundColor,
  3. Color? axisLabelColor,
  4. Color? axisTitleColor,
  5. Color? axisLineColor,
  6. Color? majorGridLineColor,
  7. Color? minorGridLineColor,
  8. Color? majorTickLineColor,
  9. Color? minorTickLineColor,
  10. Color? titleTextColor,
  11. Color? titleBackgroundColor,
  12. Color? legendTextColor,
  13. Color? legendTitleColor,
  14. Color? legendBackgroundColor,
  15. Color? plotAreaBackgroundColor,
  16. Color? plotAreaBorderColor,
  17. Color? crosshairLineColor,
  18. Color? crosshairBackgroundColor,
  19. Color? crosshairLabelColor,
  20. Color? tooltipColor,
  21. Color? tooltipLabelColor,
  22. Color? tooltipSeparatorColor,
  23. Color? selectionRectColor,
  24. Color? selectionRectBorderColor,
  25. Color? selectionTooltipConnectorLineColor,
  26. Color? waterfallConnectorLineColor,
  27. TextStyle? titleTextStyle,
  28. TextStyle? axisTitleTextStyle,
  29. TextStyle? axisLabelTextStyle,
  30. TextStyle? axisMultiLevelLabelTextStyle,
  31. TextStyle? plotBandLabelTextStyle,
  32. TextStyle? legendTitleTextStyle,
  33. TextStyle? legendTextStyle,
  34. TextStyle? dataLabelTextStyle,
  35. TextStyle? tooltipTextStyle,
  36. TextStyle? trackballTextStyle,
  37. TextStyle? crosshairTextStyle,
  38. TextStyle? selectionZoomingTooltipTextStyle,
})

Creating an argument constructor of SfChartThemeData class.

Implementation

factory SfChartThemeData({
  Brightness? brightness,
  Color? backgroundColor,
  Color? axisLabelColor,
  Color? axisTitleColor,
  Color? axisLineColor,
  Color? majorGridLineColor,
  Color? minorGridLineColor,
  Color? majorTickLineColor,
  Color? minorTickLineColor,
  Color? titleTextColor,
  Color? titleBackgroundColor,
  Color? legendTextColor,
  Color? legendTitleColor,
  Color? legendBackgroundColor,
  Color? plotAreaBackgroundColor,
  Color? plotAreaBorderColor,
  Color? crosshairLineColor,
  Color? crosshairBackgroundColor,
  Color? crosshairLabelColor,
  Color? tooltipColor,
  Color? tooltipLabelColor,
  Color? tooltipSeparatorColor,
  Color? selectionRectColor,
  Color? selectionRectBorderColor,
  Color? selectionTooltipConnectorLineColor,
  Color? waterfallConnectorLineColor,
  TextStyle? titleTextStyle,
  TextStyle? axisTitleTextStyle,
  TextStyle? axisLabelTextStyle,
  TextStyle? axisMultiLevelLabelTextStyle,
  TextStyle? plotBandLabelTextStyle,
  TextStyle? legendTitleTextStyle,
  TextStyle? legendTextStyle,
  TextStyle? dataLabelTextStyle,
  TextStyle? tooltipTextStyle,
  TextStyle? trackballTextStyle,
  TextStyle? crosshairTextStyle,
  TextStyle? selectionZoomingTooltipTextStyle,
}) {
  brightness = brightness ?? Brightness.light;
  final bool isLight = brightness == Brightness.light;
  backgroundColor ??= Colors.transparent;
  axisLabelColor ??= isLight
      ? const Color.fromRGBO(104, 104, 104, 1)
      : const Color.fromRGBO(242, 242, 242, 1);
  axisTitleColor ??= isLight
      ? const Color.fromRGBO(66, 66, 66, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  axisLineColor ??= isLight
      ? const Color.fromRGBO(181, 181, 181, 1)
      : const Color.fromRGBO(101, 101, 101, 1);
  majorGridLineColor ??= isLight
      ? const Color.fromRGBO(219, 219, 219, 1)
      : const Color.fromRGBO(70, 74, 86, 1);
  minorGridLineColor ??= isLight
      ? const Color.fromRGBO(234, 234, 234, 1)
      : const Color.fromRGBO(70, 74, 86, 1);
  majorTickLineColor ??= isLight
      ? const Color.fromRGBO(181, 181, 181, 1)
      : const Color.fromRGBO(191, 191, 191, 1);
  minorTickLineColor ??= isLight
      ? const Color.fromRGBO(214, 214, 214, 1)
      : const Color.fromRGBO(150, 150, 150, 1);
  titleTextColor ??= isLight
      ? const Color.fromRGBO(66, 66, 66, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  titleBackgroundColor ??= Colors.transparent;
  legendTextColor ??= isLight
      ? const Color.fromRGBO(53, 53, 53, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  legendBackgroundColor ??= isLight
      ? const Color.fromRGBO(255, 255, 255, 1)
      : const Color.fromRGBO(0, 0, 0, 1);
  legendTitleColor ??= isLight
      ? const Color.fromRGBO(66, 66, 66, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  plotAreaBackgroundColor ??= Colors.transparent;
  plotAreaBorderColor ??= isLight
      ? const Color.fromRGBO(219, 219, 219, 1)
      : const Color.fromRGBO(101, 101, 101, 1);
  crosshairLineColor ??= isLight
      ? const Color.fromRGBO(79, 79, 79, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  crosshairBackgroundColor ??= isLight
      ? const Color.fromRGBO(79, 79, 79, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  crosshairLabelColor ??= isLight
      ? const Color.fromRGBO(255, 255, 255, 1)
      : const Color.fromRGBO(0, 0, 0, 1);
  tooltipColor ??= isLight
      ? const Color.fromRGBO(0, 8, 22, 0.75)
      : const Color.fromRGBO(255, 255, 255, 1);
  tooltipLabelColor ??= isLight
      ? const Color.fromRGBO(255, 255, 255, 1)
      : const Color.fromRGBO(0, 0, 0, 1);
  tooltipSeparatorColor ??= isLight
      ? const Color.fromRGBO(255, 255, 255, 1)
      : const Color.fromRGBO(150, 150, 150, 1);
  selectionRectColor ??= isLight
      ? const Color.fromRGBO(41, 171, 226, 0.1)
      : const Color.fromRGBO(255, 217, 57, 0.3);
  selectionRectBorderColor ??= isLight
      ? const Color.fromRGBO(41, 171, 226, 1)
      : const Color.fromRGBO(255, 255, 255, 1);
  selectionTooltipConnectorLineColor ??= isLight
      ? const Color.fromRGBO(79, 79, 79, 1)
      : const Color.fromRGBO(150, 150, 150, 1);
  waterfallConnectorLineColor ??= isLight
      ? const Color.fromRGBO(0, 0, 0, 1)
      : const Color.fromRGBO(255, 255, 255, 1);

  return SfChartThemeData.raw(
    brightness: brightness,
    axisLabelColor: axisLabelColor,
    axisLineColor: axisLineColor,
    axisTitleColor: axisTitleColor,
    backgroundColor: backgroundColor,
    titleTextColor: titleTextColor,
    crosshairBackgroundColor: crosshairBackgroundColor,
    crosshairLabelColor: crosshairLabelColor,
    crosshairLineColor: crosshairLineColor,
    legendBackgroundColor: legendBackgroundColor,
    legendTextColor: legendTextColor,
    legendTitleColor: legendTitleColor,
    majorGridLineColor: majorGridLineColor,
    majorTickLineColor: majorTickLineColor,
    minorGridLineColor: minorGridLineColor,
    minorTickLineColor: minorTickLineColor,
    plotAreaBackgroundColor: plotAreaBackgroundColor,
    plotAreaBorderColor: plotAreaBorderColor,
    selectionRectColor: selectionRectColor,
    selectionRectBorderColor: selectionRectBorderColor,
    selectionTooltipConnectorLineColor: selectionTooltipConnectorLineColor,
    titleBackgroundColor: titleBackgroundColor,
    tooltipColor: tooltipColor,
    tooltipSeparatorColor: tooltipSeparatorColor,
    tooltipLabelColor: tooltipLabelColor,
    waterfallConnectorLineColor: waterfallConnectorLineColor,
    titleTextStyle: titleTextStyle,
    axisTitleTextStyle: axisTitleTextStyle,
    axisLabelTextStyle: axisLabelTextStyle,
    axisMultiLevelLabelTextStyle: axisMultiLevelLabelTextStyle,
    plotBandLabelTextStyle: plotBandLabelTextStyle,
    legendTitleTextStyle: legendTitleTextStyle,
    legendTextStyle: legendTextStyle,
    dataLabelTextStyle: dataLabelTextStyle,
    tooltipTextStyle: tooltipTextStyle,
    trackballTextStyle: trackballTextStyle,
    crosshairTextStyle: crosshairTextStyle,
    selectionZoomingTooltipTextStyle: selectionZoomingTooltipTextStyle,
  );
}