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

Support for hook #12

Closed
jaumard opened this issue Dec 23, 2018 · 2 comments
Closed

Support for hook #12

jaumard opened this issue Dec 23, 2018 · 2 comments

Comments

@jaumard
Copy link

jaumard commented Dec 23, 2018

I'm trying few of your packages :) and from what I understand for now it's not possible to use this one with flutter_hook right ?

The idea will be to use flutter_hook to also allow "stateful" widgets define as a function.

So basically instead of:

class Example extends HookWidget {
  @override
  Widget build(HookContext context) {
    finalmyState = context.useState(initialData: 0);
    return Container();
  }
}

We'll have :

Widget foo(HookContext context, { int value, int value2 }) {
  final myState = context.useState(initialData: 0);
  return Text('${myState.value} $value $value2');
}

We don't gain that much in terms of code, but at least we have the same way to define widget across the project.

@jaumard
Copy link
Author

jaumard commented Dec 23, 2018

Ok just look at the code and saw it's already done :) just not documented so all good thanks!

@jaumard jaumard closed this as completed Dec 23, 2018
@rrousselGit
Copy link
Owner

Hehe indeed it's done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants