flutter_highlighter 0.1.1 copy "flutter_highlighter: ^0.1.1" to clipboard
flutter_highlighter: ^0.1.1 copied to clipboard

Syntax highlighting widget for Flutter with lots of languages and themes support.

flutter_highlighter #

pub

Syntax highlighter for Flutter.

Usage #

import 'package:flutter/material.dart';
import 'package:flutter_highlighter/flutter_highlighter.dart';
import 'package:flutter_highlighter/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

19
likes
120
pub points
92%
popularity

Publisher

verified publishermagnificsoftware.com

Syntax highlighting widget for Flutter with lots of languages and themes support.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, highlighter

More

Packages that depend on flutter_highlighter