If you have a non-trivial Flutter app, then you probably use a custom theme.
Monarch can render your stories using your app's custom theme. To do so, Monarch
needs to know about your theme via the
- Add the
package:monarch_annotationsto your dependencies:
- Go to the dart file where you have declared the
ThemeDatavariable for you custom theme. If you have created your theme in an in-line expression, then you would have to refactor it into a top-level variable. Once you have identified your
ThemeDatavariable, add the
MonarchThemeannotation as shown below:
- Save your changes. The Monarch app will display the theme you annotated in the Theme dropdown. When you select that theme, the selected story will render using your custom theme.
If you have multiple themes in your app, you can annotate all of them with the
MonarchTheme annotation. You could also declare one of them as the default.
The default theme is the theme that Monarch will use when it first loads.