Questions tagged [statefulwidget]

339 questions
0
votes
2 answers

Second screen doesn't appear until initState is done

I have StatefulWidget which initState() triggers async onInit() function that triggers a top level function that returns list of items, then the onInit populates List of items. Then I have Scaffold which body should return CircularProgressIndicator…
i6x86
  • 1,557
  • 6
  • 23
  • 42
0
votes
1 answer

Staring to learn Flutter. Wondering how to import a class into a stateful widget

I've just started to learn flutter and am trying to make a ToDo list app. If you see the code below, I was wondering how I can move the code below class _TodoListState extends State { and before Widget build(BuildContext context) { into a…
Aryan V
  • 111
  • 2
  • 9
0
votes
1 answer

Flutter extended_image: setState() or markNeedsBuild() called during build

I am using the package extended_image to load images from the network and display a shimmer on loading or on error. I am getting this error setState() or markNeedsBuild() called during build when I am trying to call setState inside the…
coolbeatz71
  • 928
  • 2
  • 10
  • 22
0
votes
1 answer

How to update StateFullWidget from stateLessWidget

I wanted to update the evaluateAnswer bool and rebuild the QuestionsList(stateful) widget with new value when the SubmitExamButton(which is a stateless widget) button is pressed. But it always builds it with the false value which I initialized the…
biniyam112
  • 956
  • 1
  • 11
  • 17
0
votes
1 answer

Passing List index Data to a Stateful Widget to load PDF document dynamically

I am trying to pass the 'index' of a List to a Stateful Widget. But it is not working as the 'index' is not being recognized. From where I am passing data: onTap: () { Navigator.push(context, MaterialPageRoute(builder: (context) =>…
Rifat Hossain
  • 77
  • 1
  • 11
0
votes
1 answer

ListView keeps data even if you exit the page

Good morning/evening. Hope you are well. I have a problem with my ListView. I receive an Article object in the constructor of my EditArticlePage(StatefulWidget) and one of the properties of my Article is a List of links that I transmit in the…
0
votes
2 answers

Preserve StatefulWidget state between rebuilds

Root widget of the app route @override Widget build(BuildContext context) { return SafeArea( child: MyStatefulWidget(), ); } In the inner stateful widget I have text field with focus management. FocusNode disposed in dispose()…
Nickolay Savchenko
  • 1,474
  • 16
  • 28
0
votes
1 answer

Flutter, Update State for a List of Stateful Widgets inside a Bloc

I am building a grid system and have been trouble updating the State of every widget in a row. Their sizes need to dynamically change. didUpdateWidget() is called in certain cases, but the state of every widget isn't always updated. Basically how…
C. Skjerdal
  • 2,750
  • 3
  • 25
  • 50
0
votes
1 answer

Flutter accessing State class variable of StatefulWidget from a different class

I have a StatefulWidget class 'FirstClass' which extends a State '_FirstClassState'. From a separate State class, called '_SecondClassState', I'm trying to access the value of a variable (called 'counter' in '_FirstClassState'). I've found a…
0
votes
1 answer

Is it ok to reuse widgets on subsequent build in Flutter?

I've been searching around and didn't quite find a suitable answer to this question: is it ok to reuse a widget in a subsequent build call? By that I mean that I create a StatefulWidget and in the build function I keep an internal reference to the…
0
votes
1 answer

Rebuild same tab with Flutter BottomNavigationBar

i have a problem with Flutter BottomNavigationBar. i built a BottomNavigationBar with 3 items, the complete code is class TabPage extends StatefulWidget { @override _TabPageState createState() => _TabPageState(); } class _TabPageState extends…
Bux
  • 14
  • 3
0
votes
1 answer

Unhandled Exception: setState() or markNeedsBuild() called during build. inside BlocListener

I'm new to flutter and trying to implement bloc in the application. I want to change the value of the flag through the event and refresh the state after the boolean value of the flag changes. I tried to setState() inside the blog listener but…
Ankur Shinde
  • 304
  • 4
  • 19
0
votes
1 answer

Flutter: State class: Why not change a state variable before the setState method is called, rather than in the setState method

To specify the question by an example: If you create a new Flutter project you get the default counter-app where the _counter variable is incremented in the setState method of the State class: class _MyHomePageState extends State { …
Norman
  • 2,267
  • 1
  • 11
  • 17
0
votes
1 answer

Flutter passing data and calling out method from a stateful widget to another statefulwidget

Good day! I have here some block of codes of my MainMenu page and Drawer. I need to pass data from MainMenu which is a statefulwidget to Drawer which is also a statefulwidget so that I can use the datas and method from MainMenu. Can someone help me…
0
votes
1 answer

Stateful Widget in a ListView is not getting updated

I have a list of all deals _deals and a list of selected deals _selectedDeals. Deals can be added to or removed from the list _selectedDeals from another class. So if a new deal is added/removed, I want to rebuild this DealsWidget so the newly…
Bugs Happen
  • 2,169
  • 4
  • 33
  • 59