lego
  • etc
    • Install lego_cli
    • Install Pub Global
    • Environment
  • Widgetbook
    • Create New Widget
Powered by GitBook
On this page
  • Add Assets
  • Add Libraries

Was this helpful?

Edit on GitHub
  1. Widgetbook

Create New Widget

PreviousEnvironment

Last updated 10 months ago

Was this helpful?

  1. install lego CLI by this

  2. create new widget template

    1. run the following command in the terminal:

    lego create
    1. select the widget type(select 3~6 for the widget type)

    2. enter the widget name

  3. write the widget code in the generated file(lib/widget_book/[widget]//.dart)

Add Assets

add any assets to the assets/lego/_new/ folder

  • note: always use relative paths for imports

Add Libraries

  1. add any libraries to this terminal command:

flutter pub add [library_name]
  1. add #@add to the library without a version number in the pubspec.yaml file.

# example
dependencies:
  ...
  cupertino_icons: #@add
  • this will automatically add your project's dependencies to the pubspec.yaml file when you add a new widget.

  • do not add the library that need initialization in the main.dart file.

guide