Skip to content

Toolbar - Custom toolbars, Export Toolbar buttons #65

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

Closed
adrian-moisa opened this issue Jul 3, 2022 · 1 comment
Closed

Toolbar - Custom toolbars, Export Toolbar buttons #65

adrian-moisa opened this issue Jul 3, 2022 · 1 comment
Assignees

Comments

@adrian-moisa
Copy link
Collaborator

Currently it is possible only to use the predefined set of buttons. New buttons can be added via the customButtons property however they are inserted only at the end of the toolbar. Adding new editing options in the middle of the Toolbar is impossible. The goal of this ticket is to export the Toolbar buttons such that developers can create custom looking toolbars with a mix of internal buttons and custom made buttons.

Join on discord to get advice and help or follow us on YouTube Visual Coding to learn more about the architecture of Visual Editor and other Flutter apps.

@adrian-moisa
Copy link
Collaborator Author

adrian-moisa commented Jul 3, 2022

Now creating custom toolbars is entirely possible:

Widget _toolbar() => Container(
  padding: const EdgeInsets.symmetric(
    vertical: 16,
    horizontal: 8,
  ),
  child: EditorToolbar(
    children: [
      ToggleStyleButton(
        attribute: AttributeM.bold,
        icon: Icons.format_bold,
        iconSize: toolbarIconSize,
        controller: _controller!,
      ),
      ToggleStyleButton(
        attribute: AttributeM.italic,
        icon: Icons.format_italic,
        iconSize: toolbarIconSize,
        controller: _controller!,
      ),
      Padding(
        padding: const EdgeInsets.only(top: 12),
        child: Text(
          'Custom Content',
          style: TextStyle(
            fontSize: 20,
          ),
        ),
      ),
      ToggleStyleButton(
        attribute: AttributeM.small,
        icon: Icons.format_size,
        iconSize: toolbarIconSize,
        controller: _controller!,
      ),
      ToggleStyleButton(
        attribute: AttributeM.underline,
        icon: Icons.format_underline,
        iconSize: toolbarIconSize,
        controller: _controller!,
      ),
      ToggleStyleButton(
        attribute: AttributeM.strikeThrough,
        icon: Icons.format_strikethrough,
        iconSize: toolbarIconSize,
        controller: _controller!,
      ),
    ],
  ),
);

Screenshot 2022-07-03 at 21 04 56

@adrian-moisa adrian-moisa changed the title Export Toolbar buttons to enable devs to create custom Toolbars Toolbar - Export Toolbar buttons to enable devs to create custom Toolbars Nov 5, 2022
@adrian-moisa adrian-moisa changed the title Toolbar - Export Toolbar buttons to enable devs to create custom Toolbars Toolbar - Custom toolbars, Export Toolbar buttons Nov 5, 2022
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

1 participant