visual-space / visual-editor

Rich text editor for Flutter based on Delta format (Quill fork)
MIT License
290 stars 47 forks source link

Sys - Upgrade to latest Flutter/Dart 3, Update libs #234

Closed LuchoTurtle closed 1 year ago

LuchoTurtle commented 1 year ago

Hello visual-editor team! 👋

Thanks for the package! It looks awesome! 🥳

I'm trying to get it working on a project that uses flutter-quill and I'm migrating it to visual-editor. This project has the following constraints:

environment:
  sdk: '>=3.0.5 <4.0.0'

Initially, I was using flutter_quill_extensions and, when installing visual_editor, I'm prompted with the following error:

Because every version of visual_editor from git depends on string_validator ^0.3.0 and flutter_quill_extensions >=0.2.0 depends on string_validator ^1.0.0, visual_editor from git is incompatible with flutter_quill_extensions
  >=0.2.0.
So, because app depends on both flutter_quill_extensions ^0.4.0 and visual_editor from git, version solving failed.

I've removed flutter_quill_extensions to surpass this obstacle but, after trying to install again, I got the following error:

Because no versions of mockito match >5.4.2 <6.0.0 and mockito 5.4.2 depends on analyzer ^5.11.0, mockito ^5.4.2 requires analyzer ^5.11.0.
And because every version of visual_editor from git depends on i18n_extension ^4.2.1 which depends on analyzer ^3.0.0, mockito ^5.4.2 is incompatible with visual_editor from git.
So, because app depends on both visual_editor from git and mockito ^5.4.2, version solving failed.

Because I'm using mockito for testing purposes, and it depends on a newer version of analyzer, it fails.

I propose upgrading visual_editor's dependencies so this issue is surpassed :) I'll try to open a PR addressing these issues :D

adrian-moisa commented 1 year ago

Glad to hear it's making a good first impression. I wished it had more progress done by now, but you know, always juggling 10 plates. If you can run the update I'll gladly merge your PR. We kept pushing it because we did not upgrade our setup yet to Flutter 3. I think there are some new life cycle calls that need to be implemented, or at least stubbed. You could trace the Quill log and check what they had to do to get it working on F3. If you are stuck I'll jump in and try it myself. Cheers!

adrian-moisa commented 1 year ago

I think we have it duped here: #202. We can continue work here, I just renamed. Quick info. We do one ticket one commit and we use rebase. Such that we keep the gitlog very clean.

LuchoTurtle commented 1 year ago

Thanks @adrian-moisa for the reply! The PR seems simple. I'm taking a look at the erroring packages (e.g. https://github.com/marcglasberg/i18n_extension/blob/master/CHANGELOG.md) and the breaking changes seem to not affect visual-editor.

However, I'm having a bit of trouble getting the example app running 😥. I've cloned the repo and installed the dependencies but I keep stumbling upon errors like:

: Error: Type 'BidirectionalIterator' not found.
vertical-caret-movement-run.controller.dart:10
    extends BidirectionalIterator<TextPosition> {
            ^^^^^^^^^^^^^^^^^^^^^
: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.
google_fonts_base.dart:14
import 'asset_manifest.dart';

I've noticed that while installing, some classes are not available. For example:

image

I don't know if this is related to the dependencies or to the example app running a specific version of Flutter. I was in the process of opening an issue on this. Am I missing something? 👀

CristiSch commented 1 year ago

Hi @LuchoTurtle! I'm one of the maintainers of visual-editor.

We are currently running this repo using: Flutter: 3.7.7 Dart: 2.19.4

Downgrading to this version should enable you to run the example app.

If you are unsure how to downgrade:

We can chat over our discord server if you need more assistance as well, ping @crystone2 over there.

adrian-moisa commented 1 year ago

@LuchoTurtle I think this is the one of the changes we have to make due to upgrade to Flutter 3. If you are stuck on it and can't find your way I'll check it myself. Though Today and tomorrow I'm under unusual circumstances, can't spend much time on it. No promise. Soonest will ne Thursday. Until then if you are stuck you can attempt to revert Flutter to a prior versions if it's possible. Drop me an update with your situation.

LuchoTurtle commented 1 year ago

Hey @CristiSch , thanks for helping out!

~I have downgraded according to your instructions and I've inclusively ran flutter clean and flutter pub get again just to be sure and I can't get the example going :(~

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                     │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update /Users/lucho/Documents/dwyl/visual-editor/example/android/build.gradle:             │
│ ext.kotlin_version = '<latest-version>'                                                    │
└────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
Exited

UPDATE:

Got it working by downgrading Flutter and Dart to the given version in the comment.

Notice that I got it working on Android (I'm going to try and see if it works on iOS and web next). Though I had to make some updates to the Gradle code:

    ext.kotlin_version = '1.9.10'

    ...

    classpath 'com.android.tools.build:gradle:7.2.0'

    ...

    tasks.register("clean", Delete) {
        delete rootProject.buildDir
    }
...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

Should I open a PR for this? Is it perhaps an "on my computer only" type thing? I can work on this PR and upgrade dependencies all in one go, if y'all want :D

adrian-moisa commented 1 year ago
image

I've just upgraded my setup to latest

image

I'll take a stab at it to see if I can fix it with minimal intervention. Though I have limited time today. I'll keep you posted. Fingers crossed.

As expected:

image
LuchoTurtle commented 1 year ago

@adrian-moisa cheers for that. Though I can also give it a whirl as well and create a PR solely for updating Flutter incrementally. It might take some time but I think it's well worth it

adrian-moisa commented 1 year ago

One way or another we have to bring this repo up to speed. People are needing it. This upgrade is overdue. Since we have new stakeholders there's more motivation to get it done. Teamwork.

Edit Also upgraded repo to latest libs. To make sure we are not missing out on smth.

adrian-moisa commented 1 year ago

Ok, I've upgraded to latest dart. Now it should be working. There are still some deprecation warnings in the console but they are not show stoppers. I don't have time to fix them now. It's second prio for me.

image

I'm not sure if your PR is now valid. If it's still valid let's move it to a different ticket. We have a policy of on ticket one commit. I'm not entirely sure if you need the changes or not. Or what was the task there. So please open a new one if you still have code to commit from that one. I'll close this one since the upgrade was done.

LuchoTurtle commented 1 year ago

Cheers @adrian-moisa ! My PR indeed mostly overlaps with the changes you've made. So I'm closing it.

I was working on getting the dependencies updated, as well, to resolve the dependency issues I was having prior. Perhaps it makes sense to copy and shift into a new PR 👌

adrian-moisa commented 1 year ago

What's your timezone? I'm going out. I have to wakeup again in 6h. GMT+1 here