flutter_syntax_view 0.2.2 flutter_syntax_view: ^0.2.2 copied to clipboard
A SyntaxView Widget which highlights code text according to the programming language syntax using Native Dart code.
flutter_syntax_view #
A SyntaxView Widget which highlights code text according to the programming language syntax using Native Dart code.
Usage #
//Set up a CodeEditingController (if you want an editable rich text)
@override
void initState() {
super.initState();
_controller = CodeEditingController();
_controller.text = """
import 'package:flutter/material.dart';
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
""";
}
//Choose which widget to render
_editing
? SyntaxEditableView(
syntax: Syntax.DART,
controller: _controller,
withZoom: true,
withLinesCount: true,
)
: SyntaxView(
syntax: Syntax.DART,
code: _controller.text,
withZoom: true,
withLinesCount: true,
)
Supported Syntax #
- ✅ Dart
- ✅ Java
- ✅ Kotlin
- ✅ Swift
- ✅ JavaScript
- More will be added.
Themes #
TODO #
- ❌ Add More Syntax Support.
- ❌ Add More Themes.
Contributing #
- if you are familiar with Regular Expressions in Dart and would like contribute in adding further syntax support. it will be very appreciated!
Contributors #
- Bader Eddine Ouaich badereddineouaich@gmail.com
- Rody Davis Jr rody.davis.jr@gmail.com
Installing #
Features and bugs #
If you face any problems feel free to open an issue at the issue tracker. If you feel the library is missing a feature, please raise a ticket on Github. Pull request are also welcome.
Editing on Flutter Web #
flutter run --release --dart-define=FLUTTER_WEB_USE_SKIA=true -d chrome