flutter_highlight

pub

Syntax highlighter for Flutter. https://git-touch.github.io/highlight/

Usage

import 'package:flutter/material.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:flutter_highlight/themes/github.dart';

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var code = '''main() {
  print("Hello, World!");
}
''';

    return HighlightView(
      // The original code to be highlighted
      code,

      // Specify language
      // It is recommended to give it a value for performance
      language: 'dart',

      // Specify highlight theme
      // All available themes are listed in `themes` folder
      theme: githubTheme,

      // Specify padding
      padding: EdgeInsets.all(12),

      // Specify text style
      textStyle: TextStyle(
        fontFamily: 'My awesome monospace font',
        fontSize: 16,
      ),
    );
  }
}

References

License

MIT

Libraries

flutter_highlight
theme_map
themes/a11y-dark
themes/a11y-light
themes/agate
themes/an-old-hope
themes/androidstudio
themes/arduino-light
themes/arta
themes/ascetic
themes/atelier-cave-dark
themes/atelier-cave-light
themes/atelier-dune-dark
themes/atelier-dune-light
themes/atelier-estuary-dark
themes/atelier-estuary-light
themes/atelier-forest-dark
themes/atelier-forest-light
themes/atelier-heath-dark
themes/atelier-heath-light
themes/atelier-lakeside-dark
themes/atelier-lakeside-light
themes/atelier-plateau-dark
themes/atelier-plateau-light
themes/atelier-savanna-dark
themes/atelier-savanna-light
themes/atelier-seaside-dark
themes/atelier-seaside-light
themes/atelier-sulphurpool-dark
themes/atelier-sulphurpool-light
themes/atom-one-dark
themes/atom-one-dark-reasonable
themes/atom-one-light
themes/brown-paper
themes/codepen-embed
themes/color-brewer
themes/darcula
themes/dark
themes/default
themes/docco
themes/dracula
themes/far
themes/foundation
themes/github
themes/github-gist
themes/gml
themes/googlecode
themes/gradient-dark
themes/grayscale
themes/gruvbox-dark
themes/gruvbox-light
themes/hopscotch
themes/hybrid
themes/idea
themes/ir-black
themes/isbl-editor-dark
themes/isbl-editor-light
themes/kimbie.dark
themes/kimbie.light
themes/lightfair
themes/magula
themes/mono-blue
themes/monokai
themes/monokai-sublime
themes/night-owl
themes/nord
themes/obsidian
themes/ocean
themes/paraiso-dark
themes/paraiso-light
themes/pojoaque
themes/purebasic
themes/qtcreator_dark
themes/qtcreator_light
themes/railscasts
themes/rainbow
themes/routeros
themes/school-book
themes/shades-of-purple
themes/solarized-dark
themes/solarized-light
themes/sunburst
themes/tomorrow
themes/tomorrow-night
themes/tomorrow-night-blue
themes/tomorrow-night-bright
themes/tomorrow-night-eighties
themes/vs
themes/vs2015
themes/xcode
themes/xt256
themes/zenburn