📓 Storyboard your components with Flutterbook. Develop, document, & test any kind of Flutter component.

Related tags

Widgets flutter
Overview

Flutterbook

Flutterbook

A storyboarding tool to accelerate the development of Flutter widgets. Inspired by Storybook.js.

The package is built to support Windows and Web layouts. There is no support for mobile support at the moment. This is new and still under heavy development, expect many changes to occur with usage.

License: MIT


Go subscribe to my YouTube channel to support development.

MOONSDONTBURN Header

Overview

Creating the Main

Start by creating the storyboard widget. This will wrap the Flutterbook widget so that when it is edited, it will hot reload.

class Storyboard extends StatelessWidget {
  const Storyboard({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FlutterBook(
      categories: [
          // organizers ...
      ],
    );
  }
}

After creating the Storyboard widget, you can run it by using the main. I recommend making another file named main_storyboard.dart to maintain your storyboard.

void main() {
  runApp(const Storyboard());
}
// Or run it directly, but this will cost the hot reload.
// void main() {
//   runApp(const Flutterbook(categories:[...]));
// }

How to add Widgets

To add widgets, you simply put Organizers, aka Category, Folder, Component, and ComponentState.

The hierarchy goes

Category > Folder > Component > ComponentState

but you may also do

Category > Component > ComponentState

or

Category > Folder > Folder > Component > ComponentState

Here is a complex example of a single Category. In the example, we use the builder where we are able to access different controls.

Category(
    categoryName: 'LIBRARY',
    organizers: [
    Folder(
        folderName: 'Charts',
        organizers: [
        Component(
            componentName: 'LineGraph',
            states: [
            ComponentState.child(
                stateName: 'Default Container',
                child: Container(),
            ),
            ],
        ),
        ],
    ),
    Component(
        componentName: 'Button',
        states: [
        ComponentState(
            stateName: 'Primary',
            builder: (context, c) {
            return Center(
                child: SizedBox(
                width: c.number(
                    label: 'Number',
                    initial: 50,
                    min: 50,
                    max: 250,
                ),
                height: c.number(
                    label: 'height',
                    initial: 50,
                    min: 50,
                    max: 250,
                    description: 'random stuff',
                ),
                child: CupertinoButton.filled(
                    onPressed: c.boolean(
                    label: 'boolean',
                    initial: true,
                    )
                        ? () {}
                        : null,
                    child: Text(
                    c.text(label: 'Text', initial: 'Hello World'),
                    ),
                ),
                ),
            );
            },
        ),
        ],
    ),
    ],
),

That's it!

Roadmap 🚧

  • Mobile Support
  • 100% Code Coverage Testing
  • Documentation Support in ComponentState's
  • Better Docs
  • Device Previews
  • Shareable Handoffs
  • Optimization

Contributors 🔥

Your name could be here 😉

Comments
  • Flutterbook Improvements

    Flutterbook Improvements

    This pr is pretty hefty but this is the gist of the new features that are introduced (these have been reviewed individually, this is just the culmination together)

    • Documentation Page (Users are able to create documentation passing in a Future)
    • Considerations, this way allows docs to be passed in either using a string or being loaded from the assets folder
    • Since dart:io has limitations for web, the only way to read on the file system is through the bundled assets
    • This was the best solution, we tried referencing the path, but only absolute paths worked when trying to use the flutterbook package in other projects

    https://user-images.githubusercontent.com/12024422/145451474-45dbd7c7-a398-45e8-b39f-cd51f91348a4.mov

    opened by Josiassejod1 10
  • Control tab returns error

    Control tab returns error

    Screen Shot 2021-11-29 at 12 13 10 PM (2)

    Also ran the code from the example directory of this repository and it returned the same error.

