<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Widgetbook - Medium]]></title>
        <description><![CDATA[The collaboration platform for Flutter frontend teams - Medium]]></description>
        <link>https://medium.com/widgetbook?source=rss----1bf9101e9b99---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Widgetbook - Medium</title>
            <link>https://medium.com/widgetbook?source=rss----1bf9101e9b99---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 12 Jun 2026 16:17:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/widgetbook" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[How Salto prevents UI problems while saving 50% of their time with Widgetbook]]></title>
            <link>https://medium.com/widgetbook/how-salto-prevents-ui-problems-while-saving-50-of-their-time-with-widgetbook-53194f79ee96?source=rss----1bf9101e9b99---4</link>
            <guid isPermaLink="false">https://medium.com/p/53194f79ee96</guid>
            <category><![CDATA[widgetbook]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Julius]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 13:28:54 GMT</pubDate>
            <atom:updated>2025-04-15T13:27:36.795Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Following Widgetbook’s structured review process, Salto catches all UI changes in a merge request and quickly solves all UI problems early. Thereby, their developers save 50% of their working time.</em></p><h3>About Salto</h3><p>Salto Systems is a global leader in smart access solutions, offering cutting-edge IoT technology for secure, cloud-based access control. With over 40,000 clients and a presence in more than 40 countries, Salto powers seamless and secure entry experiences for hospitals, offices, universities, and more. Their innovative platform integrates mobile access, wireless locks, and real-time management — all designed to simplify access control in a connected world.</p><p>In 2022, Salto made the strategic decision to switch to Flutter to unify their codebase, accelerate development, and improve cross-platform performance. Since then, they’ve successfully built seven production apps in Flutter, making it a core part of their mobile development strategy.</p><h3>Challenge: Catching UI Changes Early</h3><p>With seven different Flutter apps in production, Salto’s developers are committed to delivering a consistent and high-quality user experience. However, updating a widget in one part of the app often had unexpected side effects elsewhere — leading to UI overflows, visual bugs, or accessibility issues that were hard to detect early.</p><p>To catch these regressions in advance, the team relied on Flutter’s snapshot-based golden tests.</p><blockquote>“We used Alchemist for golden tests, but generating consistent snapshots across different machines was difficult and didn’t integrate smoothly into our GitLab workflow. When something broke, it often took a long time to fix UI issues and stabilize the CI pipeline.” — <strong>Arthur Schenk, Mobile Team Lead at Salto</strong></blockquote><h3>Solution: How Widgetbook Transformed Salto’s Workflow</h3><h4>Building Widgets in Isolation</h4><p>While exploring ways to streamline UI reviews and catch visual bugs earlier, Salto’s mobile team discovered Widgetbook. They initially adopted the open-source version to accelerate Flutter UI development and quickly saw the benefits.</p><blockquote>“We build new features by starting with Widgetbook, allowing us to immediately develop the UI in isolation and see how new components behave. Building in isolation is especially helpful for larger components and screens that handle various data states — like loading, loaded, or error. Before Widgetbook, testing error states was time-consuming because they’re naturally hard to reproduce; the data often comes from sources we can’t easily control. But with Widgetbook’s isolation-first approach, we can inject mocked data and test all component states. Once a component is ready, other developers can easily explore its different variations.” — Arthur</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i4W3q-AtORxADVn3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8tcslPenaooPmxNI" /><figcaption>Pictures of the different state screens (error state/success state)</figcaption></figure><h4><strong>A Central Overview of All Widgets</strong></h4><p>To maintain visibility across their growing UI ecosystem, Salto created a shared Widgetbook for common components, along with seven app-specific Widgetbooks — one for each app’s unique widgets and screens.</p><blockquote>“The UI team is happy they now have a clear overview. They can quickly explore components and screens in different states, themes, and device sizes — all in one place.” — Arthur</blockquote><p>This setup not only improved collaboration between designers and developers but also made it easier to ensure visual consistency across all Flutter apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OFrJ0zl-z0jviKd4" /><figcaption>On the left, you can see the Widgetbook component library</figcaption></figure><h4>Catching All UI changes with Widgetbook Cloud</h4><p>After seeing the benefits of the open-source <strong>Widgetbook</strong> for local widget development, Salto wanted to extend this workflow to their entire CI process. To do so, they scheduled a demo with Widgetbook to explore how <strong>Widgetbook Cloud</strong> — the fully integrated, cloud-based review platform — could support them.</p><blockquote>“Onboarding was smooth and easy to set up, especially thanks to the dedicated Slack channel where we could quickly resolve any issues” — Arthur</blockquote><p>Although Widgetbook Cloud was initially used primarily by developers, Salto has recently expanded its use to include both <strong>QA and design teams</strong>, creating a more collaborative and efficient review process.</p><blockquote>“Widgetbook is integrated and running in our build CI pipelines. So, every merge request triggers Widgetbook Builds to run the snapshot tests. If we made changes in code, Widgetbook shows which components stayed the same and which components had visual adjustments making it trivial to review visual changes and get the code merged.” — Arthur</blockquote><p>Salto configured Widgetbook Cloud to test all widgets automatically for their light and dark theme and for a normal and enlarged text scale factor. “Testing in different configurations helps us to see the changes for our themes. Specifically, with the keychain, <strong>there was a lot of inconsistency in dark mode</strong>. Widgetbook Cloud helped us to find these inconsistencies efficiently and resolve the theming issue right away. In addition, many problems have been detected and fixed while the merge requests were still open. Otherwise, the problems would have shipped to our staging environment and would have been raised by QA causing time consuming iteration cycles. With Widgetbook you can see that at once. The <strong>entire team is very satisfied because it is so handy and saves time</strong>.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hZIh0K39f4DVyr3i" /><figcaption>Widgetbook Review</figcaption></figure><blockquote><em>“Widgetbook saves us a lot of time and provides valuable insight into which changes are made with each merge request. This prevents problems in the UI, and our workflow became certainly twice as fast.” — Arthur</em></blockquote><p>If this sounds like an outcome your team could also benefit from, try <a href="https://pub.dev/packages/widgetbook">Widgetbook for free </a>or <a href="mailto: contact@widgetbook.io">contact our team</a> to learn more.</p><p><strong>Big thanks to the </strong><a href="https://saltosystems.com/"><strong>Salto</strong></a><strong> team for the great collaboration on this case study — especially to </strong><a href="https://www.linkedin.com/in/arthur-schenk-22933114/"><strong>Arthur Schenk</strong></a><strong>. It was a pleasure working together! 💙</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53194f79ee96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/widgetbook/how-salto-prevents-ui-problems-while-saving-50-of-their-time-with-widgetbook-53194f79ee96">How Salto prevents UI problems while saving 50% of their time with Widgetbook</a> was originally published in <a href="https://medium.com/widgetbook">Widgetbook</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create use-cases for Widgetbook: Strategies and Automation Tools]]></title>
            <link>https://medium.com/widgetbook/create-use-cases-for-widgetbook-strategies-and-automation-tools-b29ef0436f18?source=rss----1bf9101e9b99---4</link>
            <guid isPermaLink="false">https://medium.com/p/b29ef0436f18</guid>
            <category><![CDATA[widgetbook]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Jens Horstmann]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 08:10:03 GMT</pubDate>
            <atom:updated>2024-12-12T08:10:03.274Z</atom:updated>
            <content:encoded><![CDATA[<p>Organizations adopting Widgetbook often have established applications with extensive component libraries. When teams recognize the need for a comprehensive widget catalog to enhance collaboration, they face time constraints in implementing the migration. This article explores efficient strategies and tools for cataloging existing components to leverage Widgetbook and Widgetbook Cloud effectively.</p><h3>What is Widgetbook?</h3><p>Flutter teams typically work with design systems created by freelancers or in-house design teams. While Figma’s component-based approach naturally generates a comprehensive catalog through best practices, Flutter developers face challenges after implementing these components as Widgets and collecting feedback on the adjusted or added Widgets. The traditional approach of sharing screenshots via Slack or Teams for assessment proves inefficient and cumbersome.</p><p>Widgetbook revolutionizes this workflow by providing a specialized environment for component visualization and testing. Through its comprehensive feature set, teams can:</p><ul><li>Efficiently preview and test widgets in isolation and with different hard-to-reach states</li><li>Ensure consistent behavior across different devices and themes</li><li>Rapidly iterate on components with hot reload support</li><li>Seamlessly integrate UI testing into existing Flutter projects</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2x6Lf9VT9vX8P4UQwF5Jg.png" /><figcaption>An example use case for an app screen.</figcaption></figure><p>By implementing this structured approach to component management, teams eliminate the need for ad-hoc testing and screenshot sharing, significantly enhancing development efficiency and team collaboration.</p><h3>What is Widgetbook Cloud?</h3><p>Widgetbook Cloud streamlines UI component development through a collaborative platform. Key features include:</p><ul><li>Real-time team collaboration for instant component review</li><li>Automated visual regression testing to detect UI changes</li><li>Component version control with rollback capabilities</li><li>Efficient review workflow with comments and approvals</li></ul><p>The platform accelerates the design-to-development cycle by enabling direct component interaction in a dedicated environment.</p><p>Built-in automated testing maintains UI consistency while reducing manual QA effort, allowing teams to prioritize innovation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m1mPzWqm7HiyohpGypmhZg.png" /><figcaption>Widgetbook Cloud Review feature</figcaption></figure><h3>Strategies</h3><p>Design systems consist of core components that serve as building blocks for complex components and screens. While Widgetbook offers the most value with 100% component coverage, sprint time constraints often limit implementation capacity. To maximize Widgetbook’s benefits during the migration phase, consider the following approaches based on your goals.</p><h3>Core Components</h3><p>When redesigning core components, Widgetbook excels at tracking changes and improving team communication. This approach maintains team alignment and prevents regressions across your application. Since core components are frequently reused, prioritize cataloging them first. This strategy maximizes the benefits for your team by establishing a solid foundation for component management.</p><h3>New Components</h3><p>When expanding your application’s feature set, new components are naturally introduced. These features and components typically undergo multiple iterations, making them ideal candidates for Widgetbook integration. This ensures design consistency and implementation accuracy throughout the process of optimizing your solution to meet customer requirements.</p><p>The two approaches can be mixed depending on your goals while migrating all your components to Widgetbook.</p><h3>Widgetbook Entries Generator</h3><p>Our partner <a href="https://leancode.co/">LeanCode</a>, a leading Flutter development agency, specializing in enterprise applications, has developed an automation tool that streamlines the integration of existing widgets into Widgetbook. This <a href="https://marketplace.visualstudio.com/items?itemName=LeanCode.widgetbook-generator">Widgetbook Entries Generator</a> efficiently scans your codebase and generates the necessary Widgetbook code, significantly reducing manual implementation effort.</p><p>During their extensive work on Flutter projects, LeanCode identified a critical challenge: manually creating use cases for existing widgets was time-intensive and prone to errors. Drawing from their experience, they developed the Widgetbook Entry Generator to optimize the migration process.</p><p>Key benefits of the entries generator include:</p><ul><li>Automated generation of boilerplate code for rapid widget integration</li><li>Enhanced accuracy through automated processing</li><li>Streamlined adoption of Widgetbook’s testing and collaboration features</li></ul><p>Widgetbook entries generator is <a href="https://marketplace.visualstudio.com/items?itemName=LeanCode.widgetbook-generator">available for VS Code</a>.</p><h3>Example project</h3><p>Let’s explore the <a href="https://github.com/jenshor/widgetbook-explained">widgetbook-explained</a> repository, which contains a simple grocery shopping app, as our example project.</p><p>The project structure is as following</p><pre>.<br>├── lib      ⬅️ groceries_app<br>│   ├── app.dart<br>│   ├── features<br>│   ├── ... (omitted folders and files)<br>│   └── ui<br>│       ├── ui.dart<br>│       └── widgets<br>│           ├── app_bar.dart<br>│           ├── bottom_navigation_bar.dart<br>│           ├── card.dart<br>│           ├── counter.dart<br>│           ├── divider.dart<br>│           ├── empty_state.dart<br>│           ├── icon.dart<br>│           ├── icon_button.dart<br>│           ├── navigation_item.dart<br>│           ├── page_shell.dart<br>│           ├── primary_button.dart<br>│           ├── responsive_layout.dart<br>│           └── widgets.dart<br>├── pubspec.yaml<br>└── widgetbook      ⬅️ widgetbook_workspace<br>    ├── README.md<br>    ├── analysis_options.yaml<br>    ├── lib<br>    └── pubspec.yaml</pre><h3>Settings</h3><p>Before the generator can be used, make sure to configure the settings of the extension.</p><p><strong>Barrel File import</strong></p><pre>.<br>├── lib      ⬅️ groceries_app<br>│   ├── app.dart<br>│   ├── features<br>│   ├── ... (omitted folders and files)<br>│   └── ui<br>│       ├── ui.dart     🔥 Barrel file import<br>│       └── widgets<br>│           ├── (ommited files)<br>│           └── widgets.dart<br>├── pubspec.yaml<br>└── widgetbook      ⬅️ widgetbook_workspace<br>    ├── README.md<br>    ├── analysis_options.yaml<br>    ├── lib<br>    └── pubspec.yaml</pre><p>Due to the file structure, we configure the Barrel File import as package:groceries_app/ui/ui.dart, which exports all Widgets from the production app.</p><p><strong>Root directory name</strong></p><p>After cloning the repository widgetbook-explained, we set the Root directory name to match widgetbook-explained.</p><p><strong>Widgets directory path</strong></p><p>This setting specifies the generation target for Widgetbook files.</p><pre>.<br>├── lib      ⬅️ groceries_app<br>│   └── ... (omitted folders and files)<br>├── pubspec.yaml<br>└── widgetbook      ⬅️ widgetbook_workspace<br>    ├── README.md<br>    ├── analysis_options.yaml<br>    ├── lib     🔥 Where we want the generated files<br>    └── pubspec.yaml</pre><p>We set the path to /widgetbook/lib to generate files in the ./widgetbook/lib directory.</p><h3>How to genenerate a use-case for a Widget?</h3><p>To generate a Widgetbook entry, open the PrimaryButton file, access the Quick Fix menu, and select &quot;Create widgetbook entry for this widget&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HhruQUvC9uOpyfCC82w9cQ.png" /></figure><p>Widgetbook entry generator creates the following code</p><pre>import &#39;package:flutter/widgets.dart&#39;;<br>import &#39;package:groceries_app/ui/ui.dart&#39;;<br>import &#39;package:widgetbook/widgetbook.dart&#39;;<br>import &#39;package:widgetbook_annotation/widgetbook_annotation.dart&#39; as widgetbook;<br><br>@widgetbook.UseCase(<br>  name: &#39;default&#39;,<br>  type: PrimaryButton,<br>)<br>Widget useCasePrimaryButton(BuildContext context) {<br>  return PrimaryButton(<br>    content: context.knobs.string(label: &#39;Content&#39;, initialValue: &#39;Content&#39;),<br>    leading: const SizedBox.shrink(),<br>    trailing: const SizedBox.shrink(),<br>  );<br>}</pre><p>The generated code is a functional Widgetbook use-case that serves as a starting point for further customization.</p><p>Developers can enhance the use-case by adding specific implementations, such as customizing the leading and trailing properties with icons.</p><h3>Generate use-cases for multiple Widgets</h3><p>Besides generating use-cases for individual widgets, the Widgetbook entry generator can create use-cases for an entire folder at once.</p><p>To use this feature, simply right-click on a folder in the file explorer and select the generate option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DaqPr7dUcEzou6AtStNfHA.png" /></figure><p>Which will result in the following 20 generated files for Widgetbook.</p><pre>.<br>├── lib      ⬅️ groceries_app<br>│   └── ... (omitted folders and files)<br>├── pubspec.yaml<br>└── widgetbook<br>    ├── lib     🔥 Generated files are located here<br>    │   ├── about<br>    │   │   └── about_screen.dart<br>    │   ├── app_bar.dart<br>    │   ├── app_theme.dart<br>    │   ├── bottom_navigation_bar.dart<br>    │   ├── card.dart<br>    │   ├── counter.dart<br>    │   ├── divider.dart<br>    │   ├── empty_state.dart<br>    │   ├── features<br>    │   │   ├── basket<br>    │   │   │   ├── views<br>    │   │   │   │   └── basket_view.dart<br>    │   │   │   └── widgets<br>    │   │   │       ├── basket_card.dart<br>    │   │   │       ├── cost_item_row.dart<br>    │   │   │       └── summary.dart<br>    │   │   └── utility<br>    │   │       └── placeholder.dart<br>    │   ├── icon.dart<br>    │   ├── icon_button.dart<br>    │   ├── main.dart<br>    │   ├── main.directories.g.dart<br>    │   ├── navigation_item.dart<br>    │   ├── page_shell.dart<br>    │   └── primary_button.dart<br>    └── pubspec.yaml</pre><p>Of the 20 generated files 6 showed missing data for properties of type IconData which were fixed within a minute.</p><h3>Conclusion</h3><p>The Widgetbook entries generator significantly accelerates the integration of existing Flutter widgets into Widgetbook. By automating the creation of use-cases, teams can quickly build a comprehensive widget catalog without disrupting their development workflow. This tool, combined with Widgetbook’s testing capabilities, enables teams to maintain high-quality component libraries while focusing on delivering value to their customers.</p><p>Whether you choose to migrate core components, new features, or use the automated generator, Widgetbook provides the flexibility to adopt a testing strategy that fits your team’s needs. This structured approach to widget management ensures consistent design implementation and efficient team collaboration throughout your project’s lifecycle.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b29ef0436f18" width="1" height="1" alt=""><hr><p><a href="https://medium.com/widgetbook/create-use-cases-for-widgetbook-strategies-and-automation-tools-b29ef0436f18">Create use-cases for Widgetbook: Strategies and Automation Tools</a> was originally published in <a href="https://medium.com/widgetbook">Widgetbook</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Case Study: How flaconi covers UI testing with Widgetbook]]></title>
            <link>https://medium.com/widgetbook/case-study-how-flaconi-covers-ui-testing-with-widgetbook-b6522881f4a0?source=rss----1bf9101e9b99---4</link>
            <guid isPermaLink="false">https://medium.com/p/b6522881f4a0</guid>
            <dc:creator><![CDATA[Julius]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 14:03:22 GMT</pubDate>
            <atom:updated>2024-02-05T14:05:00.081Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a8ZnmZsJmVdA2xiOo6znEA.png" /></figure><p>flaconi has been the leading German e-commerce shop for fragrances and beauty products for the past years. Reaching their customers via webshop and mobile app comes with interesting design challenges. At the heart of flaconi’s design prowess lies Figma and the Style Dictionary API, enabling them to propagate design excellence throughout the company. Design tokens serve as the foundational elements for colors, fonts, and more, forming the backbone of their design system. From this foundation, they craft components for web, mobile, and also marketing material. Leveraging Storybook for the web and Widgetbook for mobile ensures that all components are accessible for designers and developers. A clear commitment to developing mobile applications with Flutter ensures efficiency gains as a single code base can be used to develop for Android and IOs.</p><p>Widgetbook fits perfectly into this tech stack as a Flutter first tool. Before Widgetbook became part of flaconis development workflow, flaconi encountered potential for optimization in their internal processes related to testing and presenting UI components. Despite having a design system in place, the absence of a dedicated tool posed difficulties in ensuring the seamless functionality of basic elements, such as buttons in their mobile app. Prior to Widgetbook, flaconi’s designers had to navigate a complex process of manually testing components, relying on hardware and test apps. This not only consumed a significant amount of time but also presented difficulties in ensuring the consistent performance of elements across various screen orientations and text scales. The absence of a unified tool added complexity to the review process, necessitating extensive coordination between designers and developers. Widgetbook emerged as a solution, streamlining flaconi’s UI design and testing procedures, ultimately enhancing their workflow efficiency.</p><p><strong>Widgetbook aligns Developers and Designers</strong></p><p>Let’s delve deeper into how Widgetbook has not only streamlined the exchange of information but also elevated the entire process of showcasing and testing components for flaconi. Despite already having a robust design system in place, flaconi recognized opportunities for optimizing the testing and presentation of UI components within their mobile app team. The introduction of Widgetbook offered a refined solution, allowing flaconi’s product team to effortlessly isolate and test fundamental components, such as buttons, across diverse scenarios — from various screen orientations to different text scales. Widgetbook plays its role in eliminating the need for separate builds, significantly boosting the efficiency of UI element testing. The tool is especially valuable in addressing accessibility scenarios, showcasing its broader impact on enhancing overall design and testing processes at flaconi.</p><p>Imagine this scenario: an app is to be translated and the UI must be able to function not only with a Latin alphabet but also with Arabic characters. Widgetbook empowers designers and QA testers to explore various cases seamlessly, bypassing traditional hurdles like creating test apps or constantly adjusting phone settings. This marks a paradigm shift, ensuring components exhibit the desired behavior without unexpected glitches, ultimately contributing to a smoother and more effective design and testing experience for flaconi.</p><p><strong>Ensure Accessibility</strong></p><p>flaconi’s commitment to ensuring accessibility in their app takes a significant stride forward with the integration of Widgetbook into their testing processes. As part of the many ways to test UI with Widgetbook. It is possible to create scenarios in which you test your UI components for accessibility in a dedicated way. flaconi’s product team uses the Widgetbook dashboard to thoroughly test components under diverse conditions. This includes evaluating how the UI elements respond to changes in text scale and ensuring optimal functionality for users with disabilities. The platform’s user-friendly interface allows designers to simulate settings directly from the Widgetbook dashboard, eliminating the need for complex, manual testing procedures. This makes the tedious clicking around in the test app settings to display different accessibility settings obsolete and saves time and nerves.</p><p><em>“At flaconi, Widgetbook is our go-to for testing mobile UI design. It’s changed the game, allowing us to showcase and test components effortlessly. No need for dedicated builds — Widgetbook simplifies testing scale factors and ensures accessibility with unparalleled ease.”</em> — Mohammed Almissbah (Senior Mobile Engineer at flaconi)</p><p>We encourage others to explore Widgetbook’s transformative capabilities in streamlining collaboration and ensuring a user-friendly experience. Embrace the future of UI design with Widgetbook. Big thanks to Mohammed Almissbah and flaconi for sharing their invaluable insights, driving positive change in digital design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6522881f4a0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/widgetbook/case-study-how-flaconi-covers-ui-testing-with-widgetbook-b6522881f4a0">Case Study: How flaconi covers UI testing with Widgetbook</a> was originally published in <a href="https://medium.com/widgetbook">Widgetbook</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Material Base Components into Widgetbook]]></title>
            <link>https://medium.com/widgetbook/getting-material-base-components-into-widgetbook-c0e1f874b14b?source=rss----1bf9101e9b99---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0e1f874b14b</guid>
            <category><![CDATA[widgetbook]]></category>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Anton Borries]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 09:09:01 GMT</pubDate>
            <atom:updated>2024-01-15T10:06:32.326Z</atom:updated>
            <content:encoded><![CDATA[<h3>Displaying Material Base Components in Widgetbook</h3><p>Styling Material Widgets can be tricky. Using the widgetbook_base_components mason brick you can get an overview inside Widgetbook how they will look, feel and behave</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OvsdFzV_vK1Mzglv2YjvGA.png" /><figcaption>Buttons from widgetbook_base_components in the Widgetbook Groceries Example</figcaption></figure><h3>Struggling with styling ThemeData</h3><p>Personally I am a big fan of using the default Material Widgets in Flutter Apps as they are easy to use, offer great support for Accessibility and relying on theme is great if you are onboarding new team members as they can just use the default blocks without having to make sure they use the correct widget.</p><p>However one big caveat with this can be what <a href="https://twitter.com/RydMike">Mike Rydstrom</a> put into great words during his workshop at <a href="https://www.flutterfriends.dev/">Flutter &amp; Friends</a> (Material for the Workshop can be found <a href="https://twitter.com/messages/87799983-568573618">here</a>)</p><blockquote>Flutter Material theming is fun and easy — but tedious</blockquote><p>This really resonated with me as that basically reflects my experience with it. Adjusting ThemeData to match a given Design or just to your preference can indeed be tricky to get all the nuances right. However things like Mike’s <a href="https://rydmike.com/flexcolorscheme/themesplayground-v5/#/">Theme Playground</a> and <a href="https://pub.dev/packages/flex_color_scheme">flex_color_scheme</a> can really help you nail your ThemeData. When you have your Theme just right and you are able to just use Material Widgets without having to do custom styling when using them it feels great to use, is quick and ensures visual consistency between your uses of these Widgets.</p><h3>The idea</h3><p>widgetbook_base_components is a <a href="https://github.com/felangel/mason">mason</a> brick that generates UseCases for your Widgetbook to show you how these widgets would appear and behave in your App.</p><p>In the first version the following components are supported: Buttons, TextStyles, Controls, Card, AlertDialog, Indicators, Chips, TextFields, ListTile, BottomNavigationBar</p><p>You might notice that these UseCases in Widgetbook have a lot more info than you are normally used to. This is because the idea behind widgetbook_base_components is to get a quick overview of how certain Material Widget Groups like buttons/switches/etc behave if used in an app only relying on the style set by the encapsulting ThemeData.</p><p>For some examples you can also check out a Widgetbook with these components here:</p><p><a href="https://abausg.github.io/bricks/widgetbook_base_components/web/">https://abausg.github.io/bricks/widgetbook_base_components/web/</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FtXL4FHPSnVJ0A%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExY2licXNrNnkyeHdoOTk3ejRnYm1zdTR6bDBtbGViZTFiY2FsZHFrMyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FtXL4FHPSnVJ0A%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FtXL4FHPSnVJ0A%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="287" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c475c31dfeea3976e1892183f83ed59/href">https://medium.com/media/3c475c31dfeea3976e1892183f83ed59/href</a></iframe><h3>Using the brick</h3><blockquote>Note: I am assuming you already have setup Widgetbook in your project. If not check out the official documentation <a href="https://docs.widgetbook.io/">https://docs.widgetbook.io/</a></blockquote><ol><li>Follow the installation steps for <a href="https://github.com/felangel/mason">mason</a> if you haven’t by running <br>dart pub global activate mason_cli<br>mason init</li><li>Add the widgetbook_base_components brick using <br>mason add widgetbook_base_components</li><li>&quot;Make&quot; the brick using mason make widgetbook_base_components</li><li>Run dart run build_runner build (ignore this if you are using watch )</li><li>Check your Widgetbook for the new Base Components 🎉</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zNw7mieMAMIoiefMypnnmQ.png" /><figcaption>Chips created by widgetbook_base_components on <a href="https://abausg.github.io/bricks/widgetbook_base_components/web/">https://abausg.github.io/bricks/widgetbook_base_components/web/</a></figcaption></figure><h3>Next Steps</h3><p>I think seeing the different Variants side by side offers a great way of grasping how your App might look for the provided ThemeData</p><p>I am well aware that this is only a small subset of Material Widgets that are supported but I think it is a great start. If you are missing a specific Widget feel free to <a href="https://github.com/ABausG/bricks">open a PR</a>.</p><p>For thoughts or any more questions reach out to me on <a href="https://twitter.com/abausg">X/Twitter</a></p><h3>Thanks</h3><p>Many thanks to <a href="https://twitter.com/roaakdm">Roaa</a>, <a href="https://twitter.com/LucasJosefiak">Lucas</a> and <a href="https://twitter.com/t_lavrk">Tim</a> from Widgetbook for the Feedback on the Brick.</p><p>Also big thanks to Mike! His work for everything Material is phenomenal and his <a href="https://rydmike.com/flexcolorscheme/themesplayground-v5/#/">Theme Playground</a> was a huge inspiration for this. You should follow him on X/Twitter to always get the latest news about Material and Flutter!</p><p><a href="https://twitter.com/RydMike">JavaScript is not available.</a></p><p>Code for the Brick:</p><p><a href="https://github.com/ABausG/bricks/tree/main/bricks/widgetbook_base_components">https://github.com/ABausG/bricks/tree/main/bricks/widgetbook_base_components</a></p><p>Example of the Widgetbook:</p><p><a href="https://abausg.github.io/bricks/widgetbook_base_components/web/">https://abausg.github.io/bricks/widgetbook_base_components/web/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0e1f874b14b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/widgetbook/getting-material-base-components-into-widgetbook-c0e1f874b14b">Getting Material Base Components into Widgetbook</a> was originally published in <a href="https://medium.com/widgetbook">Widgetbook</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Widgetbook x Hacktoberfest 2023]]></title>
            <link>https://medium.com/widgetbook/widgetbook-x-hacktoberfest-2023-888761ba4d60?source=rss----1bf9101e9b99---4</link>
            <guid isPermaLink="false">https://medium.com/p/888761ba4d60</guid>
            <category><![CDATA[widgetbook]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <dc:creator><![CDATA[Majid Hajian]]></dc:creator>
            <pubDate>Tue, 14 Nov 2023 14:11:41 GMT</pubDate>
            <atom:updated>2023-11-14T16:51:29.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*T1RsOcD0ET2srWmLsYlxFA.png" /></figure><p>October 2023 was a landmark month for Widgetbook, thanks to the collective efforts during Hacktoberfest. This year, we witnessed an outpouring of contributions, leading to groundbreaking features and enhancements in Widgetbook’s package and CLI. Let’s delve into these exciting developments, highlighting specific changes and the community’s incredible contributions.</p><h4>Hacktoberfest in Statistics</h4><p>The Hacktoberfest 2023 campaign at Widgetbook was not just an event but a vibrant showcase of collective effort and technical prowess. Let’s delve into the heart of this success through some impressive statistics and acknowledge the stars behind these achievements.</p><p><strong>Impressive Contributions:</strong></p><ul><li><strong>Total Pull Requests (PRs):</strong> We received a remarkable count of 17 PRs.</li><li><strong>New Contributors:</strong> These PRs were contributed by 10 enthusiastic developers.</li><li><strong>Diverse Contributions:</strong> The range of contributions spanned from UI enhancements to CLI optimizations, reflecting the diverse skill set of our community.</li></ul><p>For a detailed look at all the PRs, visit<a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+is%3Aclosed+label%3Ahacktoberfest-accepted"> Widgetbook’s Hacktoberfest Contributions</a>.</p><h4>Shoutout to Our Outstanding Contributors</h4><p>Each contributor brought unique ideas and expertise, significantly enhancing Widgetbook’s capabilities.</p><ul><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3AMastersam07"><strong>@Mastersam07</strong></a><strong>:</strong> Showcased exceptional professionalism with 3 addons, 2 knobs, and crucial mobile support. His PRs were a benchmark in code quality and documentation.</li><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3Ageisterfurz007"><strong>@geisterfurz007:</strong></a> Made a rare and valuable contribution affecting widgetbook_generator, a less common area during Hacktoberfest.</li><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3Afrancescovallone"><strong>@francescovallone</strong></a><strong>:</strong> Added the complex and multifaceted color knob. His PR, rich in review comments, exhibited his patience and openness to iterative changes.</li><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3Adaohoangson"><strong>@daohoangson</strong></a><strong>:</strong> Displayed remarkable patience with a PR that, although not merged, was accepted for its value during the discussion phase.</li><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3Alogickoder"><strong>@logickoder</strong></a><strong>:</strong> Successfully tackled the daunting task of adding a knob for DateTime, a notoriously complex data type.</li><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3A07Abhinavkapoor"><strong>@07Abhinavkapoor</strong></a><strong>:</strong> Played a pivotal role in introducing the light theme, illuminating Widgetbook’s interface.</li><li><a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+author%3Aboredcity"><strong>@boredcity</strong></a><strong>:</strong> Enhanced the user experience by adding a new q query parameter for the navigation bar’s search functionality.</li></ul><p>Each contributor has added value to Widgetbook and inspired the community with dedication and skill. We extend our heartfelt gratitude to them and to every individual who participated, making Hacktoberfest 2023 a memorable and productive event for Widgetbook.</p><p>As promised, all our contributors will soon receive their swag box, including the Widgetbook T-shirt.</p><p>You can read more in detail on our<a href="https://github.com/widgetbook/widgetbook/pulls?q=is%3Apr+is%3Aclosed+label%3Ahacktoberfest-accepted"> GitHub issues</a>.</p><h3>Widgetbook 3.4: What’s New</h3><p>The release of Widgetbook 3.4 brings a host of exciting new features and improvements, enhancing both the developer’s experience and the end-user interface. Here’s what’s new:</p><h4>New Knobs</h4><ul><li><strong>DateTime Knob:</strong> Tackling one of the most complex data types, the DateTime knob offers intuitive date and time manipulation within the Widgetbook interface.</li></ul><pre>context.knobs.dateTimeOrNull(<br>  initialValue: initialDate,<br>  label: &#39;Select Date Time&#39;,<br>  start: DateTime(initialDate.year - 1),<br>  end: DateTime(initialDate.year + 1),<br>)</pre><ul><li><strong>Duration Knob:</strong> This knob allows for the adjustment of duration values, adding another layer of interactivity.</li></ul><pre>context.knobs.duration(<br>    label: &#39;Increment duration&#39;,<br>    initialValue: const Duration(seconds: 5),<br>  )</pre><ul><li><strong>Int Knob:</strong> A straightforward way to adjust integer values directly from the UI.</li></ul><pre>context.knobs.int.input(<br>  label: &#39;Int - Input&#39;,<br>  initialValue: 1,<br>)<br><br>context.knobs.int.slider(<br>  label: &#39;Int - Slider&#39;,<br>  initialValue: 2,<br>)</pre><ul><li><strong>Enhanced </strong><strong>Color Knob:</strong> The color knob has been revamped to support various color spaces and opacity levels, including a nullable version for more versatility.</li></ul><pre>context.knobs.color(<br>  label: &#39;Color&#39;,<br>  initialValue: Colors.blue,<br>)</pre><p><a href="https://docs.widgetbook.io/knobs/overview"><strong>Explore Knobs in Detail</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/0*bxTbMsVO4_Anp79s" /></figure><h4>Interface Improvements</h4><ul><li><strong>Light Theme:</strong> The introduction of a light theme option caters to different aesthetic preferences</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w13wPTmdZzf5q_AZ" /></figure><ul><li><strong>WidgetbookLeafComponent:</strong> Simplifying components’ organization with a single use case enhances the navigation experience.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HrLsCjO-iXxhptvH" /></figure><ul><li><strong>Mobile support</strong> The mobile support has landed on the Widgetbook UI.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/0*a912rnb1a7d_kDGU" /></figure><h4>New Addons</h4><p>Widgetbook 3.4 introduces several new addons, each designed to augment the functionality of Widgetbook and enrich the developer’s toolkit. These addons offer diverse capabilities, from improving accessibility to providing detailed insights into widget properties. Here’s an overview of these innovative additions:</p><p>1.<strong> Zoom Addon:</strong> The Zoom Addon provides a seamless way to adjust the zoom level of widgets within the Workbench. This feature is handy for fine-tuning the appearance and layout of widgets. <a href="https://docs.widgetbook.io/addons/zoom-addon"><strong>Learn More About the Zoom Addon</strong></a></p><pre>ZoomAddon(initialZoom: 1.0)</pre><p>2.<strong> Grid Addon:</strong> With the Grid Addon, developers can overlay a pixel grid on the previewed use case. This is invaluable for ensuring alignment and consistency in design. <a href="https://docs.widgetbook.io/addons/grid-addon"><strong>Explore the Grid Addon</strong></a></p><pre>GridAddon()</pre><p>3.<strong> Accessibility Addon:</strong> This addon is a powerful tool for detecting and resolving accessibility issues. It leverages the accessibility_tools package to ensure that widgets are accessible to all users. <a href="https://docs.widgetbook.io/addons/accessibility-addon"><strong>More on Accessibility Addon</strong></a></p><pre>AccessibilityAddon()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h6fOHrrHFPDmFSx1ZMVahw.png" /></figure><p>4.<strong> Inspector Addon:</strong> The Inspector Addon is an essential tool for developers, offering the ability to inspect various widget properties, such as colors, sizes, and padding. This feature enhances the debugging and design process within the Widgetbook’s Workbench. <a href="https://docs.widgetbook.io/addons/inspector-addon"><strong>Discover the Inspector Addon</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*njPleKhzB7kRkFYA" /></figure><p>These addons make Widgetbook more versatile and user-friendly, offering developers enhanced capabilities to build and test their widgets more effectively.</p><h4>Enhancements in Generator Version 3.3.0</h4><p>The Widgetbook Generator also saw significant enhancements in version 3.3.0, making it more powerful and user-friendly. Key updates include:</p><ul><li><strong>Custom Path for </strong><strong>@UseCase:</strong> This feature allows developers to specify a custom path for their use cases, improving organization and readability.</li></ul><pre>@widgetbook.UseCase(<br>  name: &#39;Example&#39;,<br>  type: YourWidget,<br>  path: &#39;[Category]/folder&#39;,<br>)</pre><ul><li><strong>Support for </strong><strong>WidgetbookLeafComponent:</strong> This addition streamlines the navigation for components with a single use case, simplifying the user interface and making it more intuitive.</li><li><a href="https://github.com/widgetbook/widgetbook/blob/main/packages/widgetbook_generator/CHANGELOG.md#330"><strong>Discover More on Generator 3.3.0 Enhancements</strong></a></li></ul><p>Upgrade your Widgetbook today and look for new features on our <a href="https://demo.widgetbook.io/">demo</a> project.</p><pre>dependencies:<br>  widgetbook: ^3.4.0<br>  widgetbook_annotation: ^3.1.0<br><br>dev_dependencies:<br>  widgetbook_generator: ^3.3.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H3dzyQV2AjvLfRGS" /></figure><h3>Conclusion</h3><p>October was a month of growth, learning, and community spirit for Widgetbook. The contributions we received enriched our open-source package and exemplified the spirit of collaboration and innovation that drives the tech world forward.</p><p>As we release version 3.4, we extend our heartfelt thanks to every contributor who made this possible. Here’s to many more successful Hacktoberfests!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=888761ba4d60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/widgetbook/widgetbook-x-hacktoberfest-2023-888761ba4d60">Widgetbook x Hacktoberfest 2023</a> was originally published in <a href="https://medium.com/widgetbook">Widgetbook</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to transform your widget testing setup into a widget library with Widgetbook]]></title>
            <link>https://medium.com/widgetbook/how-to-transform-your-widget-testing-setup-into-a-widget-library-with-widgetbook-a7cf2d9c3604?source=rss----1bf9101e9b99---4</link>
            <guid isPermaLink="false">https://medium.com/p/a7cf2d9c3604</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[widgetbook]]></category>
            <dc:creator><![CDATA[Bas de Vaan]]></dc:creator>
            <pubDate>Tue, 08 Aug 2023 14:32:49 GMT</pubDate>
            <atom:updated>2023-08-21T06:24:55.252Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A screenshot of an example of Widgetbook" src="https://cdn-images-1.medium.com/max/1024/0*5OXWqBfkZdShnRXd" /></figure><blockquote><strong>Key takeaways</strong></blockquote><blockquote>- Widgetbook is a generated UI component library inspired by Storybook.js</blockquote><blockquote>- Usually it is costly for small projects to maintain a UI component library</blockquote><blockquote>- Using Widgetbook in your tests makes it maintenance cost of your UI component library low</blockquote><blockquote><a href="https://dutchcodingcompany.com/en/blog/widget-testing-met-widgetbook">(original article link)</a></blockquote><p><strong>Hi, my name is Bas de Vaan, Flutter Developer for </strong><a href="https://dutchcodingcompany.com"><strong>Dutch Coding Company</strong></a><strong>. I started developing mobile apps about 10 years ago, and while I’ve done a lot of stuff since that time, always had a love for developing for mobile. Such a nice platform with quick feedback and clear boundaries. ❤</strong></p><p><strong>Recently, I was inspired by a talk from </strong><a href="https://twitter.com/LucasJosefiak"><strong>Lucas</strong></a><strong> about Widgetbook. This inspired me to try using Widgetbook in our current projects, while minimising the amount of new code and keeping maintenance costs to a minimum. In this blog post, I will share the approach I came up with.</strong></p><p>Widgetbook is a UI component library inspired by Storybook.js. It provides a clear folder structure to display various UI components. These components are generated from your actual code, so you can see how they look in your application. The component library is interactive, allowing you to test the behavior of elements to user input, hover, and click. You can also provide different variations and options for your components to make it clear which variants of your elements are usable. You can host this library online to share it with clients, other developers, and designers. If you want to see the potential of a widget book, <a href="https://demo.widgetbook.io/#/">checkout their online demo here!</a></p><h3>The struggle of maintaining a component library</h3><p>I recall attending a Javascript meetup and listening to a talk about Storybook. I thought, ‘This would be great to have in Flutter!’ Months later, to my surprise, it actually exists! At a Flutter meetup, Lucas from Widgetbook gave a fantastic presentation about the tool. Its usage seemed easy and promising, with potential in upcoming features. However, the only issue I struggled with was its maintenance cost. For each entry in Widgetbook, you have to define a use case and maintain any changes to your widgets. Here’s an example of how to define a use case in Widgetbook:</p><pre>@widgetbook.UseCase(name: &#39;with no text&#39;, type: TestFieldWidget)<br>Widget noTextTestFieldWidget(BuildContext _) {<br>  return const TestFieldWidget(text: &#39;&#39;);<br>}</pre><p>So while this use case is pretty small, you can imagine if you have a widget with a lot of options this get very cumbersome. This is an example of a bigger widget (still just a simple checkbox):</p><pre>@UseCase(name: &#39;basic&#39;, type: CheckboxInput)<br>Widget basicCheckboxInput(BuildContext context, {bool initialValue = false}) {<br>  return CheckboxInput(<br>    field: CheckBoxFieldType(<br>      name: &#39;checkbox&#39;,<br>      value: context.knobsOrMock.boolean(label: &#39;checkboxValue&#39;, initialValue: initialValue),<br>      type: FieldType.bulletin,<br>      label: context.knobsOrMock.string(<br>        label: &#39;CheckboxLabel&#39;,<br>        initialValue: &#39;checkbox&#39;,<br>      ),<br>    ),<br>    onChanged: (bool? changed) {<br>      initialValue = changed ?? false;<br>    },<br>  );<br>}</pre><p>So you get the gist. To display each element in your Widgetbook, you need to create a function and annotate it as a use case. Fortunately, the Widgetbook code generation tool performs the rest of the magic for you 🔮.</p><p>However, obtaining a Widgetbook using this method felt like more work than I was willing to put in. Ideally, I would like to do as little work as possible. This is what led me to the idea of incorporating it with my widget testing.</p><h3>Combining widgets with testing</h3><p>I already have a robust widget testing setup in most of my applications. We use both Widget testing and Golden Testing to test the behavior, look, and feel of our widgets. Whenever there is a change, we see the impact reflected in our tests, giving us more confidence in developing new features. If a change in one place has an unintended effect on another widget, our tests turn red and alert us to the unwanted side effect. If you’re not already testing your widgets, I highly recommend giving it a try! Golden Tests are low in maintenance cost and feel like low effort for a high reward.</p><p>What do these tests have in common with the use cases used by Widgetbook? In both cases, you need to build the widget you want, isolate it from the rest of the application, and provide it to a framework, whether it be Widgetbook’s or your testing library’s. This led me to look for a way to combine the use cases of Widgetbook with my tests, and I found a ‘mostly’ working solution!</p><p>By just putting the use case functions in the test file itself you can use these functions in your test and annotate them as well. A simple test can look something like this:</p><pre>@widgetbook.UseCase(name: &#39;with a lot of text&#39;, type: TestFieldWidget)<br>Widget longTextTestFieldWidget(BuildContext _) {<br>  return const TestFieldWidget(text: &#39;A very long test to create a certain amount of text to see how it looks like.&#39;);<br>}<br><br>@widgetbook.UseCase(name: &#39;with no text&#39;, type: TestFieldWidget)<br>Widget noTextTestFieldWidget(BuildContext _) {<br>  return const TestFieldWidget(text: &#39;&#39;);<br>}<br><br>void main() {<br>  testWidgets(<br>    &quot;test description&quot;,<br>    (WidgetTester tester) async {<br>      Widget widget = Builder(builder: ((context) =&gt; longTextTestFieldWidget(context)));<br>      await tester.pumpWidget(widget);<br>      expect(<br>          find.text(&#39;A very long test to create a certain amount of text to see how it looks like.&#39;), findsOneWidget);<br>    },<br>  );<br>}</pre><p>It is also possible to provide the initial value of a knob in the function as an optional parameter; this makes it possible to also use the ‘knobs’ in your test. A test for the checkbox that I run in a actual project looks like this:</p><pre>@UseCase(name: &#39;basic&#39;, type: CheckboxInput)<br>Widget basicCheckboxInput(BuildContext context, {bool initialValue = false}) {<br>  return CheckboxInput(<br>    field: CheckBoxFieldType(<br>      name: &#39;checkbox&#39;,<br>      value: context.knobsOrMock.boolean(label: &#39;checkboxValue&#39;, initialValue: initialValue),<br>      type: FieldType.bulletin,<br>      label: context.knobsOrMock.string(<br>        label: &#39;CheckboxLabel&#39;,<br>        initialValue: &#39;checkbox&#39;,<br>      ),<br>    ),<br>    onChanged: (bool? changed) {<br>      initialValue = changed ?? false;<br>    },<br>  );<br>}<br><br>void main() {<br>  group(&#39;Checkbox Input Golden Test&#39;, () {<br>    GoldenPumpingCompanion companion = defaultPumpingCompanion();<br><br>    goldenTest(<br>      &#39;renders correctly&#39;,<br>      fileName: &#39;checkbox_input_golden_test&#39;,<br>      pumpWidget: companion.pumpWidget,<br>      builder: () =&gt; companion.buildTestGroup(<br>        &#39;default widget&#39;,<br>        UseCaseWrapper.wrap((context) =&gt; basicCheckboxInput(context, initialValue: false)),<br>      ),<br>    );<br><br>    goldenTest(<br>      &#39;renders correctly&#39;,<br>      fileName: &#39;checkbox_input_checked_golden_test&#39;,<br>      pumpWidget: companion.pumpWidget,<br>      builder: () =&gt; companion.buildTestGroup(<br>        &#39;default widget&#39;,<br>        UseCaseWrapper.wrap((context) =&gt; basicCheckboxInput(context, initialValue: true)),<br>      ),<br>    );<br>  });<br>}</pre><p>Please keep in mind that I have some extra test helpers and functions here to assist me in building my tests. This way, even a “complicated” widget test appears clean and moreover provides us with both snapshot tests and an entry in our Widgetbook! <a href="https://github.com/Bassiuz/widgetbook_test_setup">Check out my GitHub repository</a> if you’re looking for a simple example project.</p><h3>Implementing the solution</h3><p>Okay, I have to confess something. When I said I found a ‘mostly’ working solution, I actually meant that it doesn’t work yet. The code generation of the Widgetbook library cannot correctly handle imports from the test and lib folders. You can fix this by manually adjusting the imports in the file generated by Widgetbook. Remove the imports that start with asset: and replace them with actual imports from your project. This will enable Widgetbook to run, but I don’t like making manual changes to generated code. This is especially problematic since it hinders automated deployment of Widgetbook through a pipeline. When I discovered this, I opened <a href="https://github.com/Bassiuz/widgetbook_test_setup">an issue about this problem in the Widgetbook Github repository.</a></p><p>I wrote this blog while I was at Fluttercon 2023 (read more about it in <a href="https://dutchcodingcompany.com/en/blog/fluttercon-2023-recap">my previous blog</a>). At the conference, I had the opportunity to listen to a talk about Widgetbook and check out their booth. The guys from Widgetbook were also in attendance. During the conference, I came up with <a href="https://github.com/Bassiuz/widgetbook_test_setup">a possible solution to the problem.</a></p><p>I had the opportunity to discuss my fix and issue with the developers, who were very open and friendly in their collaboration. Overall, it was a great experience 🙂</p><figure><img alt="Me (Bas) meeting Youssef and Jens from Widgetbook at Fluttercon 2023" src="https://cdn-images-1.medium.com/max/1024/0*1uLnU2HOifXIg4bY" /></figure><p>While in the progress of writing and publishing this blogpost, Youssef (pictured on the right) actually used my pull request as inspiration and made a fix for Widgetbook!</p><figure><img alt="A screenshot of Github, containing a message from Youssef about a fix he made to the problem I had with Widgetbook" src="https://cdn-images-1.medium.com/max/1024/0*DKK5zgoZ5VDgrAp_" /></figure><p>So soon in a new release (or in the git ref) you could try this test setup for yourself! Awesome! 🚀</p><p><strong>EDIT: </strong>On the 18th of August, this feature got released in Widgetbook Generator 3.1.0! So update to the latest version and check it out!</p><h3>Wrapping up</h3><p>Regarding the future of Widgetbook, version 3 has recently been released, which includes many new features and a fully-fledged cloud environment. Therefore, adopting and implementing Widgetbook now seems like a good idea, especially for apps with a large assortment of UI elements.</p><p>If you want to know more about how we implemented Widgetbook at Dutch Coding Company or my views on the future of Widgetbook, feel free to send me a message on Twitter/X (<a href="https://twitter.com/Bassiuz">@Bassiuz</a>). I love to discuss all things Flutter :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7cf2d9c3604" width="1" height="1" alt=""><hr><p><a href="https://medium.com/widgetbook/how-to-transform-your-widget-testing-setup-into-a-widget-library-with-widgetbook-a7cf2d9c3604">How to transform your widget testing setup into a widget library with Widgetbook</a> was originally published in <a href="https://medium.com/widgetbook">Widgetbook</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>