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

Error: The non-abstract class 'RawEditorState' is missing implementations for these members: #64

Closed
mehrdad-shokri opened this issue Mar 7, 2021 · 24 comments

Comments

@mehrdad-shokri
Copy link

Stack trace:

Launching lib/main-dev.dart on Google Pixel 3 in debug mode...
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-1.0.2/lib/widgets/raw_editor.dart:112:7: Error: The non-abstract class 'RawEditorState' is missing implementations for these members:
 - TextSelectionDelegate.userUpdateTextEditingValue                     
Try to either                                                           
 - provide an implementation,                                           
 - inherit an implementation from a superclass or mixin,                
 - mark the class as abstract, or                                       
 - provide a 'noSuchMethod' implementation.                             
                                                                        
class RawEditorState extends EditorState                                
      ^^^^^^^^^^^^^^                                                    
../../../../flutter/packages/flutter/lib/src/services/text_input.dart:822:8: Context: 'TextSelectionDelegate.userUpdateTextEditingValue' is defined here.
  void userUpdateTextEditingValue(TextEditingValue value, SelectionChangedCause cause);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^                                       
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_quill-1.0.2/lib/widgets/raw_editor.dart:1019:8: Error: The method 'RawEditorState.hideToolbar' has fewer positional arguments than those of overridden method 'TextSelectionDelegate.hideToolbar'.
  void hideToolbar() {                                                  
       ^                                                                
../../../../flutter/packages/flutter/lib/src/services/text_input.dart:829:8: Context: This is the overridden method ('hideToolbar').
  void hideToolbar([bool hideHandles = true]);                          
       ^                                                                
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/home/mehrdad/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1029
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildDevDebug'.           
> Process 'command '/home/mehrdad/flutter/bin/flutter'' finished with non-zero exit value 1
                                                                        
* 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 1m 45s

pubspec.yml
flutter_quill: ^1.0.2

flutter doctor

▶ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.1.0-11.0.pre.145, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)

• No issues found!


@singerdmx
Copy link
Owner

Mobile or web?
You need to provide more details

@suramhome
Copy link

mobile... I am facing same issue...

@singerdmx
Copy link
Owner

Seriously guys, please clarify what you did. Are you using app folder?

@singerdmx
Copy link
Owner

If you ask questions without those details, you don't deserve to get help

@suramhome
Copy link

suramhome commented Mar 7, 2021

Okay... I am a noob to Flutter.. so I just followed the instructions on pub.dev

return Scaffold(
      appBar: AppBar(
        title: Text('New Post'),
      ),
      body: Column(
        children: [
          Expanded(
            child: Container(
              child: QuillEditor.basic(
                controller: _controller,
                readOnly: false,
              ),
            ),
          ),
          QuillToolbar.basic(
            controller: _controller,
            toolbarIconSize: 25,
          ),
        ],
      ),
    );

@singerdmx
Copy link
Owner

I think I should get rid of that basic example.
Please go through README

@singerdmx
Copy link
Owner

@suramhome
Copy link

Thanks for quick responses.. will work on the changes needed... Appreciate all the help! Keep rocking!

@mehrdad-shokri
Copy link
Author

mehrdad-shokri commented Mar 7, 2021

@singerdmx I think that url should fix it. I also have a question about RTL does this library support it?

@singerdmx
Copy link
Owner

@mehrdad-shokri no, check out #2

@mehrdad-shokri
Copy link
Author

@singerdmx if I work on it will you consider to add that to your lib?

@singerdmx
Copy link
Owner

Sure. Why not?

@singerdmx
Copy link
Owner

singerdmx commented Mar 7, 2021

Do note that you will need to add a button in the toolbar for that

@mehrdad-shokri
Copy link
Author

So that button is supposed to change the line's direction to RTL(and also upcoming lines)?

@singerdmx
Copy link
Owner

Check out https://quilljs.com/docs/formats/

image

@singerdmx
Copy link
Owner

The experience should be similar to QuillJS
Also your generated data must be the same as QuillJS generated - I mean attribute

@singerdmx
Copy link
Owner

image

I think it is this

@singerdmx
Copy link
Owner

You can refer to https://github.com/memspace/zefyr/pull/438/files and how align is done currently

