singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.6k stars 839 forks source link

Open URLs to launch browser - support across desktop and mobile? #2342

Open jaibyron opened 3 weeks ago

jaibyron commented 3 weeks ago

Is there an existing issue for this?

The question

I'm testing how URLs launch on different platforms at the moment and finding that clicking on URLs in the editor launches a URL (in another tab) if I run on Chrome but I get no response when I click on the URL for iOS or Android. Am I missing something obvious?

(I'm running v8.6.4 btw)


Widget _noteView() {
    return Container(
      height: screenHeight,
      width: MediaQuery.sizeOf(context).width * 2 / 3,
      color: Colors.white,
      child: QuillProvider(
        configurations: QuillConfigurations(
          controller: _controller,
          sharedConfigurations: const QuillSharedConfigurations(
            locale: Locale('en'),
          ),
        ),
        child: Column(
          children: [
            const QuillToolbar(),
            Expanded(
              child: QuillEditor.basic(
                configurations: QuillEditorConfigurations(
                  readOnly: false,
                  customStyles: const DefaultStyles(
                    link: TextStyle(
                        color: Colors.blue,
                        fontWeight: FontWeight.bold,
                        decoration: TextDecoration.underline,
                        decorationColor: Colors.blue),
                  ),
                  onLaunchUrl: (value) async {
                    debugPrint('You clicked on $value');
                    final Uri url = Uri.parse(value);
                    await launchUrl(url);
                  },
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
EchoEllet commented 3 weeks ago

(I'm running v8.6.4 btw)

Are there any blockers that prevent migrating to a newer version?

Am I missing something obvious?

We do use theurl_launcher plugin. Can you update the dependencies (including transitive ones) to their latest version and try again?

jaibyron commented 3 weeks ago

(I'm running v8.6.4 btw)

Are there any blockers that prevent migrating to a newer version?

Am I missing something obvious?

We do use theurl_launcher plugin. Can you update the dependencies (including transitive ones) to their latest version and try again?

Still get the same issue.

Updated to version 9.3.11 (I'm constrained by Flutter version at the moment - 3.19.5 )

url_launcher is v6.3.1 which I think is the latest

EchoEllet commented 3 weeks ago

Can you share a video showing the issue on Android or iOS? Did you encounter this issue on the web?

Updated to version 9.3.11 (I'm constrained by Flutter version at the moment - 3.19.5 )

The pubspec.yaml constraints of flutter_quill support Flutter 3.19.5.

What is the blocker when using Flutter Quill 10.8.5 and Flutter 3.19.5?

jaibyron commented 3 weeks ago

Can you share a video showing the issue on Android or iOS? Did you encounter this issue on the web?

There is no issue on the web (as mentioned in the original post) - it just fails for iOS or Android mobile.

Updated to version 9.3.11 (I'm constrained by Flutter version at the moment - 3.19.5 )

The pubspec.yaml constraints of flutter_quill support Flutter 3.19.5.

What is the blocker when using Flutter Quill 10.8.5 and Flutter 3.19.5?

If I use Flutter Quill 10.8.5 with Flutter 3.19.5 then flutter pub get fails as below:

Resolving dependencies... 
Because flutter_quill >=9.3.12 depends on intl ^0.19.0 and su depends on intl 0.18.1, flutter_quill >=9.3.12 is forbidden.
So, because su depends on flutter_quill 10.8.5, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on flutter_quill: flutter pub add flutter_quill:^9.3.11

If I try updating my intl package to 0.19.0 then I see:

Resolving dependencies...
The current Dart SDK version is 3.3.3.

Because flutter_quill >=10.6.1 depends on flutter_quill_delta_from_html >=1.1.5 which requires SDK version >=3.4.3 <4.0.0, flutter_quill >=10.6.1 is forbidden.
So, because su depends on flutter_quill 10.8.5, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on flutter_quill: flutter pub add flutter_quill:^2.0.7
exit code 1

iPad Recording

https://github.com/user-attachments/assets/d242bc1b-19a6-42c7-8c18-05757cc07698

Web Recording

https://github.com/user-attachments/assets/11cecb01-37b7-4f42-8337-e1f651943175

Any ideas?

EchoEllet commented 3 weeks ago

Any ideas?

It's solvable. We need to lower the version constraints in pubspec.yaml to a compatible one since we don't need any specific features in 0.19.0.

As for the flutter_quill_delta_from_html, we only need to update the pubspec.yaml constraints.

I will fix this issue soon.

EchoEllet commented 2 weeks ago

(I'm constrained by Flutter version at the moment - 3.19.5 )

You should be able to use the latest version now, though the issue was only fixed in the pre-release (see #2338). It will become stable once we do more tests.

jaibyron commented 2 weeks ago

(I'm constrained by Flutter version at the moment - 3.19.5 )

You should be able to use the latest version now, though the issue was only fixed in the pre-release (see #2338). It will become stable once we do more tests.

thanks for the update but could do with some help to test the pre-release

I deleted my pubspec.lock

In my pubspec.yaml I have:

dependencies:

  intl: 0.18.1
  flutter_quill: 10.8.5

dependency_overrides:
  flutter_quill:
    git:
      url: https://github.com/singerdmx/flutter-quill.git
      ref: release/v11
  flutter_quill_extensions:
    git:
      url: https://github.com/singerdmx/flutter-quill.git
      ref: release/v11
      path: flutter_quill_extensions

But running flutter pub get seems to indicate the flutter-quill.git still depends on intl 0.19.0? as I get the following output:

Because every version of flutter_quill from git depends on intl ^0.19.0 and su depends on intl 0.18.1, flutter_quill from git is forbidden.
So, because su depends on flutter_quill from git, version solving failed.
EchoEllet commented 2 weeks ago

I was unable to use a version other than 0.19.0 of intl to avoid CI failure.

Use the latest version from the release/v11 branch. The changes that fix this issue are not published as pre-release yet.

# TODO: Remove once https://github.com/singerdmx/flutter-quill/pull/2338 is published
dependency_overrides:
  flutter_quill:
    git:
      url: https://github.com/singerdmx/flutter-quill.git
      ref: release/v11
  flutter_quill_extensions:
    git:
      url: https://github.com/singerdmx/flutter-quill.git
      ref: release/v11
      path: flutter_quill_extensions

Refer to the migration guide to migrate from 10.0.0 to 11.0.0.

dependency_overrides:
  intl: ^0.19.0

Ensure that the dependencies dart_quill_delta and flutter_quill_delta_from_html use their latest versions (10.8.2 and 1.4.2 at the time) since the constraints has been improved in those versions.

After following all those steps, if you're still facing this issue, share the pubspec.lock file, and the error.

jaibyron commented 2 weeks ago

@EchoEllet - thanks for the feedback.

FYI: I tried with flutter_quill: 10.8.5 and installed the latest stable flutter SDK - Flutter - 3.24.4. and the issue with URLs not opening on mobile also seems to be with this version. URLs open from flutter web just fine though.