-
Notifications
You must be signed in to change notification settings - Fork 0
Build & Run
Efra Espada edited this page Oct 6, 2024
·
8 revisions
Once you have generated the previews of your widgets and their respective dummies you can create the component catalog. Once the catalog is created you will only have to choose how to display it (it will depend on whether you use go_router or not).
dart run catalog:buildThe catalog will be positioned in the location of your choice. This point can be configured from the pubspec.yaml.
You can check an example here.
final router = GoRouter(
routes: [
// ... other routes
// add the catalog route in debug mode (can be run in release, but it is not recommended)
if (kDebugMode) CatalogComponent.route,
],
);Notice
CatalogComponentclass name is defined inpubspec.yaml
Wrap your main app widget with:
runApp(
CatalogRunner(
enabled: true, // <-- or use (--dart-define catalog=true) in command line
application: MyApp(),
route: CatalogComponent.route,
),
);
Notice
CatalogComponentclass name is defined inpubspec.yaml
For running your catalog you can:
-
Use the
enabledparameter astrueto force the catalog. -
Include
catalogas flutter argument:flutter run -d linux --dart-define catalog=true