statefulwidget

Flutter - NoSuchMethodError: The getter 'focusScopeNode' was called on null

帅比萌擦擦* 提交于 2020-04-16 05:55:10
问题 I am having the following error while trying to pass List from one screen to another. The data is being passed from the async function. I need to open the other Screen based on the data fetched from the database. The answer mentioned here didn't work for me. here is the error. : [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'focusScopeNode' was called on null. E/flutter (26425): Receiver: null E/flutter (26425): Tried calling: focusScopeNode E

Flutter: avoid build() method of previous route being called when navigate to next route

偶尔善良 提交于 2020-03-26 03:02:52
问题 My flutter app is showing a splash screen ( statefulWidget ) as a first route. This route is showing an animation while, on the background, calling an API to get some data. Once the data has been received and the animation is complete, it navigates to the second route. All works fine, except that, when calling the Navigator to navigate to the second route, the second route is shown, but i can see again the response from the API on the first route, that is being called. It turns out that, when

Flutter - RepaintBoundary causes state reset of StatefulWidget

风格不统一 提交于 2020-01-23 16:57:48
问题 I have a preview widget that loads data after a user tap. This state (already tapped or not) should not be lost while scrolling (the preview is located in a list) or navigating through other screen. The scrolling is solved by adding AutomaticKeepAliveClientMixin which saves the state when scrolling away. Now i also need to wrap the preview widget (actually a more complex widget that contains the preview) with a RepaintBoundary, to be able to make a "screenshot" of this widget alone. Before i

Flutter - Stateful Widget Doesn't Save Counter State When Switching Tabs

懵懂的女人 提交于 2020-01-04 02:33:07
问题 I am learning flutter and I am working with tabBars and I am having an issue with saving the state. I have put a small working example of my issue below. Basically, there is a button and a stateful counter. When I click the button, I see the text field update correctly. But, when I switch to a different tab and come back, the text field is back to zero. I have found if i move the following line outside of _CounterState so its defined at the top level of the file, then, it works correctly.

StatefulWidget Page recreate when keyboard is open

南笙酒味 提交于 2019-12-12 12:18:11
问题 In my profile page have edit option when use click edit icon i change Text widget to TextField Widget using Boolean condition like widget.isUpdate ? new Flexible(child: new TextField()) : Text("Text Widget") it working but when TextField focused the keyboard is open on that time StatefulWidget recreate so again Boolean became false then Textfield move to Text Widget. This scenario only happen when page has Navigator push page (Second Page) like Navigator.push(context,MaterialPageRoute(builder

Accessing a function of stateful widget in its state class? flutter

邮差的信 提交于 2019-12-11 02:52:02
问题 I am trying to call _signOut function after the onPressed method for logout button. However it doesnt (recognize the function or let me call it) I can however make a call widget.Onsignedout, a callback to it parent and everything works as intended. except i sign out the user at auth.signout and call back is just to update the form. how can I access the _signOut() from state class? thank you import 'package:flutter/material.dart'; import 'package:login_demo/auth.dart'; import 'package:login

Flutter - RepaintBoundary causes state reset of StatefulWidget

情到浓时终转凉″ 提交于 2019-12-06 16:44:04
I have a preview widget that loads data after a user tap. This state (already tapped or not) should not be lost while scrolling (the preview is located in a list) or navigating through other screen. The scrolling is solved by adding AutomaticKeepAliveClientMixin which saves the state when scrolling away. Now i also need to wrap the preview widget (actually a more complex widget that contains the preview) with a RepaintBoundary, to be able to make a "screenshot" of this widget alone. Before i wrap the widget with a RepaintBoundary, the state is saved both while scrolling and navigating to

What is the relation between stateful and stateless widgets in Flutter?

僤鯓⒐⒋嵵緔 提交于 2019-11-29 20:34:21
A stateful widget is defined as any widget which changes its state within its lifetime. But it is a very common practice for a StatelessWidget to have a StatefulWidget as one of its children. Doesn't StatelessWidget become stateful if it has StatefulWidget as one of its children? I tried looking into the documentation as part of the code of StatelessWidget , but couldn't figure out how a StatelessWidget can have Statefulwidget as its children and still remain StatelessWidget . What is the relation and difference between stateful and stateless widgets in Flutter? A StatelessWidget will never

What is the relation between stateful and stateless widgets in Flutter?

点点圈 提交于 2019-11-27 09:56:30
问题 A stateful widget is defined as any widget which changes its state within its lifetime. But it is a very common practice for a StatelessWidget to have a StatefulWidget as one of its children. Doesn't StatelessWidget become stateful if it has StatefulWidget as one of its children? I tried looking into the documentation as part of the code of StatelessWidget , but couldn't figure out how a StatelessWidget can have Statefulwidget as its children and still remain StatelessWidget . What is the