Questions tagged [statelesswidget]

121 questions
1
vote
1 answer

How to display text in 'Text' widget after flatButton press?

I'm trying to make a calculator app using flutter where instead of taking input through the keyboard I want to take input through some buttons. The issue comes when I press a button but it does not display the corresponding data in the Text widget…
Aryaman Arora
  • 65
  • 2
  • 7
1
vote
1 answer

Flutter type 'List' is not a subtype of type 'list'

I'm trying to make a list with cards with an image, the idea is that these cards are generated dynamically in the future through API requests, but for now I want to start with an image only, but when I run I have the following error : type 'List '…
kingninja
  • 35
  • 1
  • 5
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…
0
votes
1 answer

Why is IconButton a stateless widget in Flutter, rather than being a stateful widget?

In the flutter documentation, it states "A stateless widget never changes. Icon, IconButton, and Text are examples of stateless widgets. Stateless widgets subclass StatelessWidget. A stateful widget is dynamic: for example, it can change its…
987Lan
  • 1
  • 2
0
votes
1 answer

transter data from statefull widget to another

I want to transfer the data from text field in floatingActionButton witch is thefloatingactionbutton in MainWidget to MainWidget class in to the text kind of want to give and get the data from these two class void main() async { runApp(new…
ali ma
  • 5
  • 2
0
votes
0 answers

Are there any problems with this use of a Provider instead of a StatefulWidget?

class Example extends StatelessWidget { final List children; const Example({super.key, required this.children}); @override Widget build(BuildContext context) { return ChangeNotifierProvider( create: (_)…
Ринат
  • 96
  • 1
  • 2
0
votes
0 answers

How to fix `Do not use BuildContexts across async gaps` in a StatelessWidget?

During a FireAuth process, I need to store a user instance in my ChangeNotifier appState. Therefore I am meant to do that: Provider.of(context, listen: false).signedIn = shokazeUser; Unfortunately, I must fetch the shokazeUser from the…
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
0
votes
3 answers

How to use a method in a Stateful Widget from another Widget

So i have this toggle() method in the Stateful SideBar class class SideBar extends StatefulWidget { const SideBar({super.key}); @override State createState() => _SideBarState(); } class _SideBarState extends State with…
0
votes
2 answers

Flutter : DefaultTabController Tabbar Tab Color not changing on selection

In my app I am using a DefaultTabController to display tabs which was working fine but i want to change the Tabbar Tab color when selecting a tab, which was not happening now. I used below code to highlight the selected tab color. decoration:…
KJEjava48
  • 1,967
  • 7
  • 40
  • 69
0
votes
2 answers

Main app widget: setState call -> build() builds all widgets but screen not updated

App is a simple memory/guessing game with a grid of squares. Floating action button triggers a "New game" dialog, and a Yes response triggers setState() on the main widget. The print() calls show it is building all the Tile widgets in the grid, but…
idarwin
  • 607
  • 4
  • 19
0
votes
1 answer

Radio button with stateless widget or using BLoC Pattern in Flutter

I need to create a group of radio buttons without using the stateful widget. I want a BLoC Pattern in flutter to create a group of radio buttons. How to create it? I have only tried using the regular Radio widget using the onChange state management.
Neeta
  • 3
  • 2
0
votes
5 answers

Flutter: How to convert a stateful widget to a stateless widget and keep state changes

I want to change a stateful widget to a stateless widget and keep the set states functions available, how can I do it?
Joann
  • 11
  • 2
0
votes
2 answers

How to fix IconButton onPressed property?

Hello my button's onPressed function is giving error (null is working). Any idea why? Below is the code. The first image asset is wrapped inside an IconButton and I wrote its onPressed property as "onPressed: () {}, thanks " but it is giving Dart…
0
votes
0 answers
0
votes
0 answers

Comparing stateless widgets for equality flutter

Im currently experimenting with flutter, and I wrote the following code. Text t1 = const Text("Hi"); Text t2 = const Text("Hi"); print(t1 == t2); The print statement prints false, but because i'm creating two constants, shouldn't this print…
bdell
  • 27
  • 1
  • 6
1 2 3
8 9