flutter syntax highlighting
syntax highlighting for dart and flutter, which supports lots of languages and themes.
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,
),
);
}
}
Comments are closed.