Last updated:
0 purchases
flutter highlight2
flutter_highlight2 #
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)),
);
}
}
copied to clipboard
References #
All available languages
All available themes
License #
MIT
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.