-
Notifications
You must be signed in to change notification settings - Fork 0
Build & Run
Efra Espada edited this page Jan 12, 2024
·
8 revisions
Once your previews are ready, build your catalog page.
dart run catalog:build lib
|
|-- ui
|
|-- catalog
|
|-- catalog_component.dart <-- catalog created (main page)
|
|-- componentsAPage
| |
| |-- componentsASubPageA
| | |
| | |-- component_a_a.dart <-- widget page for created for component_a_a
| |
| |-- componentsASubPageB
| | |
| | |-- component_a_b.dart <-- widget page for created for component_a_b
| |
| |-- components_A_page_dummy.dart <-- common page for componentsASubPageA and componentsASubPageB
|
|-- componentsBPage
|
|-- componentsBSubPageA
| |
| |-- component_b_a.dart <-- widget page created
|
|-- components_B_page_dummy.dart <-- common page for componentsBSubPageA
Notice the catalog creation path is defined in
pubspec.yaml(in this sample /lib/ui/catalog/).
Notice the catalog main page creation path is defined in
@Previewandpubspec.yaml.
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