-
install lego CLI by this guide
-
create new widget template
- run the following command in the terminal:
lego create
- select the widget type(select 3~6 for the widget type)
- enter the widget name
-
write the widget code in the generated file(lib/widget_book/[widget]//.dart)
add any assets to the assets/lego/_new/ folder
- note: always use relative paths for imports
- add any libraries to this terminal command:
flutter pub add [library_name]- add
#@addto 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.