    Flutter Doctor [✓] Flutter (Channel stable, 2.5.3, on macOS 11.5.2 20G95 darwin-x64, locale en-US) [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use flutter config --android-sdk to update to that location.

    [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.62.3) [✓] Connected device (1 available)

    opened by Doetheman 4
  • Add online demo

    Add online demo

    Hello! I'm really excited to see such package. I haven't yet had a chance to test it myself, but I'm looking forward to!

    What would be really handy though is to have an online hosted demo of a storybook created using your package

    All the best!

    opened by Albert221 3
  • [Feature] Documentation Feature

    [Feature] Documentation Feature

    Summary

    Enabling component states to all have their individual documentation. This will most likely be through markdown and the markdown_widget package.

    opened by GhostWalker562 2
  • Fix panning, Add DartCodeViewer, Add Multi Theme support

    Fix panning, Add DartCodeViewer, Add Multi Theme support

    This PR introduces/fixes the following:

    Docs

    • dart_code_viewer2 was added in conjunction with a new ComponentState class attribute String? codeSample to allow flutterbook contributors to effectively provide code snippets outside of any markdown/documentation they'd like to provide for a given component state
    • The Component class now has a String? componentMarkdown to allow for component-wide documentation. This should allow stories to have a bit more
    • A new attribute CodeSampleThemeData? codeSampleTheme has been added to allow teams to customize the theme of the code viewer
    • Example: code_viewer

    Multi-Theme Support

    • A new themes argument has been added to Flutterbook to enable teams with 3+ themes to view the app in every theme. This attribute will take priority over the existing theme and darkTheme attributes if it is set.
    • Example: multi theme

    Panning updates

    • Panning a component is now behind its own toggle in the tab bar
    • Example: panning
    opened by devbrandonlong 1
  • Export DarkThemeProvider

    Export DarkThemeProvider

    I'd like to dynamically set the header widget for our implementation of Storybook. Exporting the DarkThemeProvider allows us to listen to dark theme toggle events

    opened by devbrandonlong 1
  • Very nice

    Very nice

    Very nice project, I have been looking for a decent looking and feeling storybook type system. I like what I see here. Would love to try it out and give some feedback and maybe also try to help with some PR's.

    Thanks for sharing the project.

    opened by princestha 1
  • Add Section For Documentation

    Add Section For Documentation

    This pr is a big one but its worth it

    • Allows a user to auto generate documentation using dartdoc
    • See code snippet
    • Improved UI for code snippet

    https://user-images.githubusercontent.com/12024422/144673147-30e9c685-2da8-439f-9f4c-ac25c74dc894.mov

    opened by Josiassejod1 1
  • fix: changes provider access from watch to read to prevent error.

    fix: changes provider access from watch to read to prevent error.

    Hi! @GhostWalker562 First of all thanks for the effort of this repository! I think flutterbook is one of the best storybooks for flutter!

    The example app is not working.

    I fixed an issue with provider in the bottom bar of controls.

    Bye!

    Davide

    opened by dbbd59 1
  • eng(storybook): Device Preview Part 2

    eng(storybook): Device Preview Part 2

    This pr adds the device preview behind a button so that it can be toggle, adds device preview capability

    https://user-images.githubusercontent.com/12024422/141522720-454d255f-9aae-449f-a8c4-80ada0d64304.mov

    le

    opened by Josiassejod1 0
  • Integrate golden screenshots into flutterbook

    Integrate golden screenshots into flutterbook

    At our company we are using golden toolkit from ebay: https://pub.dev/packages/golden_toolkit for unit testing widgets and also flutterbook for developing and act as a repository. Code for both these is pretty similar

    Wouldn't it be wonderful. if we can have a way to integrate both of them?

    May be have a custom plugin or a command line argument flutter run --dart-env=test-goldens to trigger golden screentests on all states of flutterbook.

    opened by prolificcoder 1
  • Add dropdown support to controls

    Add dropdown support to controls

    It'd be wonderful to have dropdowns for things like enums available on controls, something like

    controls.list(someEnum.values)
    // or
    controls.list(['red', 'green', 'blue'])
    
    opened by megamaddu 1
Owner
Philip Vu
Programming.
Philip Vu
Powerful Complete and Beautiful Search Component for Flutter

A highly customizable search component to accelerate your development. Overview There are many search or search components for Flutter, however this o

Tiagosito 31 Jul 27, 2022
A collection of pixel-perfect iOS-styled components and properties for Flutter, following the official guidelines.

cupertinew ⚠️ Experimental and work in progress ⚠️ A collection of pixel-perfect iOS-styled components and properties for Flutter, following the offic

null 30 Nov 10, 2022
Flutter Application to test basic flutter understanding

Flutter Application to test basic flutter understanding Getting Started Before you start with the application have a look at what

null 0 Apr 16, 2022
A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate

A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate. Allows for both sync and async reducers.

Marcelo Glasberg 214 Dec 13, 2022
An alternative to Overlay which allows you to easily render and hit test a widget outside its parent bounds

An alternative to Overlay which allows you to easily render and hit test a widget outside its parent bounds. Based on the original idea by @shrouxm he

gskinner team 26 Dec 31, 2022
Flutter package: Similar to a ListView, but lets you programmatically jump to any item, by index.

indexed_list_view Similar to a ListView, but lets you programmatically jump to any item, by index. The index jump happens instantly, no matter if you

Marcelo Glasberg 244 Dec 27, 2022
Show custom in-app notification with any Widgets in flutter

notify_inapp show custom in-app notification with any Widgets. Getting Started Add this to your package's pubspec.yaml file: dependencies: notify_in

NewTab 3 Aug 19, 2022
Widget, that can make any static located widget hidable

Installing See the official installing guidline from hidable/install Usage & Overview To start using Hidable widget, we have to create a ScrollControl

Anon 18 Dec 16, 2022
AsyncButtonBuilder offers a simple way to extend any type of button with an asynchronous aspect

async_button_builder AsyncButtonBuilder offers a simple way to extend any type of button with an asynchronous aspect. It allows adding loading, disabl

Nollie 22 Jul 10, 2022
Responsive Widgets Prefix allows you to add the "Responsive" prefix to any widget that needs scaling or font size increases

Responsive Widgets Prefix allows you to add the Responsive prefix to any widget that needs scaling or font size increases (for varying device screen sizes).

The Mobile Applications Community 2 Apr 18, 2022
Code generation for Flutter Padding widgets based on your constants

Code generation for Flutter Padding widgets based on your constants

Emanuele 14 Oct 20, 2022
Flutter | Snap physics for your scrollview

Snap Scroll Physics When building scrollable views, sometimes you would prefer that the scroll stopped at a given offset, or that it avoids to stop in

Jaime Blasco 46 Nov 21, 2022
A collection of widgets for making amazing onboarding experience in your flutter applications

Pal widgets A flutter package for better onboarding. A set of amazing onboarding widgets for your flutter applications. Install package add in your pu

Apparence.io 25 Oct 7, 2022
An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

AliYigitBireroglu 101 Dec 16, 2022
Flutter Package: When your desired layout or animation is too complex for Columns and Rows, this widget lets you position/size/rotate/transform its child in complex ways.

align_positioned Widgets in this package: AlignPositioned AnimatedAlignPositioned AnimChain Why are these widgets an indispensable tool? When your des

Marcelo Glasberg 69 Dec 12, 2022
Pick colors from pixels of everything visible in your Flutter apps

pixel_color_picker A widget that extracts colors from its childs. This package lets you basically extract colors from everything in your screen.

Eleandro Duzentos 14 Oct 17, 2022
Flutter package which helps you to implement Ticket Widget in your app.

✨ Ticket Widget Flutter package which helps you to implement Ticket Widget in your app. The source code is 100% Dart, and it is an updated null safe v

Mujahid 7 Dec 30, 2022
Animated Search Bar package lets you add a beautiful search bar to your Flutter app.

Animated Search Bar Animated Search Bar package lets you add a beautiful search bar to your Flutter app. Installation Add the latest version of packag

Mohammad Saleh 5 Aug 7, 2022
Make your native android Dialog Fancy and Gify.

Make your native android Dialog Fancy and Gify. A library that takes the standard Android Dialog to the next level with a variety of styling options and Gif's. Style your dialog from code.

Shashank Singhal 522 Jan 2, 2023