Questions tagged [statefulwidget]

339 questions
1
vote
1 answer

Data passed to Stateful Flutter Widget using Navigator.pushNamed() is null

Using Flutter, I am trying to pass data via the constructor to a new screen. However, this is somewhat of a special case because the screen is a Stateful widget and I am using the Navigation Routes method of navigation. The data also happens to be…
Nerdy Bunz
  • 6,040
  • 10
  • 41
  • 100
1
vote
2 answers

StatelessWidget to StatefulWidget

I'm adapting a class from Wikipedia Explorer (open source) to browse pre-selected pages. I'm trying to add a page counter that it doesn't update because it is a StatelessWidget. Can someone help me to turn it into StatefulWidget? class…
1
vote
1 answer

Flutter: StatefulWidget call in loop after redirection

In my widget witch is a StatefulWidget, my logic check a token and in error case, I navigate to my home page. I'm waiting the widget finish to build by using this method: WidgetsBinding.instance.addPostFrameCallback((_) { …
Lab
  • 1,237
  • 2
  • 13
  • 30
1
vote
1 answer

How does the stateful vs. stateless distinction affect when widgets will be rebuilt?

I am trying to understand how state and lifting state works in Flutter. In the code below I made a simple app where I tried to pass or lift a string and a function through multiple levels. import 'package:flutter/material.dart'; void main() =>…
Al C
  • 5,175
  • 6
  • 44
  • 74
1
vote
1 answer

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

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…
codeKiller
  • 5,493
  • 17
  • 60
  • 115
1
vote
1 answer

Flutter StatefulWidget not updating data

I am trying to pass a Map to a stateful widget, and the map updates from time to time. In my parent widget I call setState() when I change the data, and in the subwidget, I can see the data come across, but then if I try to use the data, it has not…
Alex Collette
  • 1,664
  • 13
  • 26
1
vote
1 answer

How can I create a Stateful Widget of a drawer whose list item onClick will change the content of a same screen?

I want to create an ItemsDrawer Stateful Widget, The ListTile supposed to change the content of the Item screen, but it is not changing. Also, how can I use List.builder to create a List of ListTile? Creating a method itemDrawer() works but now I…
Aakash Solanki
  • 565
  • 1
  • 6
  • 18
1
vote
1 answer

Flutter - RepaintBoundary causes state reset of StatefulWidget

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…
user23423294
  • 43
  • 1
  • 5
1
vote
1 answer

Flutter: setState() function is not properly updating value

I have a Flutter app where setState() function is called inside loadExpenses() function right after a database query method. initially the count of the expense list (expCount) is set to 0. Later on, based on the selection of fund, the expense list…
javaland235
  • 743
  • 3
  • 11
  • 21
1
vote
1 answer

Stateful Widget in Flutter

I am new to flutter and was studying with StatefulWidget but I couldn't clearly understand the following term class MyApp extends StatefulWidget { @override _myState createState() => _myState(); } I tried this @override return…
Delowar Hossain
  • 375
  • 1
  • 3
  • 19
1
vote
2 answers

Call widget's own function outside it

I have this a stateful widget which could be in two situations, the first one is a Container with a first text in it, for example, "Register", the second one is a different colored container with a different text, for example "confirm". The Problem…
Fabrizio
  • 1,138
  • 4
  • 18
  • 41
1
vote
1 answer

navigator operation requested with a context that does not include a navigator statefulwidget

I am working on the Flutter code that follows. I have issues with the second button called "Regitrese". Every place I have looked work with statelesswidgets so I'm not sure how to fix it. I tried changing the void to put on it home: MyHomePage() and…
1
vote
0 answers

StatefulWidget:Navigator operation requested with a context that does not include a Navigator

I am trying to create a sample and I am trying to create a navigation from a statefulWidget, I am getting the below error, most of the samples talk about navigation between stateless widgets flutter: ══╡ EXCEPTION CAUGHT BY GESTURE…
anoop4real
  • 7,598
  • 4
  • 53
  • 56
1
vote
1 answer

Stateful widget in Scaffold's body

I don't understand why in flutter is not possible to have a structure like this: //... Scaffold( //... body: myPage(dataList[index]) ) //... Where myPage is a class that extends statefulWidget and returns a ListView. It requires a data…
Damien
  • 921
  • 4
  • 13
  • 31
1
vote
0 answers

Keep state in MaterialApp->Scaffold->body->Text and update state from MaterialApp->Scaffold->FloatingActionButton, in Flutter

Here is a very simple Flutter Material "app", with a counter that is displayed in a Text widget, and can be incremented by pressing a floating action button, and copied to the clipboard using an action button in the appbar. The "straightforward" way…
TechAurelian
  • 5,561
  • 5
  • 50
  • 65