CodeDisplay constructor

CodeDisplay(
  1. String code, {
  2. CodeDisplayColorThemes? codeColorTheme,
  3. double? width,
  4. double? height,
  5. bool? showCopyButton,
  6. Widget? copyButtonReplacement,
  7. BoxDecoration? boxDecoration,
  8. TextStyle? commentTextStyle,
  9. TextStyle? baseTextStyle,
  10. TextStyle? classTextStyle,
  11. TextStyle? keywordTextStyle,
  12. TextStyle? stringTextStyle,
  13. TextStyle? punctuationTextStyle,
  14. EdgeInsets? padding,
  15. Key? key,
})

Creates a CodeDisplay widget.

The code parameter is the code to be displayed.

The codeColorTheme parameter specifies the color theme for syntax highlighting.

The width and height parameters can be used to set the dimensions of the widget.

The showCopyButton parameter is used for deciding if the copy button should be shown.

The boxDecoration parameter allows customizing the box decoration of the code display.

The commentTextStyle, baseTextStyle, classTextStyle, keywordTextStyle, stringTextStyle, and punctuationTextStyle parameters can be used to customize the styles of different parts of the code.

The padding parameter specifies the padding of the code container.

Implementation

CodeDisplay(
  this.code, {
  this.codeColorTheme,
  this.width,
  this.height,
  this.showCopyButton,
  this.copyButtonReplacement,
  this.boxDecoration,
  this.commentTextStyle,
  this.baseTextStyle,
  this.classTextStyle,
  this.keywordTextStyle,
  this.stringTextStyle,
  this.punctuationTextStyle,
  this.padding,
  super.key,
}) : _formatedCode = formatCode(code);