From 41a055548271962fdaab110484103b49950d640f Mon Sep 17 00:00:00 2001 From: Rishi Raj Singh <49035175+rish07@users.noreply.github.com> Date: Sat, 6 Mar 2021 10:44:50 +0530 Subject: [PATCH] Revert "Bug Fix and version update in pubspec.yaml (#56)" (#57) This reverts commit ffbc2acf42e96895ae8a1d4b1cf7c4035b0b5b6f. --- app/lib/pages/home_page.dart | 14 ++++------- app/pubspec.lock | 49 ++++++++++++++++-------------------- app/pubspec.yaml | 4 +-- lib/widgets/editor.dart | 45 ++++++++++++++++++++------------- pubspec.yaml | 13 +++++----- 5 files changed, 61 insertions(+), 64 deletions(-) diff --git a/app/lib/pages/home_page.dart b/app/lib/pages/home_page.dart index 665ce1b9..cee58494 100644 --- a/app/lib/pages/home_page.dart +++ b/app/lib/pages/home_page.dart @@ -92,8 +92,7 @@ class _HomePageState extends State { Widget _buildWelcomeEditor(BuildContext context) { return SafeArea( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: Stack( children: [ Container( height: MediaQuery.of(context).size.height * 0.88, @@ -125,13 +124,10 @@ class _HomePageState extends State { ), ), ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: QuillToolbar.basic( - controller: _controller, - onImagePickCallback: _onImagePickCallback), - ), + Container( + child: QuillToolbar.basic( + controller: _controller, + onImagePickCallback: _onImagePickCallback), ), ], ), diff --git a/app/pubspec.lock b/app/pubspec.lock index 424fec52..407518db 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -70,7 +70,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.0" fake_async: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "0.1.3" file: dependency: transitive description: @@ -98,7 +98,7 @@ packages: name: file_picker url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.0-nullsafety.2" flutter: dependency: "direct main" description: flutter @@ -110,28 +110,28 @@ packages: name: flutter_colorpicker url: "https://pub.dartlang.org" source: hosted - version: "0.3.5" + version: "0.4.0-nullsafety.0" flutter_keyboard_visibility: dependency: transitive description: name: flutter_keyboard_visibility url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "5.0.0-nullsafety.3" flutter_keyboard_visibility_platform_interface: dependency: transitive description: name: flutter_keyboard_visibility_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.0-nullsafety.0" flutter_keyboard_visibility_web: dependency: transitive description: name: flutter_keyboard_visibility_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.0-nullsafety.0" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -145,7 +145,7 @@ packages: path: ".." relative: true source: path - version: "0.3.3" + version: "1.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -225,35 +225,35 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "1.6.27" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "0.0.1+2" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "0.0.4+8" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "1.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "0.0.4+3" pedantic: dependency: transitive description: @@ -281,7 +281,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "1.1.0-nullsafety.2" process: dependency: transitive description: @@ -289,20 +289,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.1.0" - quill_delta: - dependency: transitive - description: - name: quill_delta - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.0" quiver_hashcode: dependency: transitive description: @@ -349,7 +342,7 @@ packages: name: string_validator url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.2.0-nullsafety.0" term_glyph: dependency: transitive description: @@ -370,7 +363,7 @@ packages: name: tuple url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0-nullsafety.0" typed_data: dependency: transitive description: @@ -447,14 +440,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "1.7.4+1" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.1.2" zone_local: dependency: transitive description: @@ -463,5 +456,5 @@ packages: source: hosted version: "0.1.2" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.22.0" + dart: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.24.0-10.2.pre" diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 8858a8dc..4d471487 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -27,8 +27,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.2 - path_provider: ^2.0.1 + cupertino_icons: ^1.0.0 + path_provider: ^1.6.27 flutter_quill: path: ../ diff --git a/lib/widgets/editor.dart b/lib/widgets/editor.dart index a2400bd5..d58fb7e4 100644 --- a/lib/widgets/editor.dart +++ b/lib/widgets/editor.dart @@ -20,18 +20,33 @@ import 'package:flutter_quill/widgets/image.dart'; import 'package:flutter_quill/widgets/raw_editor.dart'; import 'package:flutter_quill/widgets/responsive_widget.dart'; import 'package:flutter_quill/widgets/text_selection.dart'; +import 'package:string_validator/string_validator.dart'; import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:url_launcher/url_launcher.dart'; -import 'FakeUi.dart' if (dart.library.html) 'RealUi.dart' as ui; +import 'fake_ui.dart' if (dart.library.html) 'real_ui.dart' as ui; import 'box.dart'; import 'controller.dart'; import 'cursor.dart'; import 'default_styles.dart'; import 'delegate.dart'; -const urlPattern = - r"^((https?|http)://)?([-A-Z0-9.]+)(/[-A-Z0-9+&@#/%=~_|!:,.;]*)?(\?[A-Z0-9+&@#/%=~_|!:‌​,.;]*)?$"; +const linkPrefixes = [ + 'mailto:', // email + 'tel:', // telephone + 'sms:', // SMS + 'callto:', + 'wtai:', + 'market:', + 'geopoint:', + 'ymsgr:', + 'msnim:', + 'gtalk:', // Google Talk + 'skype:', + 'sip:', // Lync + 'whatsapp:', + 'http' +]; abstract class EditorState extends State { TextEditingValue getTextEditingValue(); @@ -316,8 +331,6 @@ class _QuillEditorState extends State class _QuillEditorSelectionGestureDetectorBuilder extends EditorTextSelectionGestureDetectorBuilder { - static final urlRegExp = new RegExp(urlPattern, caseSensitive: false); - final _QuillEditorState _state; _QuillEditorSelectionGestureDetectorBuilder(this._state) : super(_state); @@ -393,9 +406,12 @@ class _QuillEditorSelectionGestureDetectorBuilder launchUrl = _launchUrl; } String link = segment.style.attributes[Attribute.link.key].value; - if (getEditor().widget.readOnly && - link != null && - urlRegExp.firstMatch(link.trim()) != null) { + if (getEditor().widget.readOnly && link != null) { + link = link.trim(); + if (!linkPrefixes + .any((linkPrefix) => link.toLowerCase().startsWith(linkPrefix))) { + link = 'https://$link'; + } launchUrl(link); } return false; @@ -410,13 +426,9 @@ class _QuillEditorSelectionGestureDetectorBuilder builder: (context) => ImageTapWrapper( imageProvider: imageUrl.startsWith('http') ? NetworkImage(imageUrl) - : (isBase64(imageUrl)) - ? Image.memory( - base64.decode(imageUrl), - ) - : FileImage( - io.File(blockEmbed.data), - ), + : isBase64(imageUrl) + ? Image.memory(base64.decode(imageUrl)) + : FileImage(io.File(imageUrl)), ), ), ); @@ -455,9 +467,6 @@ class _QuillEditorSelectionGestureDetectorBuilder } void _launchUrl(String url) async { - if (!url.startsWith('http')) { - url = 'https://$url'; - } await launch(url); } diff --git a/pubspec.yaml b/pubspec.yaml index 985e81cc..3e87a468 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: One client and affiliated collaborator of Flutter Quill is Bullet Journal App. -version: 0.3.3 +version: 1.0.0 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill.git @@ -12,13 +12,12 @@ environment: dependencies: flutter: sdk: flutter - quill_delta: ^2.0.0 quiver_hashcode: ^2.0.0 - collection: ^1.14.13 - tuple: ^1.0.3 - url_launcher: ^5.7.10 - flutter_colorpicker: ^0.3.5 - image_picker: ^0.6.7+22 + collection: ^1.15.0 + tuple: ^2.0.0-nullsafety.0 + url_launcher: ^6.0.0 + flutter_colorpicker: ^0.4.0-nullsafety.0 + image_picker: ^0.7.0 photo_view: ^0.10.3 universal_html: ^1.2.4 file_picker: ^3.0.0-nullsafety.4