Questions tagged [statefulwidget]

339 questions
0
votes
2 answers

No Directionality widget found ; I want to use only Container and Text

I just run the basic flutter code. I want to make stateful widget, only containing Text("hi") so I write my code like below import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatefulWidget { …
0
votes
2 answers

This is the case for List in my StatefulWidget

Flutter import 'package:country_house/pages/Country.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; class AllCountries extends StatefulWidget { const AllCountries({Key? key}) : super(key: key); @override …
0
votes
1 answer

Add Textfield to ListView and multiply the value of that textfield by the a price of that item

I have a shopping app, Using Provider I am able to create a list of Cart items. Based on the price and the quantity from each item, a grand total is calculated. I want the user to enter their own quantity. Here is my CartScreen Widget…
winfred adrah
  • 428
  • 6
  • 18
0
votes
1 answer

OnTap Function doesn't work after changing Button to GestureDetector

I tried to modify my code to make my button decorated using GestureDetector in Stateful widget, from simple ElevatedButton in Stateless widget. Once button is tapped, onPressed function from an argument should be called. But after modifying my code,…
SayZ
  • 101
  • 1
  • 5
0
votes
0 answers

What constitutes a widget configuration change that triggers didUpdateWidget()?

According to the docs, didUpdateWidget() is Called whenever the widget configuration changes. I took this to mean that didUpdateWidget() will be triggered if a widget is being rebuilt with an argument that is different than the argument it was…
rksilvergreen
  • 95
  • 2
  • 9
0
votes
1 answer

Flutter :: change value in initialstate in statefull widget from future list

If I have statefull widget with initial satate variable called value ,Like this : @override void initState() { thisDayActivity = dataBase.getDetails(widget.courseId, widget.actId); value = 0.0; super.initState(); } thisDayActivity…
0
votes
1 answer

Flutter - How to put this string code into stateless widget or stateful widget?

Example 1 Can someone show me how to add this Example 1 to stateless or stateful widget in Flutter?
Joe Joe
  • 3
  • 3
0
votes
1 answer

Call setState from class that extends StatefulWidget

If I update a variable using class object, the build method should get called, but I am unable to call setState from the StatefulWidget class. class CustomErrorFormField extends StatefulWidget { @override _CustomErrorFormFieldState…
Siddy Hacks
  • 1,846
  • 14
  • 15
0
votes
1 answer

Force animation to stop (and get to the last position) on click in Flutter

I want to implement Stories functionality just like social media platforms. The problem I have is straight forward but I don't know Flutter that much to solve it. This is the input that I want:- This is what I have:- As you can see, on click, the…
Hussein Al-Mosawi
  • 1,464
  • 3
  • 17
  • 37
0
votes
1 answer

can we use widget data inside the initState?

Below is a code snippet of the Calendar stateful class I made.My question is, can I access the eventDateList inside the initState below as "widget.eventDateList"?! class Calendar extends StatefulWidget { final List eventDateList; final…
0
votes
1 answer

change variable value of other instances in flutter

I try to create custom dropdown for my app. And the dropdown can have three duplicate on the same screen. When each dropdown tapped, there is a variable called isDropdownOpened set to true. The case, when one of the dropdown opened then I wan't the…
0
votes
1 answer

How to define "checkboxCallback" function in this TakTile StatefulWidget widget?

I was trying to implement a Global state. When I used callbacks these errors occurred. I didn't get these errors. Please help. Errors ======== Exception caught by widgets library ======================================================= The following…
Promila Ghosh
  • 389
  • 4
  • 12
0
votes
1 answer

How to access variable of State Stateful widget outside of Widget

I need to realise row of TextField widgets. I did it. But now I want to get actual value TextEditingController from State my TextField. How I can do this? Its my Stateful widget: class _UnRecognition extends StatefulWidget { final String text; …
Борис
  • 13
  • 2
0
votes
2 answers

Can't make stateful widget's build into async function

I have a widget that is going to use the flutter_sound package to record audio: https://flutter-sound.canardoux.xyz/readme.html I set up the stateless widget, then used Android Studio's context actions to convert it to a stateful one. Then, I added…
whatwhatwhat
  • 1,991
  • 4
  • 31
  • 50
0
votes
1 answer

how can I have an isolated behavior per element in a list?

I want only the item I click on to change color, but all items inherit the new color, how can I have an isolated behavior per element in a list? import 'package:flutter/material.dart'; class myClass extends StatefulWidget { @override …