git-touch/highlight.dart

Support Text copy

Opened this issue · 0 comments

azhon commented
  • flutter_highlight.dart

Change RichText to SelectableText.rich

@override
  Widget build(BuildContext context) {
   /// ....
    return Container(
      color: theme[_rootKey]?.backgroundColor ?? _defaultBackgroundColor,
      padding: padding,
      child: SelectableText.rich(
        TextSpan(
          style: _textStyle,
          children:
              _convert(highlight.parse(source, language: language).nodes!),
        ),
      ),
    );
  }