Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3747d0e

Browse files
committed
234 Sys - Upgrade to latest Flutter/Dart 3, Update libs
1 parent 4ca6bbf commit 3747d0e

File tree

17 files changed

+254
-177
lines changed

17 files changed

+254
-177
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ If you want to learn more about the specs, all tickets are available by followin
2121
- Renamed `replaceText()` back to `replace()`. Technically speaking this is the correct name. It was change some months ago due to poor understanding on our side of the Quill API. We wanted a name that made it simpler to understand what `update()`, `replace()`, `compose()` do. These methods were very poorly documented. However the naming is correct. They are short names mostly because these are public API methods. Now why they are duplicated is explained in the updated documentation.
2222
- Improved docs. [#204](https://github.com/visual-space/visual-editor/issues/204)
2323
- Toolbar - Disable Styling Options For Code Blocks, Cleanup [#230](https://github.com/visual-space/visual-editor/issues/230) - Some very bad design choices have been made in the state store architecture and in the callstack overall. Especially calling runBuild twice because the delayed btn enabled state bug was not properly fixed at the root.
24+
- Upgraded to Latest Flutter and to Dart 3. Fixed several migration issues. Updated to latest libs.
2425

2526

2627
## Overlay - Custom overlay [#209](https://github.com/visual-space/visual-editor/issues/209)

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
88
version: 1.0.0+1
99

1010
environment:
11-
sdk: '>=2.12.0 <3.0.0'
11+
sdk: '>=2.14.0 <3.0.0'
1212

1313
dependencies:
1414
flutter:

lib/editor/controllers/vertical-caret-movement-run.controller.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import '../widgets/editor-textarea-renderer.dart';
66

77
// Handles the movement of the caret up and down the document.
88
// TODO Currently the motion is completely broken. Needs review (check if Quill has the same issue).
9-
class VerticalCaretMovementRunController
10-
extends BidirectionalIterator<TextPosition> {
9+
class VerticalCaretMovementRunController extends Iterator<TextPosition> {
1110
VerticalCaretMovementRunController(
1211
this._renderer,
1312
this._currentTextPosition,
@@ -28,7 +27,6 @@ class VerticalCaretMovementRunController
2827
return true;
2928
}
3029

31-
@override
3230
bool movePrevious() {
3331
_currentTextPosition = _renderer.getTextPositionAbove(_currentTextPosition);
3432
return true;

lib/editor/models/editor-cfg.model.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ class EditorConfigM {
140140
// Later the markers can be enabled using: _controller.toggleMarkers()
141141
final bool? markersVisibility;
142142

143+
// Configuration of handler for media content inserted via the system input method.
144+
// See [https://api.flutter.dev/flutter/widgets/EditableText/contentInsertionConfiguration.html]
145+
final ContentInsertionConfiguration? contentInsertionConfiguration;
146+
143147
// === CALLBACKS ===
144148

145149
// Returns whether gesture is handled
@@ -220,6 +224,7 @@ class EditorConfigM {
220224
this.highlights = const [],
221225
this.markerTypes = const [],
222226
this.markersVisibility = true,
227+
this.contentInsertionConfiguration,
223228

224229
// Callbacks
225230
this.onTapDown,

lib/embeds/widgets/video-app.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _VideoAppState extends State<VideoApp> {
4242
super.initState();
4343

4444
_controller = widget.videoUrl.startsWith('http')
45-
? VideoPlayerController.network(widget.videoUrl)
45+
? VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl))
4646
: VideoPlayerController.file(File(widget.videoUrl))
4747
..initialize().then((_) {
4848
// Ensure the first frame is shown after the video is initialized,

lib/inputs/models/word-boundary.model.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import 'package:flutter/services.dart';
33
import 'base/text-boundary.model.dart';
44

55
// [UAX #29](https://unicode.org/reports/tr29/) defined word boundaries.
6-
class WordBoundary extends TextBoundaryM {
7-
const WordBoundary(
6+
// TODO Review why we collide with WordBoundary from Flutter
7+
// I used VE suffix to differentiate
8+
class WordBoundaryVE extends TextBoundaryM {
9+
const WordBoundaryVE(
810
this.textLayout,
911
this.plainText,
1012
);

lib/inputs/services/keyboard-actions.service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class KeyboardActionsService {
199199
// This isn't enough. Newline characters.
200200
boundary = ExpandedTextBoundary(
201201
WhitespaceBoundary(plainText),
202-
WordBoundary(state.refs.renderer, plainText),
202+
WordBoundaryVE(state.refs.renderer, plainText),
203203
);
204204

205205
final mixedBoundary = intent.forward

lib/main.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,18 @@ class VisualEditorState extends State<VisualEditor>
403403
// TODO: implement performSelector
404404
}
405405

406+
@override
407+
void insertContent(KeyboardInsertedContent content) {
408+
assert(state.config.contentInsertionConfiguration?.allowedMimeTypes.contains(content.mimeType) ?? false);
409+
state.config.contentInsertionConfiguration?.onContentInserted.call(content);
410+
}
411+
412+
@override
413+
bool get liveTextInputEnabled {
414+
// TODO: implement liveTextInputEnabled
415+
return false;
416+
}
417+
406418
// Required to avoid circular reference between EditorService and KeyboardService.
407419
// Ugly solution but it works.
408420
bool updGuiAndBuildViaHardwareKbEvent(_) => _keyboardService.updGuiAndBuildViaHardwareKeyboardEvent(

lib/search/search-bar.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@ import 'search-bar-action-btn.dart';
1212
// Everytime a char is typed we search the final string in the entire document and highlight matches
1313
// A counter of the total matches will be displayed on the toolbar.
1414
// In the feature, more features will be add such as navigate trough matches and matches positions slimbar will be added
15-
class SearchBar extends StatefulWidget {
15+
// TODO Review if there's a better solution:
16+
// Added VE suffix to avoid collision with SearchBar from flutter.
17+
class SearchBarVE extends StatefulWidget {
1618
final EditorController editorController;
1719
final EditorState state;
1820

19-
SearchBar({
21+
SearchBarVE({
2022
required this.editorController,
2123
required this.state,
2224
Key? key,
2325
}) : super(key: key);
2426

2527
@override
26-
State<SearchBar> createState() => _SearchBarState();
28+
State<SearchBarVE> createState() => _SearchBarVEState();
2729
}
2830

29-
class _SearchBarState extends State<SearchBar> {
31+
class _SearchBarVEState extends State<SearchBarVE> {
3032
final _controller = TextEditingController();
3133
final _fieldFocus = FocusNode();
3234
late StreamSubscription _changes$L;

lib/styles/models/doc-tree/inline-code-style.model.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ class InlineCodeStyle {
3737
if (lineStyle.containsKey(AttributesAliasesM.h1.key)) {
3838
return header1 ?? style;
3939
}
40+
4041
if (lineStyle.containsKey(AttributesAliasesM.h2.key)) {
4142
return header2 ?? style;
4243
}
44+
4345
if (lineStyle.containsKey(AttributesAliasesM.h3.key)) {
4446
return header3 ?? style;
4547
}
48+
4649
return style;
4750
}
4851

@@ -51,9 +54,11 @@ class InlineCodeStyle {
5154
if (identical(this, other)) {
5255
return true;
5356
}
57+
5458
if (other is! InlineCodeStyle) {
5559
return false;
5660
}
61+
5762
return other.style == style &&
5863
other.header1 == header1 &&
5964
other.header2 == header2 &&
@@ -63,6 +68,5 @@ class InlineCodeStyle {
6368
}
6469

6570
@override
66-
int get hashCode =>
67-
Object.hash(style, header1, header2, header3, backgroundColor, radius);
71+
int get hashCode => Object.hash(style, header1, header2, header3, backgroundColor, radius);
6872
}

0 commit comments

Comments
 (0)