Install

Welcome to Widgetbook! This guide will help you integrate Widgetbook into your Flutter projects and streamline your widget management process.

Make sure to depend on the Widgetbook packages.

There are two approaches to configuring Widgetbook:

  1. Manual Approach: This approach involves using the widgetbook package and manually maintaining the widget structure in Widgetbook to keep it in sync with your application.

  2. Generator Approach: widgetbook_generator ensures harmony between your codebase and the Widgetbook's navigation panel structure. Its robust features make it a sought-after solution for hassle-free Widgetbook management. Here are some key benefits of using widgetbook_generator:

    • Accurately mirrors your codebase within the Widgetbook's navigation panel, keeping track of file movement or restructuring.
    • Ensures that the names of all WidgetbookComponents correspond to the widgets' names, even when renamed.
    • It simplifies the setup process, allowing you to get started quickly.
    • Seamlessly integrates with Widgetbook Cloud for an optimized workflow.
We recommend using the Generator approach over the Manual approach.

To get started with the widgetbook you'll need the following production dependency:

flutter pub add widgetbook_annotation widgetbook

and the following dev dependencies:

flutter pub add widgetbook_generator  build_runner --dev

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  widgetbook_annotation: ^3.1.0
  widgetbook: ^3.6.0

dev_dependencies:
  widgetbook_generator: ^3.5.0
  build_runner:

Alternatively, your editor might support flutter pub get.

With widgetbook_generator at your disposal, managing Widgetbook becomes effortless. Start using it today and let the generator take care of the grunt work, allowing you to focus on what you do best - creating excellent code.

With these approaches in mind, you can now begin integrating Widgetbook into your project and enjoy the benefits of streamlined widget management and collaboration.