Questions tagged [hook-widgets]

9 questions
8
votes
2 answers

How to use HookWidget with useTextEditingController

I'm new to flutter development and trying to understand Riverpod. I currently managed to make the following login form work with a StatefulWidget. Basically, the button becomes enabled if both fields are not empty and viceversa. And this is the…
Robert Estivill
  • 12,369
  • 8
  • 43
  • 64
1
vote
1 answer

Flutter Equivalent useProvider in new version of Riverpod

In previous version of riverpod we could use simply useProvider() and sending request to server without any action such as clicking on button, so in new version of riverpod i can't. old version: useEffect(() { …
DolDurma
  • 15,753
  • 51
  • 198
  • 377
1
vote
2 answers

Flutter what's StatefulHookWidget and how can we use it?

There quote is from Riverpod documentation: A StatefulWidget that can use Hook It's usage is very similar to StatefulWidget, but use hooks inside State.build. The difference is that it can use Hook, which allows HookWidget to store mutable data…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
0
votes
2 answers

ToggleButton not changing state

I have three toggle button in my page. When I click either one of the toggle button, it remain unchanged. class EditInvoiceDetailsScreen extends HookWidget { final Invoice invoice; EditInvoiceDetailsScreen(this.invoice, {super.key}); …
John Joe
  • 12,412
  • 16
  • 70
  • 135
0
votes
1 answer

Flutter using useEffect to get data from server and getting return type error

After implementing a simple riverpod library to send request and getting response from server, when i try to use useEffect for that i get this error: Error: A value of type 'Future>' can't be returned from a function with…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
0
votes
0 answers

Remove listener from FocusNode using Flutter Hooks

I started adopting Flutter Hooks recently and REALLY loving it. I was able to convert a few of my StatefulWidgets to HookWidgets, and it's pretty cool. The one thing I'm struggling to figure out is how to properly remove listeners from from a…
Mr. Oak
  • 179
  • 9
0
votes
0 answers

Flutter calling Riverpod function without using context.read()

By default after defining Riverpod providers we can click on any widget to call some method such as getting data from webservice or another things. for example: context.read(washingServiceProvider.notifier).getService; now my problem is how can i…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
0
votes
1 answer

Flutter HookWidget unknown read from context

Today i'm wondering why i can't use context.read inside HookWidget after defining this codes into project: class FavoriteAddressBottomSheet extends HookWidget { @override Widget build(BuildContext context) { return Container( child:…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
0
votes
1 answer

Flutter HookWidget doesn't rebuild when values changed

Here i used very simple HookWidget and Riverpod, when i call some methods of StateNotifierProvider such as increment i expect my widgets which i used useProvider rebuild again, for example: class MyHomePage extends HookWidget { @override Widget…
DolDurma
  • 15,753
  • 51
  • 198
  • 377