Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getText() doesn't work first time when it's called #32

Open
misici234 opened this issue Mar 31, 2021 · 1 comment
Open

getText() doesn't work first time when it's called #32

misici234 opened this issue Mar 31, 2021 · 1 comment

Comments

@misici234
Copy link

I noticed that getText() doesn't work first time when it's called. When I wait a little bit and call it again then I get the HTML content from FlutterSummernote() widget. I implemented following and ugly workaround to this problem.


GlobalKey<FlutterSummernoteState> keyEditor = GlobalKey();
...
                        progressNote.prnoMemo = await keyEditor.currentState?.getText();
                        // getText() is buggy and doesn't work first time when it's called
                        await Future.delayed(Duration(milliseconds: 500));
                        progressNote.prnoMemo = await keyEditor.currentState?.getText();
                        print('from HTML editor :  ${progressNote.prnoMemo}');
...
              FlutterSummernote(
                height: 350,
                value: progressNote.prnoMemo,
                hint: progressNote.prnoMemo == null ? 'Enter your note here...' : '',
                key: keyEditor,
...


Please investigate and resolve this problem.
I use flutter_summernote: ^0.2.3 in my pubspec.yaml file and
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)

@tneotia
Copy link

tneotia commented Mar 31, 2021

#22 is a similar issue. This is due to the way this library does communication between Dart and JS and the maintainer will need to write the code a different way to get the text without the "lag".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants