Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

// This widget is the root of your application.
@override
Expand All @@ -28,7 +28,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
const MyHomePage({super.key, required this.title});

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
Expand Down
3 changes: 1 addition & 2 deletions example/lib/menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import 'package:re_editor/re_editor.dart';
class ContextMenuItemWidget extends PopupMenuItem<void> implements PreferredSizeWidget {

ContextMenuItemWidget({
Key? key,
super.key,
required String text,
required VoidCallback onTap,
}) : super(
key: key,
onTap: onTap,
child: Text(text)
);
Expand Down
58 changes: 29 additions & 29 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ packages:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37
url: "https://pub.dev"
source: hosted
version: "2.11.0"
version: "2.13.1"
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.1"
collection:
dependency: "direct main"
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -38,22 +38,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
isolate_contactor:
dependency: transitive
description:
name: isolate_contactor
sha256: "6ba8434ceb58238a1389d6365111a3efe7baa1c68a66f4db6d63d351cf6c3a0f"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
isolate_manager:
dependency: transitive
description:
name: isolate_manager
sha256: "22ed0c25f80ec3b5f21e3a55d060f4650afff33f27c2dff34c0f9409d5759ae5"
sha256: "806b6195a60f17bcb23e3c6d2f4da1f29e7376c4295b061d135f59613586ad1d"
url: "https://pub.dev"
source: hosted
version: "4.1.5+1"
version: "6.3.2"
lints:
dependency: transitive
description:
Expand All @@ -66,33 +58,33 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.13.0"
meta:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.18.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.9.1"
re_editor:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.9.0"
version: "0.10.0"
re_highlight:
dependency: "direct main"
description:
Expand All @@ -105,23 +97,31 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.4"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.2.0"
web:
dependency: transitive
description:
name: web
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
sdks:
dart: ">=3.2.0-0 <4.0.0"
dart: ">=3.12.2 <4.0.0"
flutter: ">=1.17.0"
3 changes: 1 addition & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ publish_to: none
version: 1.0.0

environment:
sdk: ">=2.17.0 <3.0.0"
flutter: ">=1.17.0"
sdk: ">=3.12.2 <4.0.0"

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/_code_autocomplete.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

class _DefaultCodeAutocompletePromptsBuilder implements DefaultCodeAutocompletePromptsBuilder {

Expand Down
5 changes: 2 additions & 3 deletions lib/src/_code_editable.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

const double _kDefaultTextSize = 13.0;
const double _kDefaultFontHeight = 1.4;
Expand Down Expand Up @@ -245,8 +245,7 @@ class _CodeEditableState extends State<_CodeEditable> with AutomaticKeepAliveCli
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (indicator != null)
indicator,
?indicator,
if (widget.leadingDivider != null)
widget.leadingDivider!,
Expanded(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/_code_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

extension _InlineSpanExtension on InlineSpan {

Expand Down
99 changes: 36 additions & 63 deletions lib/src/_code_field.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

class _CodeField extends SingleChildRenderObjectWidget {

Expand Down Expand Up @@ -158,54 +158,36 @@ class _CodeFieldRender extends RenderBox implements MouseTrackerAnnotation {
late double _preferredLineHeight;

_CodeFieldRender({
required ViewportOffset verticalViewport,
required ViewportOffset? horizontalViewport,
required double verticalScrollbarWidth,
required double horizontalScrollbarHeight,
required CodeLines codes,
required CodeLineSelection selection,
required this._verticalViewport,
required this._horizontalViewport,
required this._verticalScrollbarWidth,
required this._horizontalScrollbarHeight,
required this._codes,
required this._selection,
required List<CodeLineSelection>? highlightSelections,
required TextStyle textStyle,
required bool hasFocus,
required _CodeHighlighter highlighter,
required ValueNotifier<bool> showCursorNotifier,
required ValueNotifier<_FloatingCursorState> floatingCursorNotifier,
required ValueChanged<List<CodeLineRenderParagraph>> onRenderParagraphsChanged,
required this._textStyle,
required this._hasFocus,
required this._highlighter,
required this._showCursorNotifier,
required this._floatingCursorNotifier,
required this._onRenderParagraphsChanged,
required Color selectionColor,
required Color highlightColor,
required Color cursorColor,
required Color floatingCursorColor,
Color? cursorLineColor,
Color? chunkIndicatorColor,
this._chunkIndicatorColor,
required double cursorWidth,
required double floatingCursorWidth,
required EdgeInsetsGeometry padding,
required bool readOnly,
int? maxLengthSingleLineRendering,
required LayerLink startHandleLayerLink,
required LayerLink endHandleLayerLink,
}) : _verticalViewport = verticalViewport,
_horizontalViewport = horizontalViewport,
_verticalScrollbarWidth = verticalScrollbarWidth,
_horizontalScrollbarHeight = horizontalScrollbarHeight,
_codes = codes,
_selection = selection,
_textStyle = textStyle,
_hasFocus = hasFocus,
_highlighter = highlighter,
_showCursorNotifier = showCursorNotifier,
_floatingCursorNotifier = floatingCursorNotifier,
_onRenderParagraphsChanged = onRenderParagraphsChanged,
_padding = padding,
_readOnly = readOnly,
_maxLengthSingleLineRendering = maxLengthSingleLineRendering,
_chunkIndicatorColor = chunkIndicatorColor,
_paint = Paint(),
required this._padding,
required this._readOnly,
this._maxLengthSingleLineRendering,
required this._startHandleLayerLink,
required this._endHandleLayerLink,
}) : _paint = Paint(),
_displayParagraphs = [],
_chunkIndicators = [],
_cursor = SystemMouseCursors.text,
_startHandleLayerLink = startHandleLayerLink,
_endHandleLayerLink = endHandleLayerLink {
_cursor = SystemMouseCursors.text {
_backgroundRender = _CodeFieldExtraRender(
painters: [
_CodeCursorLinePainter(cursorLineColor, _selection),
Expand Down Expand Up @@ -1426,7 +1408,7 @@ class _CodeCursorLinePainter extends _CodeFieldExtraPainter {

@override
void paint(Canvas canvas, Size size, _CodeFieldRender render) {
if (_color == null || _color == Colors.transparent || _color!.alpha == 0) {
if (_color == null || _color == Colors.transparent || _color!.a == 0.0) {
return;
}
if (!_selection.isCollapsed) {
Expand Down Expand Up @@ -1480,7 +1462,7 @@ abstract class _CodeFieldSelectionsPainter extends _CodeFieldExtraPainter {

@override
void paint(Canvas canvas, Size size, _CodeFieldRender render) {
if (_color == Colors.transparent || _color.alpha == 0) {
if (_color == Colors.transparent || _color.a == 0.0) {
return;
}
final List<CodeLineRenderParagraph> paragraphs = render.displayParagraphs;
Expand Down Expand Up @@ -1575,17 +1557,12 @@ class _CodeFieldCursorPainter extends _CodeFieldExtraPainter {
bool _willDraw;

_CodeFieldCursorPainter({
required CodeLinePosition position,
required Color color,
required double width,
required double height,
required bool visible,
}) : _position = position,
_color = color,
_width = width,
_height = height,
_visible = visible,
_willDraw = true,
required this._position,
required this._color,
required this._width,
required this._height,
required this._visible,
}) : _willDraw = true,
_paint = Paint();

set position(CodeLinePosition value) {
Expand Down Expand Up @@ -1640,7 +1617,7 @@ class _CodeFieldCursorPainter extends _CodeFieldExtraPainter {

@override
void paint(Canvas canvas, Size size, _CodeFieldRender render) {
if (!_visible || !_willDraw || _color == Colors.transparent || _color.alpha == 0) {
if (!_visible || !_willDraw || _color == Colors.transparent || _color.a == 0.0) {
return;
}
final CodeLineRenderParagraph? paragraph = render.findDisplayParagraphByLineIndex(_position.index);
Expand Down Expand Up @@ -1674,15 +1651,11 @@ class _CodeFieldFloatingCursorPainter extends _CodeFieldExtraPainter {
double _height;

_CodeFieldFloatingCursorPainter({
required _FloatingCursorState position,
required Color color,
required double width,
required double height,
}) : _position = position,
_color = color,
_width = width,
_height = height,
_paint = Paint();
required this._position,
required this._color,
required this._width,
required this._height,
}) : _paint = Paint();

set position(_FloatingCursorState value) {
if (_position == value) {
Expand Down Expand Up @@ -1722,7 +1695,7 @@ class _CodeFieldFloatingCursorPainter extends _CodeFieldExtraPainter {

@override
void paint(Canvas canvas, Size size, _CodeFieldRender render) {
if (!_position.isActive() || _color == Colors.transparent || _color.alpha == 0) {
if (!_position.isActive() || _color == Colors.transparent || _color.a == 0.0) {
return;
}
_drawFloatingCaret(canvas, _position.floatingCursorOffset!, size);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/_code_find.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

class _CodeFindControllerImpl extends ValueNotifier<CodeFindValue?> implements CodeFindController {

Expand Down
2 changes: 1 addition & 1 deletion lib/src/_code_floating_cursor.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

// The time the animation of the floating cursor snapping to the final cursor position will take.
const Duration floatingCursorSnapDuration = Duration(milliseconds: 300);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/_code_formatter.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of re_editor;
part of 're_editor.dart';

class _DefaultCodeCommentFormatter implements DefaultCodeCommentFormatter {

Expand Down
Loading