BertrandBev / code_field

A customizable code text field supporting syntax highlighting
https://bertrandbev.github.io/code_field/
MIT License
230 stars 61 forks source link

CodeController theme? #85

Closed jarrodcolburn closed 7 months ago

jarrodcolburn commented 10 months ago

all the examples have a theme property in CodeController

CodeController(
      text: source,
      language: dart,
      theme: monokaiSublimeTheme, // here
    );

but I'm not seeing this in the class definition

Has it been moved?

ghost commented 10 months ago

@jarrodcolburn

It seems that the style/theme has been moved out of the controller and now it's only a UI thing. I've found an example of a different project that uses the same package and works well for me:

@override
Widget build(BuildContext context) {
  return Expanded(
    child: CodeTheme(
      data: const CodeThemeData(styles: monokaiSublimeTheme),
      child: CodeField(
        controller: _codeController!,
        textStyle: const TextStyle(
          fontFamily: 'SourceCode',
        ),
      ),
    ),
  );
}

Hope it helps!

Cheers, Antonio Jesus