package:widgetbook_generator allows to generate and setup code for package:widgetbook which simplifies using and maintaining Widgetbook.
Before you start
Before you start with this package, we recommend to read the documentation of package:widgetbook or watch the videos What is Widgetbook and How to use Widgetbook.
Packages
This package requires the following dependency:
Package | Pub |
---|---|
package:widgetbook_annotation |
and the following dev dependencies:
Package | Pub |
---|---|
package:widgetbook | |
package:widgetbook_generator | |
package:build_runner |
The pubspec.yaml
file could look like this:
dependencies:
widgetbook_annotation:
dev_dependencies:
widgetbook:
build_runner:
widgetbook_generator:
Annotations
The generator works with the annotations documented at package:widgetbook_annotation.
Run the generator
The generator defined in this package uses package:build_runner to generate the desired code.
You can execute the generator by running flutter pub run build_runner build
.
If you are making a lot of changes while developing, you can also run flutter pub run build_runner watch
so package:build_runner will listen for changes in the file system and update Widgetbook accordingly.
Start the generated app
The generator will create the app.widgetbook.dart
file in the same directory as the file in which @WidgetbookApp
is used. For details about this, see the documentation of package:widgetbook_annotation.
Start the app by running flutter run lib/app.widgetbook.dart
.
Hot reloading
Hot reloading of changes in Widgetbook works out of the box. For limitations see package:widgetbook.
Let us know how you feel about Widgetbook
We are funded and aim to shape Widgetbook
to your (and your team's) needs. If you have questions, feature requests or issues let us know on Discord or GitHub or book a call with the founders via Calendly. We're looking forward to build a community and discuss your feedback on our channel! 💙
Libraries
- builder
- builders/json_builder
- code_generators/instances/app_info_instance
- code_generators/instances/base_instance
- code_generators/instances/boolean_instance
- code_generators/instances/device_instance
- code_generators/instances/device_size_instance
- code_generators/instances/device_type_instance
- code_generators/instances/double_instance
- code_generators/instances/function_call_instance
- code_generators/instances/instance
- code_generators/instances/lambda_instance
- code_generators/instances/list_instance
- code_generators/instances/primary_instance
- code_generators/instances/resolution_instance
- code_generators/instances/string_instance
- code_generators/instances/theme_instance
- code_generators/instances/theme_mode_instance
- code_generators/instances/widgetbook_category_instance
- code_generators/instances/widgetbook_folder_instance
- code_generators/instances/widgetbook_instance
- code_generators/instances/widgetbook_use_case_instance
- code_generators/instances/widgetbook_widget_instance
- code_generators/properties/property
- extensions/element_extensions
- extensions/list_extension
- generators/app_generator
- generators/imports_generator
- generators/main_generator
- generators/widgetbook_generator
- json_formatter
- models/generated_output
- models/widgetbook_data
- models/widgetbook_story_data
- models/widgetbook_theme_data
- readers/annotation_reader
- readers/device_reader
- readers/device_size_reader
- readers/device_type_reader
- readers/resolution_reader
- resolvers/story_resolver
- resolvers/theme_resolver
- services/tree_service
- widgetbook_generator