Update to Flutter 3

This commit is contained in:
Hillel Coren 2022-05-15 12:52:20 +03:00
parent 5629a9b861
commit 5c566033b4
9 changed files with 89 additions and 36 deletions

View File

@ -34,8 +34,7 @@ class _AppScrollbarState extends State<AppScrollbar> {
child: Scrollbar( child: Scrollbar(
child: widget.child, child: widget.child,
controller: widget.controller, controller: widget.controller,
isAlwaysShown: isDesktop(context) && _isHovered, trackVisibility: isDesktop(context) && _isHovered,
showTrackOnHover: true,
), ),
); );
} }

View File

@ -1,11 +1,11 @@
// Flutter imports: // Flutter imports:
import 'package:flutter/foundation.dart'; //import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; //import 'package:flutter/services.dart';
// Project imports: // Project imports:
import 'package:invoiceninja_flutter/data/models/entities.dart'; //import 'package:invoiceninja_flutter/data/models/entities.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; //import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
class AppShortcuts extends StatefulWidget { class AppShortcuts extends StatefulWidget {
const AppShortcuts({Key key, this.child}) : super(key: key); const AppShortcuts({Key key, this.child}) : super(key: key);
@ -20,6 +20,7 @@ class AppShortcuts extends StatefulWidget {
} }
class AppShortcutsState extends State<AppShortcuts> { class AppShortcutsState extends State<AppShortcuts> {
/*
final _shortcuts = <LogicalKeySet, _ShortcutIntent>{ final _shortcuts = <LogicalKeySet, _ShortcutIntent>{
LogicalKeySet(LogicalKeyboardKey.keyN, LogicalKeyboardKey.keyI): LogicalKeySet(LogicalKeyboardKey.keyN, LogicalKeyboardKey.keyI):
_ShortcutIntent.create(EntityType.invoice), _ShortcutIntent.create(EntityType.invoice),
@ -49,9 +50,13 @@ class AppShortcutsState extends State<AppShortcuts> {
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft):
_ShortcutIntent.back(), _ShortcutIntent.back(),
}; };
*/
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox();
/*
final _actions = <Type, Action<Intent>>{ final _actions = <Type, Action<Intent>>{
_ShortcutIntent: CallbackAction<_ShortcutIntent>( _ShortcutIntent: CallbackAction<_ShortcutIntent>(
onInvoke: (_ShortcutIntent intent) { onInvoke: (_ShortcutIntent intent) {
@ -86,7 +91,6 @@ class AppShortcutsState extends State<AppShortcuts> {
), ),
); );
/*
return FocusableActionDetector( return FocusableActionDetector(
child: widget.child, child: widget.child,
actions: _actions, actions: _actions,
@ -97,6 +101,7 @@ class AppShortcutsState extends State<AppShortcuts> {
} }
} }
/*
class _ShortcutIntent extends Intent { class _ShortcutIntent extends Intent {
const _ShortcutIntent({this.intentType, this.entityType}); const _ShortcutIntent({this.intentType, this.entityType});
@ -119,3 +124,5 @@ enum _ShortcutIntentType {
back, back,
list, list,
} }
*/

View File

@ -476,7 +476,6 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
), ),
*/ */
Scrollbar( Scrollbar(
showTrackOnHover: true,
controller: _controller, controller: _controller,
child: SingleChildScrollView( child: SingleChildScrollView(
controller: _controller, controller: _controller,

View File

@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart'; import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart';
import 'package:super_editor/super_editor.dart'; import 'package:super_editor/super_editor.dart';
import 'package:super_editor_markdown/super_editor_markdown.dart';
/// Example of a rich text editor. /// Example of a rich text editor.
/// ///

View File

@ -255,7 +255,6 @@ class _EditorToolbarState extends State<EditorToolbar> {
); );
} }
/*
/// Returns true if the current text selection includes part /// Returns true if the current text selection includes part
/// or all of a single link, returns false if zero links are /// or all of a single link, returns false if zero links are
/// in the selection or if 2+ links are in the selection. /// in the selection or if 2+ links are in the selection.
@ -278,7 +277,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
final selectionStart = min(baseOffset, extentOffset); final selectionStart = min(baseOffset, extentOffset);
final selectionEnd = max(baseOffset, extentOffset); final selectionEnd = max(baseOffset, extentOffset);
final selectionRange = final selectionRange =
TextRange(start: selectionStart, end: selectionEnd - 1); SpanRange(start: selectionStart, end: selectionEnd - 1);
final textNode = final textNode =
widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode; widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode;
@ -302,7 +301,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
final selectionStart = min(baseOffset, extentOffset); final selectionStart = min(baseOffset, extentOffset);
final selectionEnd = max(baseOffset, extentOffset); final selectionEnd = max(baseOffset, extentOffset);
final selectionRange = final selectionRange =
TextRange(start: selectionStart, end: selectionEnd - 1); SpanRange(start: selectionStart, end: selectionEnd - 1);
final textNode = final textNode =
widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode; widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode;
@ -337,7 +336,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
// the entire link attribution. // the entire link attribution.
text.removeAttribution( text.removeAttribution(
overlappingLinkSpan.attribution, overlappingLinkSpan.attribution,
TextRange( SpanRange(
start: overlappingLinkSpan.start, end: overlappingLinkSpan.end), start: overlappingLinkSpan.start, end: overlappingLinkSpan.end),
); );
} }
@ -349,7 +348,6 @@ class _EditorToolbarState extends State<EditorToolbar> {
}); });
} }
} }
*/
/// Takes the text from the [urlController] and applies it as a link /// Takes the text from the [urlController] and applies it as a link
/// attribution to the currently selected text. /// attribution to the currently selected text.
@ -362,7 +360,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
final selectionStart = min(baseOffset, extentOffset); final selectionStart = min(baseOffset, extentOffset);
final selectionEnd = max(baseOffset, extentOffset); final selectionEnd = max(baseOffset, extentOffset);
final selectionRange = final selectionRange =
TextRange(start: selectionStart, end: selectionEnd - 1); SpanRange(start: selectionStart, end: selectionEnd - 1);
final textNode = final textNode =
widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode; widget.editor.document.getNodeById(selection.extent.nodeId) as TextNode;
@ -389,7 +387,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
/// Given [text] and a [range] within the [text], the [range] is /// Given [text] and a [range] within the [text], the [range] is
/// shortened on both sides to remove any trailing whitespace and /// shortened on both sides to remove any trailing whitespace and
/// the new range is returned. /// the new range is returned.
TextRange _trimTextRangeWhitespace(AttributedText text, TextRange range) { SpanRange _trimTextRangeWhitespace(AttributedText text, SpanRange range) {
int startOffset = range.start; int startOffset = range.start;
int endOffset = range.end; int endOffset = range.end;
@ -400,7 +398,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
endOffset -= 1; endOffset -= 1;
} }
return TextRange(start: startOffset, end: endOffset); return SpanRange(start: startOffset, end: endOffset);
} }
/* /*
@ -560,7 +558,6 @@ class _EditorToolbarState extends State<EditorToolbar> {
tooltip: 'Strikethrough', tooltip: 'Strikethrough',
), ),
), ),
/*
Center( Center(
child: IconButton( child: IconButton(
onPressed: _areMultipleLinksSelected() ? null : _onLinkPressed, onPressed: _areMultipleLinksSelected() ? null : _onLinkPressed,
@ -572,7 +569,6 @@ class _EditorToolbarState extends State<EditorToolbar> {
tooltip: 'Link', tooltip: 'Link',
), ),
), ),
*/
// Only display alignment controls if the currently selected text // Only display alignment controls if the currently selected text
// node respects alignment. List items, for example, do not. // node respects alignment. List items, for example, do not.
/* /*

View File

@ -8,6 +8,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux url_launcher_linux
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST}) foreach(plugin ${FLUTTER_PLUGIN_LIST})
@ -16,3 +19,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) 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)

View File

@ -21,7 +21,7 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.6" version: "3.1.11"
args: args:
dependency: transitive dependency: transitive
description: description:
@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.8.2"
attributed_text:
dependency: transitive
description:
name: attributed_text
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
barcode: barcode:
dependency: transitive dependency: transitive
description: description:
@ -196,7 +203,7 @@ packages:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
contacts_service: contacts_service:
dependency: "direct main" dependency: "direct main"
description: description:
@ -217,7 +224,7 @@ packages:
name: coverage name: coverage
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "1.2.0"
cross_file: cross_file:
dependency: transitive dependency: transitive
description: description:
@ -266,7 +273,7 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0"
faker: faker:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -590,7 +597,7 @@ packages:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3" version: "0.6.4"
json_annotation: json_annotation:
dependency: transitive dependency: transitive
description: description:
@ -646,7 +653,7 @@ packages:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.4"
material_design_icons_flutter: material_design_icons_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -765,7 +772,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
path_parsing: path_parsing:
dependency: transitive dependency: transitive
description: description:
@ -1110,7 +1117,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
sqflite: sqflite:
dependency: transitive dependency: transitive
description: description:
@ -1163,10 +1170,30 @@ packages:
super_editor: super_editor:
dependency: "direct main" dependency: "direct main"
description: description:
name: super_editor path: super_editor
url: "https://pub.dartlang.org" ref: HEAD
source: hosted resolved-ref: c284ee9b0a008fd507d9cc3dae7f03078592f9eb
url: "https://github.com/superlistapp/super_editor.git"
source: git
version: "0.2.0" 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: sync_http:
dependency: transitive dependency: transitive
description: description:
@ -1194,21 +1221,21 @@ packages:
name: test name: test
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.19.5" version: "1.20.2"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8" version: "0.4.9"
test_core: test_core:
dependency: transitive dependency: transitive
description: description:
name: test_core name: test_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.11"
timeago: timeago:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1313,7 +1340,7 @@ packages:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
version: version:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1327,7 +1354,7 @@ packages:
name: vm_service name: vm_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.5.0" version: "8.2.2"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
@ -1413,5 +1440,5 @@ packages:
source: hosted source: hosted
version: "3.1.0" version: "3.1.0"
sdks: sdks:
dart: ">=2.16.1 <3.0.0" dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.10.0" flutter: ">=2.10.0"

View File

@ -60,7 +60,15 @@ dependencies:
contacts_service: ^0.6.1 contacts_service: ^0.6.1
diacritic: ^0.1.3 diacritic: ^0.1.3
states_rebuilder: ^5.2.0 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 html2md: ^1.2.5
printing: ^5.8.0 printing: ^5.8.0
image_cropper: ^2.0.2 image_cropper: ^2.0.2

View File

@ -8,6 +8,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows url_launcher_windows
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST}) foreach(plugin ${FLUTTER_PLUGIN_LIST})
@ -16,3 +19,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) 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)