rrousselGit / functional_widget

A code generator to write widgets as function without loosing the benefits of classes.
595 stars 46 forks source link

auto_route support & class decorators #119

Open Nolat opened 9 months ago

Nolat commented 9 months ago

Is your feature request related to a problem? Please describe. I'm using the auto_route package, which needs to add an @RoutePage() decorator above the classes. If I try to add it above a functional widget, the generation doesn't work.

@RoutePage()
class SplashPage extends HookWidget {
  const SplashPage();

  @override
  Widget build(BuildContext context) {
    return Scaffold();
  }
}

Describe the solution you'd like We need a way to add a decorator to the generated class.

@FunctionalWidget(
  decorators: [
    RoutePage
  ],
)
Widget splashPage() {
  return Scaffold();
}
dickermoshe commented 3 months ago

@rrousselGit Should I spend time adding this, or is the macro version of this going to fix this issue?

rrousselGit commented 2 months ago

Feel free to make a PR yes