Questions tagged [statefulwidget]
339 questions
1
vote
1 answer
Make Stateful Widget inside a Stateless Class
Is it possible to make a Text Widget Stateful so that the Text can be changed when i press a Button without having my Class to be Stateful?
example:
class Rangliste extends StatelessWidget{.... Text(Test), Text(Test2)....}
Test and Test2 are…

blurryface
- 45
- 2
- 7
1
vote
1 answer
How to prevent subtree with callback from rerendering in Flutter?
I'm new to Flutter and have some performance concerns. For my app, I have created a custom sidebar menu, inspired by
For this purpose, I created a stateful top-level widget that acts as the parent screen. It contains a Stack widget with the…

Max van der Hart
- 51
- 5
1
vote
1 answer
Flutter delete item from list causing full rebuilt
I actually have a list with a remove button.
Once pressed, it shows a dialog to be sure that we want to delete the item.
Once deleted, i would like that the item disappears from the UI without rebuilding the full list.
I just need that the item…

Kévin
- 497
- 10
- 37
1
vote
4 answers
Flutter, how do I correctly declare and use variables in a stateful widget?
I have a StatefulWidget that contains a ListView() with a ListView.builder(). The ListView.builder() builds several CheckboxListTile()'s using two Lists, one for the labels and one for the booleans. However it is not working as intended. I tried to…

remeo
- 13
- 1
- 3
1
vote
2 answers
Flutter Stateful Widget Constructor That Does Not Include All Members
I am building a Stateful Widget in Flutter, and as such, there is a requirement for all arguments passed in the constructor to be final (since Stateful widgets are marked with the @immutable annotation).
Thing is, I want to have two different…

tomerpacific
- 4,704
- 13
- 34
- 52
1
vote
0 answers
Flutter Hook class in Stateful widget
I am trying to have a Hook inside a Stateful Widget and this is what I tried:
class MonthScreen extends Hook {
final Month month;
MonthScreen(this.month, {Key key}) : super(key: key); // -> 'named parameter 'key' is not defined'
…

Chris
- 1,828
- 6
- 40
- 108
1
vote
2 answers
Imagepicker is rebuilt when form does, losing the selected image
I'm using a stateless screen which contains two stateful widgets, an imagepicker and a form with many fields. When i open the keyboard, if i selected an image previously, it disappears and the entire imagepicker widget is reinitialized.
This means…

m.i.n.a.r.
- 922
- 2
- 12
- 28
1
vote
1 answer
How to listen to events or data change in parent widget and propagate it to child widget in flutter?
Let's say I have two stateful widgets "Parent" and "Child", each written in separate class. The Child has functions and callbacks to pass data to Parent. However if something happens in Parent widget, let's say user taps on a button in Parent…

Jonathan John
- 13
- 4
1
vote
1 answer
Why is navigator.push not working in my flutter web app?
I am building a flutter web app. I have a widget which I control with cubit, depending on if the user is logged in or not. If the user is logged in, I displa his profile picture as a dropdown button, and if he selects option A i want to push him to…

Bennett567
- 535
- 1
- 3
- 18
1
vote
2 answers
Getting error while passing key in stateful widget flutter
I'm trying to animate the width of AnimatedContainer. For this purpose i'm using a statefull widget in external file, here is code for this class
class AnimatedContainerWidget extends StatefulWidget {
const AnimatedContainerWidget({
Key: key,
…

Mudasir Habib
- 704
- 7
- 14
1
vote
1 answer
How to pass a number (through clicking Button "OnPressed property) from a stful widget (First screen on the app) to ListView.builder at Second Page
I got an issue. I am at the opening page of my app, which is stful widget. In the middle of the screen is a button, and a container below. In the container appears random numbers every some time. How can I solve the problem, where I want to create…

RobsonGieret
- 21
- 1
1
vote
1 answer
use AppLifecycleState in StatelessWidget
in StatefulWidget when need to work with AppLifecycleState we work with WidgetsBindingObserver
@override
initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void dispose()…

George Anwer
- 13
- 5
1
vote
1 answer
Flutter icons appear as rectangle
I'm using Custom flutter icons which is generated from fluttericons.com .But here the problem is my icons are not appeared as it. It shows rectangular box with strikeout symbol in preview like this. (Refer the image below )
Here is my code snippet…

ARUN BALAJI
- 127
- 1
- 15
1
vote
2 answers
Passing a StatefulWidget as argument and accessing its Constructor
I have created a custom StatefulWidget that takes a Widget as an argument.
import 'package:flutter/material.dart';
class CustomWidget extends StatefulWidget {
final Widget myWidget;
CustomWidget({this.myWidget});
@override
…

ASAD HAMEED
- 2,296
- 1
- 20
- 36
1
vote
2 answers
How to solve error: 'setState' isn't defined
Can you please help me to solve this problem about setState()
ERROR:
The method 'setState' isn't defined for the type 'MyApp'.
Try correcting the name to the name of an existing method, or defining a method named 'setState'.
CODE:
return…

Abdelilah Ng
- 53
- 5