Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing error reporting when @WidgetbookTheme is used on properties #130

Closed
jenshor opened this issue Feb 23, 2022 · 0 comments · Fixed by #145
Closed

missing error reporting when @WidgetbookTheme is used on properties #130

jenshor opened this issue Feb 23, 2022 · 0 comments · Fixed by #145
Labels
t: bug Something isn't working

Comments

@jenshor
Copy link
Member

jenshor commented Feb 23, 2022

Description
Using @WidgetbookTheme on a ThemeData defining property results in incorrectly generated code.

Example code:
@WidgetbookTheme(name: 'Something')
ThemeData get myTheme => ThemeData.dark();

Leads to generated code:

Widgetbook.material(
      appInfo: AppInfo(
        name: 'Meal App',
      ),
      supportedLocales: locales,
      localizationsDelegates: delegates,
      themes: [
        WidgetbookTheme(
          name: 'Dark',
          data: getDarkThemeData(),
        ),
        WidgetbookTheme(
          name: 'Light',
          data: getLightThemeData(),
        ),
        WidgetbookTheme(
          name: 'Something',
          data: myTheme(),
        ),
      ],
... 

Expected Behavior
Generated code should be

WidgetbookTheme(
  name: 'Something',
  data: myTheme,
),
@jenshor jenshor added the t: bug Something isn't working label Feb 23, 2022
@jenshor jenshor changed the title @WidgetbookTheme cannot be used on properties missing error reporting when @WidgetbookTheme is used on properties Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant