refactor: Use own highlight rendering with working scrollbar and text selection
This commit is contained in:
parent
8e4c61f03b
commit
d8d0abf27c
5 changed files with 117 additions and 45 deletions
40
lib/utils/code_highlight_theme.dart
Normal file
40
lib/utils/code_highlight_theme.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
|
||||
const hightlightTextColor = Color(0xffabb2bf);
|
||||
const atomOneBackgroundColor = Color(0xff282c34);
|
||||
const atomOneDarkTheme = {
|
||||
'root': TextStyle(color: hightlightTextColor),
|
||||
'comment': TextStyle(color: Color(0xff5c6370), fontStyle: FontStyle.italic),
|
||||
'quote': TextStyle(color: Color(0xff5c6370), fontStyle: FontStyle.italic),
|
||||
'doctag': TextStyle(color: Color(0xffc678dd)),
|
||||
'keyword': TextStyle(color: Color(0xffc678dd)),
|
||||
'formula': TextStyle(color: Color(0xffc678dd)),
|
||||
'section': TextStyle(color: Color(0xffe06c75)),
|
||||
'name': TextStyle(color: Color(0xffe06c75)),
|
||||
'selector-tag': TextStyle(color: Color(0xffe06c75)),
|
||||
'deletion': TextStyle(color: Color(0xffe06c75)),
|
||||
'subst': TextStyle(color: Color(0xffe06c75)),
|
||||
'literal': TextStyle(color: Color(0xff56b6c2)),
|
||||
'string': TextStyle(color: Color(0xff98c379)),
|
||||
'regexp': TextStyle(color: Color(0xff98c379)),
|
||||
'addition': TextStyle(color: Color(0xff98c379)),
|
||||
'attribute': TextStyle(color: Color(0xff98c379)),
|
||||
'meta-string': TextStyle(color: Color(0xff98c379)),
|
||||
'built_in': TextStyle(color: Color(0xffe6c07b)),
|
||||
'attr': TextStyle(color: Color(0xffd19a66)),
|
||||
'variable': TextStyle(color: Color(0xffd19a66)),
|
||||
'template-variable': TextStyle(color: Color(0xffd19a66)),
|
||||
'type': TextStyle(color: Color(0xffd19a66)),
|
||||
'selector-class': TextStyle(color: Color(0xffd19a66)),
|
||||
'selector-attr': TextStyle(color: Color(0xffd19a66)),
|
||||
'selector-pseudo': TextStyle(color: Color(0xffd19a66)),
|
||||
'number': TextStyle(color: Color(0xffd19a66)),
|
||||
'symbol': TextStyle(color: Color(0xff61aeee)),
|
||||
'bullet': TextStyle(color: Color(0xff61aeee)),
|
||||
'link': TextStyle(color: Color(0xff61aeee)),
|
||||
'meta': TextStyle(color: Color(0xff61aeee)),
|
||||
'selector-id': TextStyle(color: Color(0xff61aeee)),
|
||||
'title': TextStyle(color: Color(0xff61aeee)),
|
||||
'emphasis': TextStyle(fontStyle: FontStyle.italic),
|
||||
'strong': TextStyle(fontWeight: FontWeight.bold),
|
||||
};
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_highlighter/flutter_highlighter.dart';
|
||||
import 'package:flutter_highlighter/themes/shades-of-purple.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
|
|
@ -40,10 +38,12 @@ class ErrorReporter {
|
|||
height: 256,
|
||||
width: 256,
|
||||
child: SingleChildScrollView(
|
||||
child: HighlightView(
|
||||
child: Text(
|
||||
text,
|
||||
language: 'sh',
|
||||
theme: shadesOfPurpleTheme,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'RobotoMono',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue