Setup with Demo Project
This guide will walk you through setting up a demo project to test Widgetbook Cloud. We'll use the groceries-demo repository as our example project.
Prerequisites
Before starting this guide, make sure you have:
- An account for GitHub, GitLab, or Bitbucket
- Access to Widgetbook Cloud
- Basic knowledge of Git and your chosen Git provider
Steps
Clone the Demo Repository
Since you're using GitHub, you can fork the repository directly:
- Navigate to the groceries-demo repository
- Click the Fork button in the top-right corner
- Select your personal account as the destination
- Wait for the forking process to complete
- Clone your forked repository:
git clone https://github.com/YOUR_USERNAME/groceries-demo.git cd groceries-demo
Use your personal GitHub account for forking, as business accounts might lack permission to connect repositories to Widgetbook Cloud.
Create a Widgetbook Cloud Workspace
- Navigate to Widgetbook Cloud
- Sign in with your account
- Click Create Workspace or use an existing workspace
- Enter a name for your workspace (e.g., "Demo Workspace")
- Click Create to finalize the workspace creation
Create a Widgetbook Cloud Project
- In your Widgetbook Cloud workspace, click Create Project
- Select GitHub as your Git provider
- If you haven't connected your GitHub account yet, click Connect GitHub and follow the authorization process
- Search for your forked
groceries-demo
repository - Select the repository and click Import Project
- Wait for the project to be created and initialized
Get the API Key
- In your newly created Widgetbook Cloud project, navigate to Settings
- Find the API Key section
- Copy the API key
Keep this API key secure. You'll need it to configure your CI/CD pipeline to upload builds to Widgetbook Cloud.
Add the API Key to Your Git Provider
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click New repository secret
- Set the name to
WIDGETBOOK_CLOUD_API_KEY
- Set the value to your API key from Widgetbook Cloud
- Click Add secret
Re-run the CI/CD Pipeline
- Go to your GitHub repository
- Navigate to Actions tab
- Enable GitHub Actions for the forked repository
- Go to the Widgetbook Cloud Action and run it.
- Wait for the workflow to complete
After the pipeline completes successfully, you should see a new build appear in your Widgetbook Cloud project's builds section.
Create a Component Change and Pull Request
- Create a new branch for your changes:
git checkout -b feature/update-border-radius
- Change the border radius
full
in thelib/ui/foundation/radius.dart
file to0
.
class DesignSystemRadius { static const double none = 0; static const double xs = 4; static const double sm = 8; static const double md = 12; static const double lg = 16; static const double xl = 28; static const double xxl = 32; static const double full = 999; static const double full = 0; }
- Commit and push your changes:
git add . git commit -m "Update radius" git push origin feature/update-border-radius
- Create a pull request (or merge request in GitLab):
- Go to your GitHub repository
- You should see a prompt to create a pull request for your recently pushed branch
- Make sure to target your forked repository as the base, not the original repository
- Click Compare & pull request
- Add a title and description for your PR
- Click Create pull request
Check the Pull Request in Widgetbook Cloud
- Wait for the CI/CD pipeline to complete for your feature branch
- Go to your Widgetbook Cloud project
- Navigate to the Pull Requests section
- You should see a new pull request
- Click on the pull request to see the visual differences between the base and feature branches
- Review the changes and approve or request changes as needed
The review will show you exactly what changed visually between your feature branch and the main branch, making it easy to spot UI regressions or unintended changes.
What's Next?
Congratulations! You've successfully set up a demo project with Widgetbook Cloud. Here are some next steps you can explore:
Learn about Reviews
Discover how to use Widgetbook Cloud reviews to catch UI regressions before they reach production.
Explore Builds
Learn more about how Widgetbook Cloud builds work and how to access them.
Setup Your Own Project
Apply what you've learned to set up Widgetbook Cloud with your own Flutter project.