From 5c566033b421e4e23b358fcb84f23785f1d43ba9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 15 May 2022 12:52:20 +0300 Subject: [PATCH] Update to Flutter 3 --- lib/ui/app/app_scrollbar.dart | 3 +- lib/ui/app/app_shortcuts.dart | 17 ++++-- .../app/tables/app_paginated_data_table.dart | 1 - lib/utils/super_editor/super_editor.dart | 1 + lib/utils/super_editor/toolbar.dart | 16 ++--- linux/flutter/generated_plugins.cmake | 8 +++ pubspec.lock | 61 +++++++++++++------ pubspec.yaml | 10 ++- windows/flutter/generated_plugins.cmake | 8 +++ 9 files changed, 89 insertions(+), 36 deletions(-) diff --git a/lib/ui/app/app_scrollbar.dart b/lib/ui/app/app_scrollbar.dart index c4c3fa65d..d7abb8ed5 100644 --- a/lib/ui/app/app_scrollbar.dart +++ b/lib/ui/app/app_scrollbar.dart @@ -34,8 +34,7 @@ class _AppScrollbarState extends State { child: Scrollbar( child: widget.child, controller: widget.controller, - isAlwaysShown: isDesktop(context) && _isHovered, - showTrackOnHover: true, + trackVisibility: isDesktop(context) && _isHovered, ), ); } diff --git a/lib/ui/app/app_shortcuts.dart b/lib/ui/app/app_shortcuts.dart index ed3306744..13b02d0ac 100644 --- a/lib/ui/app/app_shortcuts.dart +++ b/lib/ui/app/app_shortcuts.dart @@ -1,11 +1,11 @@ // Flutter imports: -import 'package:flutter/foundation.dart'; +//import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; +//import 'package:flutter/services.dart'; // Project imports: -import 'package:invoiceninja_flutter/data/models/entities.dart'; -import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; +//import 'package:invoiceninja_flutter/data/models/entities.dart'; +//import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; class AppShortcuts extends StatefulWidget { const AppShortcuts({Key key, this.child}) : super(key: key); @@ -20,6 +20,7 @@ class AppShortcuts extends StatefulWidget { } class AppShortcutsState extends State { + /* final _shortcuts = { LogicalKeySet(LogicalKeyboardKey.keyN, LogicalKeyboardKey.keyI): _ShortcutIntent.create(EntityType.invoice), @@ -49,9 +50,13 @@ class AppShortcutsState extends State { LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): _ShortcutIntent.back(), }; + */ @override Widget build(BuildContext context) { + return SizedBox(); + + /* final _actions = >{ _ShortcutIntent: CallbackAction<_ShortcutIntent>( onInvoke: (_ShortcutIntent intent) { @@ -86,7 +91,6 @@ class AppShortcutsState extends State { ), ); - /* return FocusableActionDetector( child: widget.child, actions: _actions, @@ -97,6 +101,7 @@ class AppShortcutsState extends State { } } +/* class _ShortcutIntent extends Intent { const _ShortcutIntent({this.intentType, this.entityType}); @@ -119,3 +124,5 @@ enum _ShortcutIntentType { back, list, } + +*/ \ No newline at end of file diff --git a/lib/ui/app/tables/app_paginated_data_table.dart b/lib/ui/app/tables/app_paginated_data_table.dart index 6b98d064c..a06c22bcb 100644 --- a/lib/ui/app/tables/app_paginated_data_table.dart +++ b/lib/ui/app/tables/app_paginated_data_table.dart @@ -476,7 +476,6 @@ class AppPaginatedDataTableState extends State { ), */ Scrollbar( - showTrackOnHover: true, controller: _controller, child: SingleChildScrollView( controller: _controller, diff --git a/lib/utils/super_editor/super_editor.dart b/lib/utils/super_editor/super_editor.dart index aef9eabb7..90dcfad5d 100644 --- a/lib/utils/super_editor/super_editor.dart +++ b/lib/utils/super_editor/super_editor.dart @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart'; import 'package:super_editor/super_editor.dart'; +import 'package:super_editor_markdown/super_editor_markdown.dart'; /// Example of a rich text editor. /// diff --git a/lib/utils/super_editor/toolbar.dart b/lib/utils/super_editor/toolbar.dart index 1692774cb..60c6837c8 100644 --- a/lib/utils/super_editor/toolbar.dart +++ b/lib/utils/super_editor/toolbar.dart @@ -255,7 +255,6 @@ class _EditorToolbarState extends State { ); } - /* /// Returns true if the current text selection includes part /// or all of a single link, returns false if zero links are /// in the selection or if 2+ links are in the selection. @@ -278,7 +277,7 @@ class _EditorToolbarState extends State { final selectionStart = min(baseOffset, extentOffset); final selectionEnd = max(baseOffset, extentOffset); final selectionRange = - TextRange(start: selectionStart, end: selectionEnd - 1); + SpanRange(start: selectionStart, end: selectionEnd - 1); final textNode = widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode; @@ -302,7 +301,7 @@ class _EditorToolbarState extends State { final selectionStart = min(baseOffset, extentOffset); final selectionEnd = max(baseOffset, extentOffset); final selectionRange = - TextRange(start: selectionStart, end: selectionEnd - 1); + SpanRange(start: selectionStart, end: selectionEnd - 1); final textNode = widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode; @@ -337,7 +336,7 @@ class _EditorToolbarState extends State { // the entire link attribution. text.removeAttribution( overlappingLinkSpan.attribution, - TextRange( + SpanRange( start: overlappingLinkSpan.start, end: overlappingLinkSpan.end), ); } @@ -349,7 +348,6 @@ class _EditorToolbarState extends State { }); } } - */ /// Takes the text from the [urlController] and applies it as a link /// attribution to the currently selected text. @@ -362,7 +360,7 @@ class _EditorToolbarState extends State { final selectionStart = min(baseOffset, extentOffset); final selectionEnd = max(baseOffset, extentOffset); final selectionRange = - TextRange(start: selectionStart, end: selectionEnd - 1); + SpanRange(start: selectionStart, end: selectionEnd - 1); final textNode = widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode; @@ -389,7 +387,7 @@ class _EditorToolbarState extends State { /// Given [text] and a [range] within the [text], the [range] is /// shortened on both sides to remove any trailing whitespace and /// the new range is returned. - TextRange _trimTextRangeWhitespace(AttributedText text, TextRange range) { + SpanRange _trimTextRangeWhitespace(AttributedText text, SpanRange range) { int startOffset = range.start; int endOffset = range.end; @@ -400,7 +398,7 @@ class _EditorToolbarState extends State { endOffset -= 1; } - return TextRange(start: startOffset, end: endOffset); + return SpanRange(start: startOffset, end: endOffset); } /* @@ -560,7 +558,6 @@ class _EditorToolbarState extends State { tooltip: 'Strikethrough', ), ), - /* Center( child: IconButton( onPressed: _areMultipleLinksSelected() ? null : _onLinkPressed, @@ -572,7 +569,6 @@ class _EditorToolbarState extends State { tooltip: 'Link', ), ), - */ // Only display alignment controls if the currently selected text // node respects alignment. List items, for example, do not. /* diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index fbfdd73aa..bfbaf253b 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -8,6 +8,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_linux ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -16,3 +19,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/pubspec.lock b/pubspec.lock index 2c1b298ec..4d5fee2e5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,7 +21,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.6" + version: "3.1.11" args: dependency: transitive description: @@ -36,6 +36,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.8.2" + attributed_text: + dependency: transitive + description: + name: attributed_text + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1" barcode: dependency: transitive description: @@ -196,7 +203,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" contacts_service: dependency: "direct main" description: @@ -217,7 +224,7 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.2.0" cross_file: dependency: transitive description: @@ -266,7 +273,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" faker: dependency: "direct dev" description: @@ -590,7 +597,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: @@ -646,7 +653,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" material_design_icons_flutter: dependency: "direct main" description: @@ -765,7 +772,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_parsing: dependency: transitive description: @@ -1110,7 +1117,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" sqflite: dependency: transitive description: @@ -1163,10 +1170,30 @@ packages: super_editor: dependency: "direct main" description: - name: super_editor - url: "https://pub.dartlang.org" - source: hosted + path: super_editor + ref: HEAD + resolved-ref: c284ee9b0a008fd507d9cc3dae7f03078592f9eb + url: "https://github.com/superlistapp/super_editor.git" + source: git version: "0.2.0" + super_editor_markdown: + dependency: "direct main" + description: + path: super_editor_markdown + ref: HEAD + resolved-ref: c284ee9b0a008fd507d9cc3dae7f03078592f9eb + url: "https://github.com/superlistapp/super_editor.git" + source: git + version: "0.1.0" + super_text: + dependency: transitive + description: + path: super_text + ref: HEAD + resolved-ref: c284ee9b0a008fd507d9cc3dae7f03078592f9eb + url: "https://github.com/superlistapp/super_editor.git" + source: git + version: "0.1.0" sync_http: dependency: transitive description: @@ -1194,21 +1221,21 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.19.5" + version: "1.20.2" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" + version: "0.4.9" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.11" timeago: dependency: "direct main" description: @@ -1313,7 +1340,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" version: dependency: "direct main" description: @@ -1327,7 +1354,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "7.5.0" + version: "8.2.2" watcher: dependency: transitive description: @@ -1413,5 +1440,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.16.1 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index d79c94ac1..0f546f751 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,7 +60,15 @@ dependencies: contacts_service: ^0.6.1 diacritic: ^0.1.3 states_rebuilder: ^5.2.0 - super_editor: ^0.2.0 + #super_editor: ^0.2.0 + super_editor: + git: + url: https://github.com/superlistapp/super_editor.git + path: super_editor + super_editor_markdown: + git: + url: https://github.com/superlistapp/super_editor.git + path: super_editor_markdown html2md: ^1.2.5 printing: ^5.8.0 image_cropper: ^2.0.2 diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 4f79c53d9..53fcac6db 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -8,6 +8,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_windows ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -16,3 +19,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin)