From b56d32b686d70afde0ffd57ea4f7453f85b23c2d Mon Sep 17 00:00:00 2001 From: Aaron Madlon-Kay Date: Tue, 19 Sep 2023 10:47:41 +0900 Subject: [PATCH] Use Text.rich rather than RichText Text.rich handles selection and text scaling for you automatically --- flutter_highlighting/lib/flutter_highlighting.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter_highlighting/lib/flutter_highlighting.dart b/flutter_highlighting/lib/flutter_highlighting.dart index f490a6b0..ef1a921d 100644 --- a/flutter_highlighting/lib/flutter_highlighting.dart +++ b/flutter_highlighting/lib/flutter_highlighting.dart @@ -90,8 +90,8 @@ class HighlightView extends StatelessWidget { return Container( color: theme[_rootKey]?.backgroundColor ?? _defaultBackgroundColor, padding: padding, - child: RichText( - text: TextSpan( + child: Text.rich( + TextSpan( style: _textStyle, children: _convert( highlight.highlight(languageId ?? '', source, true).nodes ?? [],