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

Fixes for previous step #1467

Merged
merged 10 commits into from
Oct 24, 2023
Merged

Fixes for previous step #1467

merged 10 commits into from
Oct 24, 2023

Conversation

EchoEllet
Copy link
Collaborator

@EchoEllet EchoEllet commented Oct 24, 2023

Important changes for previous steps
this update should be published as it is required for fresh_quill_extensions which will be a temp alternative to flutter_quill_extensions

Also, it's updated some of the old documentation in readme

@EchoEllet EchoEllet requested a review from singerdmx October 24, 2023 16:25
@singerdmx
Copy link
Owner

FYI I won't be able to publish it until 7 hours later

@EchoEllet
Copy link
Collaborator Author

FYI I won't be able to publish it until 7 hours later

This is up to you but why not?

@singerdmx
Copy link
Owner

Because I don't have my computer

@EchoEllet
Copy link
Collaborator Author

EchoEllet commented Oct 24, 2023

Because I don't have my computer

Sounds tough, then I will work on the new package more by refactoring things
The latest versions of Flutter have more warnings than the ones we are using in flutter_quill and flutter_quill_extensions
we are using an old version because of the minimum version

@mtallenca
Copy link
Contributor

I'm using this commit and have a custom tool bar with the following code...

quill.QuillToolbarProvider(
                toolbarConfigurations: quill.QuillToolbarConfigurations(
                  toolbarSize: toolbarIconSize * 2,
                  multiRowsDisplay: false,
                ),
                child: quill.QuillBaseToolbar(
                  configurations: quill.QuillBaseToolbarConfigurations(
                    toolbarSize: toolbarIconSize * 2,
                    multiRowsDisplay: false,
                    childrenBuilder: (context) {

w/o a QuillToolbarProvider - there is an exception.... So I need a Provider, however, the same settings are in the QuillBaseToolbarConfigurations. Do I need the same settings ?

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider

The QuillToolbarProvider is responsible for providing the toolbar the configurations instance it needs for it children internally
The QuillProvider define the shared settings between both toolbar and the editor

@EchoEllet
Copy link
Collaborator Author

I'm using this commit and have a custom tool bar with the following code...

quill.QuillToolbarProvider(
                toolbarConfigurations: quill.QuillToolbarConfigurations(
                  toolbarSize: toolbarIconSize * 2,
                  multiRowsDisplay: false,
                ),
                child: quill.QuillBaseToolbar(
                  configurations: quill.QuillBaseToolbarConfigurations(
                    toolbarSize: toolbarIconSize * 2,
                    multiRowsDisplay: false,
                    childrenBuilder: (context) {

w/o a QuillToolbarProvider - there is an exception.... So I need a Provider, however, the same settings are in the QuillBaseToolbarConfigurations. Do I need the same settings ?

Example of how it will look like from the end developer perspective:

QuillProvider(
          configurations: QuillConfigurations(
            controller: _controller,
            sharedConfigurations: const QuillSharedConfigurations(
              locale: Locale('de'),
            ),
          ),
          child: Column(
            children: [
              const QuillToolbar(),
              Expanded(
                child: QuillEditor.basic(
                  configurations: const QuillEditorConfigurations(
                    readOnly: false,
                  ),
                ),
              )
            ],
          ),
        )

For creating a custom toolbar with this library support You need to use QuillBaseToolbar and it uses a provider for the QuillToolbarProvider internally so no need for creating a second provider, just the quill provider for shared configurations

@EchoEllet
Copy link
Collaborator Author

I'm using this commit and have a custom tool bar with the following code...

quill.QuillToolbarProvider(
                toolbarConfigurations: quill.QuillToolbarConfigurations(
                  toolbarSize: toolbarIconSize * 2,
                  multiRowsDisplay: false,
                ),
                child: quill.QuillBaseToolbar(
                  configurations: quill.QuillBaseToolbarConfigurations(
                    toolbarSize: toolbarIconSize * 2,
                    multiRowsDisplay: false,
                    childrenBuilder: (context) {

w/o a QuillToolbarProvider - there is an exception.... So I need a Provider, however, the same settings are in the QuillBaseToolbarConfigurations. Do I need the same settings ?

If you are still facing the issue or any others, please let me know

@mtallenca
Copy link
Contributor

QuillBaseToolbar throws an exception if no provider is defined above it.

@EchoEllet
Copy link
Collaborator Author

QuillBaseToolbar throws an exception if no provider is defined above it.

Do you mean QuillProvider or QuillToolbarProvider?? it only needs QuillProvider

@mtallenca
Copy link
Contributor

QuillToolbarProvider. When it's not provided QuillBaseToolbar throws an exception.

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider. When it's not provided QuillBaseToolbar throws an exception.

Hi. Can you send me the code snippets to encounter the issue??

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider. When it's not provided QuillBaseToolbar throws an exception.

Because if you are using QuillToolbar or QuillBaseToolbar it already defined internally for you, you don't have to wrap your widget with it

@mtallenca
Copy link
Contributor

QuillToolbarProvider_Exception.zip

working code / exception code w/diff, exception and stack trace of exception

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider_Exception.zip

working code / exception code w/diff, exception and stack trace of exception

Thank you for the report once again, I will checkout soon

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider_Exception.zip

working code / exception code w/diff, exception and stack trace of exception

I'm able to encounter the issue, give us some time to debug it and we will see what we can do to fix this issue

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider_Exception.zip

working code / exception code w/diff, exception and stack trace of exception

Issue fixed, it require a little adjusments from the library side but there is another issue

you are using the buttons of the QuillToolbar outside of it, the buttons need the `QuillToolbarProvider above of them

it should look something like this

  QuillToolbarProvider(
                toolbarConfigurations: const QuillToolbarConfigurations(),
                child: QuillBaseToolbar(
                  configurations: QuillBaseToolbarConfigurations(
                    toolbarSize: 15 * 2,
                    multiRowsDisplay: false,
                    childrenBuilder: (context) {
                      final controller = context.requireQuillController;
                      return [
                        QuillToolbarHistoryButton(
                          controller: controller,
                          options: const QuillToolbarHistoryButtonOptions(
                              isUndo: true),
                        ),
                        QuillToolbarHistoryButton(
                          controller: controller,
                          options: const QuillToolbarHistoryButtonOptions(
                              isUndo: false),
                        ),
                        QuillToolbarToggleStyleButton(
                          attribute: Attribute.bold,
                          controller: controller,
                          options: const QuillToolbarToggleStyleButtonOptions(
                            iconData: Icons.format_bold,
                            iconSize: 20,
                          ),
                        ),
                        QuillToolbarToggleStyleButton(
                          attribute: Attribute.italic,
                          controller: controller,
                          options: const QuillToolbarToggleStyleButtonOptions(
                            iconData: Icons.format_italic,
                            iconSize: 20,
                          ),
                        ),
                        QuillToolbarToggleStyleButton(
                          attribute: Attribute.underline,
                          controller: controller,
                          options: const QuillToolbarToggleStyleButtonOptions(
                            iconData: Icons.format_underline,
                            iconSize: 20,
                          ),
                        ),
                        QuillToolbarClearFormatButton(
                          controller: controller,
                          options: const QuillToolbarClearFormatButtonOptions(
                            iconData: Icons.format_clear,
                            iconSize: 20,
                          ),
                        ),
                        // if (widget.note.type == UserItemType.note.index)
                        //   PasteButton(
                        //     icon: AppIcons.selectionPaste,
                        //     iconSize: toolbarIconSize,
                        //     controller: controller,
                        //     undo: true,
                        //   ),
                        VerticalDivider(
                          indent: 12,
                          endIndent: 12,
                          color: Colors.grey.shade400,
                        ),
                        QuillToolbarSelectHeaderStyleButtons(
                          controller: controller,
                          options:
                              const QuillToolbarSelectHeaderStyleButtonsOptions(
                            iconSize: 20,
                          ),
                        ),
                        QuillToolbarToggleStyleButton(
                          attribute: Attribute.ol,
                          controller: controller,
                          options: const QuillToolbarToggleStyleButtonOptions(
                            iconData: Icons.format_list_numbered,
                            iconSize: 20,
                          ),
                        ),
                        QuillToolbarToggleStyleButton(
                          attribute: Attribute.ul,
                          controller: controller,
                          options: const QuillToolbarToggleStyleButtonOptions(
                            iconData: Icons.format_list_bulleted,
                            iconSize: 20,
                          ),
                        ),
                        QuillToolbarToggleStyleButton(
                          attribute: Attribute.blockQuote,
                          controller: controller,
                          options: const QuillToolbarToggleStyleButtonOptions(
                            iconData: Icons.format_quote,
                            iconSize: 20,
                          ),
                        ),
                        VerticalDivider(
                          indent: 12,
                          endIndent: 12,
                          color: Colors.grey.shade400,
                        ),
                        QuillToolbarIndentButton(
                            controller: controller,
                            isIncrease: true,
                            options: const QuillToolbarIndentButtonOptions(
                              iconData: Icons.format_indent_increase,
                              iconSize: 20,
                            )),
                        QuillToolbarIndentButton(
                          controller: controller,
                          isIncrease: false,
                          options: const QuillToolbarIndentButtonOptions(
                            iconData: Icons.format_indent_decrease,
                            iconSize: 20,
                          ),
                        ),
                      ];
                    },
                  ),
                ),
              ),

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider_Exception.zip

working code / exception code w/diff, exception and stack trace of exception

Also the extension functions for BuildContext is now public after this pull request so you can use

final controller = context.requireQuillController;

for a little bit better syntax, shorter and cleaner

@EchoEllet
Copy link
Collaborator Author

QuillToolbarProvider_Exception.zip

working code / exception code w/diff, exception and stack trace of exception

Please let me know if you still facing this issue or others

@mtallenca
Copy link
Contributor

Working with latest commit thx!

@EchoEllet
Copy link
Collaborator Author

Working with latest commit thx!

You are welcome!!

@EchoEllet EchoEllet added the documentation Improvements or additions to documentation label Oct 24, 2023
@EchoEllet EchoEllet added the enhancement New feature or request label Oct 24, 2023
@singerdmx singerdmx merged commit 8149e2b into singerdmx:master Oct 24, 2023
1 check passed
@singerdmx
Copy link
Owner

I will publish it in 30 min

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants