Questions tagged [statelesswidget]

121 questions
0
votes
1 answer

Why is a key sometimes not needed for a StatefulWidget?

I'm trying to better understand what is happening in the official example for AnimatedPositioned. From this article (and accompanying video) we know that even if the widget object itself remains the same, but just changes position in the widget…
Sam
  • 563
  • 5
  • 15
0
votes
1 answer

In Flutter, why stateless children without keys can still work?

I'm learning flutter concept of widget key by this post. I'm confused by the fact that even there is no key in the two stateless child widgets, still they can swap places correctly. Why? Isn't the key is the only way the parent to track which child…
John Wang
  • 4,562
  • 9
  • 37
  • 54
0
votes
1 answer

Is it possible to achieve state management between two stateless widgets with no state manager?

I think this is the right question. I have encountered the problem of wanting to keep my code super condensed, and simple for the sake of my demo project. And I am using two stateless widgets which I would like to have communicate, that is I want…
RobbB
  • 1,214
  • 11
  • 39
0
votes
1 answer

Flutter StatelessWidget

I'm studying flutter by VSCode and I use auto-completion. When I use StatelessWidget I always see const MyApp({Key key}) : super(key: key); What is this mean? Is this always necessary code when i using StatelessWidget?
0
votes
1 answer

Why stateful/stateless widgets extends and doesn't implements?

I have this question for a job interview, and i want to know why the stateful and staless widgets, use extends and why not use implements in Flutter/Dart?
0
votes
2 answers

Flutter Passing a function to stateless widget not working if using RawMaterial with Textspan or recognizer

If I'm not passing the function and just testing with print, it works. I have 3 functions passed on the widget, the CircleAvatar on tap works but not with RawMaterial / button RawMaterialButton( onPressed: () =>…
Mika
  • 1
  • 1
0
votes
2 answers

How do I access an variable from a StatefulWidget inside an StatelessWidget?

How do I access the variable "selectedTag" from this statefulWidget: class _AlertDialogOneState extends State { Item selectedTag; ... } } inside this statelessWidget : class CardTile extends StatelessWidget { @override …
0
votes
3 answers

Flutter listen to lifecycle events on Stateless Widget?

Is there any solution for listening to lifecycle events for a StatelessWidget when the app is in background / foreground ? There is no StatefulWidget on that particular screen. I am using Getx() controller to observe data changes.
Niaz Ahmed
  • 220
  • 2
  • 12
0
votes
0 answers

How to enable/disable (show/hide) child widgets in a stateless widget (screen)

My app has a screen that is composed of several buttons and text labels which are conditionally visible based on the selection of the buttons (for example, a yes/no radio button asking whether you were exposed to a covid-positive individual, which…
inq
  • 183
  • 1
  • 3
  • 10
0
votes
1 answer

How do I get a black banner with text to dynamically show depending upon what a user does on another screen in Flutter?

I am tasked with the challenge of getting a black banner to show when a user returns from a screen on that same tab upon ordering an item on another screen. The current code below only shows the black banner appropriately if the user leaves by…
michaeldebo
  • 3,065
  • 4
  • 14
  • 20
0
votes
1 answer

How to pass and receive data from a StatelessWidget to another?

As I started to learn flutter, I'm using my knowledge to create a basic calculator with this framework. I found a problem in my app... And that is: how to pass params and info from one widget to another? Specially from one Stateless widget to…
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
2 answers

It is safe to use StatelessWidget when the state changes with a Provider?

I see that the flutter team advise this: For example, in Android, this is similar to placing an ImageView with your logo. The logo is not going to change >during runtime, so use a StatelessWidget in Flutter. If you want to dynamically change the UI…
Daniel Gomez Rico
  • 15,026
  • 20
  • 92
  • 162
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

How to store the value received through a method in another variable instance?

How to store the value received through a method in another variable instance? I want to store the value passed to the Statefulwidget in an instance which I am not able to do. This is how I pass the value to the Statefulwidget's…
user13410550
1 2 3
8 9