flutter_highlight2

example_screenshot

This is not necessarily the output of the below example, but has been acheived with the basis of that example.

Fork of flutter_higlight adding line numberings.

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,
      ),
	  
	  // Enable Line numbers
	  lineNumbers: true,
	  
	  // Line numbers container border
	  lineNumbersBorder: Border.all(color: Colors.grey, width: 0),
	  
	  // Line numbers container radius
	  lineNumbersRadius: const BorderRadius.only(
      bottomLeft: Radius.circular(15), topLeft: Radius.circular(15)),
    );
  }
}

References

License

MIT

Libraries

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
flutter_highlight
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
theme_map
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