@mehrdad-shokri
Copy link
Author

mehrdad-shokri commented Mar 7, 2021

@singerdmx I'm still having this error on my build. here's my code the only difference it had with example app was RawKeyboardListener which I have now but still facing the error.

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_quill/models/documents/attribute.dart';
import 'package:flutter_quill/models/documents/document.dart';
import 'package:flutter_quill/widgets/controller.dart';
import 'package:flutter_quill/widgets/editor.dart';
import 'package:flutter_quill/widgets/toolbar.dart';
import 'package:shanbe/l10n/app_localizations.dart';
import 'package:shanbe/redux/models/todo.dart';
import 'package:shanbe/utils/constants.dart';
import 'package:shanbe/utils/utils.dart';
import 'package:url_launcher/url_launcher.dart';

class TodoNotePage extends StatefulWidget {
  final TodoNotePageData data;

  final Todo todo;
  final Function onTodoEdit;

  TodoNotePage(this.data)
      : todo = data.todo,
        onTodoEdit = data.onTodoEdit;

  @override
  _TodoNotePageState createState() => _TodoNotePageState();
}

class _TodoNotePageState extends State<TodoNotePage> {
  QuillController controller;
  FocusNode editorFocusNode;
  AppLocalizations t;
  ScrollController scrollController;

  @override
  void initState() {
    super.initState();
    print('${widget.todo.note}');

    controller = QuillController(
        document: widget.todo.note != null
            ? Document.fromJson(jsonDecode(widget.todo.note))
            : null,
        selection: TextSelection.collapsed(offset: 0));
    editorFocusNode = FocusNode();
    scrollController = ScrollController();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    t ??= AppLocalizations.of(context);
    return Scaffold(
        appBar: AppBar(
          title: Text(
            widget.todo.title,
            style: TextStyle(
                fontSize: Constants.MEDIUM_FONT,
                color: Constants.TEXT_COLOR,
                fontFamily: currentFontName(context)),
          ),
          backgroundColor: Theme.of(context).canvasColor,
        ),
        body: RawKeyboardListener(
          focusNode: FocusNode(),
          onKey: (RawKeyEvent event) {
            if (event.data.isControlPressed && event.character == 'b') {
              if (controller
                  .getSelectionStyle()
                  .attributes
                  .keys
                  .contains("bold")) {
                controller
                    .formatSelection(Attribute.clone(Attribute.bold, null));
              } else {
                controller.formatSelection(Attribute.bold);
                print("not bold");
              }
            }
          },
          child: Column(
            children: [
              Expanded(
                child: QuillEditor(
                  controller: controller,
                  padding: EdgeInsets.symmetric(horizontal: 8),
                  focusNode: editorFocusNode,
                  expands: true,
                  keyboardAppearance: Brightness.dark,
                  showCursor: true,
                  onLaunchUrl: _launchUrl,
                  scrollable: true,
                  autoFocus: true,
                  readOnly: false,
                  scrollController: scrollController,
                  enableInteractiveSelection: true,
                  // scrollable: false,
                ),
              ),
              Card(
                elevation: 4,
                margin: EdgeInsets.zero,
                shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero),
                child: QuillToolbar.basic(
                    controller: controller, showBackgroundColorButton: true),
              )
            ],
          ),
        ));
  }

  void _launchUrl(String url) async {
    if (await canLaunch(url)) {
      await launch(url);
    }
  }
}

class TodoNotePageData {
  final Todo todo;
  final Function onTodoEdit;

  TodoNotePageData(this.todo, this.onTodoEdit);
}

@singerdmx
Copy link
Owner

Remove the difference, does it work?

@mehrdad-shokri
Copy link
Author

Actually the problem got resolved after I switched to stable channel

@singerdmx
Copy link
Owner

Check ur flutter version

@Enzodtz
Copy link

Enzodtz commented May 26, 2021

Hey, I'm facing the same issue at flutter 2.0.6 stable, also tried at 2.2.0. I got the error after trying to Product > Archive the app in XCode, but I was able to build the android bundle normally (in other machine). What should I do?

@Enzodtz
Copy link

Enzodtz commented May 26, 2021

I tried to run from the terminal with --no-sound-null-safety and it seems to work fine.

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

4 participants