Widgetbook Integration
Widgetbook π is a powerful tool for
developing Flutter widgets in isolation. Vyuh provides first-class integration
with Widgetbook through the vyuh_widgetbook
package, making it easy to preview
and test your content types.
Benefits
π― Isolated Development
Develop and test your content types in isolation, without the complexity of your full application. This makes it easier to:
- Focus on specific components
- Test different states and variations
- Iterate quickly on designs
π Live Preview
See your changes in real-time as you develop:
- Preview content types with different layouts
- Test light and dark themes
- View content at different sizes
π§ͺ Testing Made Easy
The isolated environment makes it easier to:
- Verify content type behavior
- Test different data scenarios
- Ensure consistent styling
- Debug layout issues
Installation
Add the widgetbook package to your project:
Usage
Create a new Flutter app for your widgetbook. Hereβs an example from our Content Explorer π app:
Using in Your App
To use Widgetbook in your own Vyuh app:
- Create a new Flutter app for your widgetbook (e.g.,
my_app_widgetbook
) - Add the
vyuh_widgetbook
dependency - Import your features and their content types
- Use
runWidgetBook
to start the app
Navigation
The widgetbook app organizes your content by:
- Features: Your appβs features are listed in the left sidebar
- Content Types: Each featureβs content types are shown under it
- Layouts: Each content type can have multiple layouts
Best Practices
- Preview Data: Use realistic preview data in your content types:
-
Theme Testing: Always test your content types in both light and dark themes
-
Size Testing: Test your content at different sizes to ensure responsive behavior
Next Steps
- Check out the Content Previews Guide to learn more about content previews
- Visit the Widgetbook documentation π for advanced features
- Explore the Content Explorer π for a complete example