Questions tagged [flutter-state]

369 questions
0
votes
2 answers

flutter Image is not capturing onTap button unless doing hot reload

I was trying to capture the image when tapping the InkWell button but nothing is capturing, but it working fine only after hot reloading the app. I didn't understand where the mistake is. Could anyone help me to capture the image without doing a hot…
0
votes
1 answer

Flutter access State from it's StatefulWidget

I'm writing a Application, where Widgets and their State need to be saved to Disk and later be restored. In order to save a StatefulWidget I need to access it's corresponding State object. Here's how I imagined the code to look like: class Block…
Luke
  • 365
  • 3
  • 10
0
votes
2 answers

How to listen for state changes inside a FutureBuilder widget and reflect the state change?

to demonstrate the problem, let me write down some code for a FutureBuilder. FutureBuilder(future: _myFuture, builder: (context, snapshot) { if(snapshot.hasData) { // !!!! IMPORTANT !!! // Pay attention to the _isFirstText…
0
votes
1 answer

How to add a marker to a google map upon tapping button on the parent widget in flutter

I have the following class for a google map in Flutter. class ExchangeHousesMap extends StatefulWidget { final List markers; final double initialLatitude; final double initialLongitude; const ExchangeHousesMap({ Key? key, …
0
votes
1 answer

My custom dropdown widget throws an error when trying to set an initial value for it using a model instance

I have the following custom dropdown widget that I have created. class CustomDropdown extends StatefulWidget { final Color? textColor; final Color? backgroundColor; final Color? iconColor; final bool? boldText; final Object? initialValue; …
0
votes
1 answer

Provider not rebuilding on flutter

suddently from nowhere i came up with provider not re rendering my home page when it's updated. I've inspected it and it IS UPDATED. It has newer data when i change it in firebase but the UI won't re-render showing the new data. That's my code: Main…
Alverd04
  • 13
  • 1
  • 5
0
votes
1 answer

Flutter Widget not updated by NotifyListeners

I have a radio button that doesn't update on Notify Listeners despite the groupValue is updated, the radio choice isn't updated. I use multiproviders. Here is the Radio Choices ListTile( leading: Icon( …
0
votes
0 answers

Flutter Button statemanagement using provider

In my flutter application I have a button for follow and unfollow a user. buttonstate.isSelected && widget.user!.isFollowing == true ? ElevatedButton( onPressed: () async { …
Febin Johnson
  • 277
  • 1
  • 6
  • 21
0
votes
2 answers

How to update a list in initState() flutter after the api call?

So I have a Stateful Widget which has a List variable I want to update from the API call. My issue is that the List is empty even after I do the fetchItems() in the initState(). How can I then update the itemsList with the content of the fetchItems…
dianesis
  • 333
  • 4
  • 17
0
votes
1 answer

My stateful widget does not update the ui, even though I am calling setState and passing the correct value to the widget class

I ran into a bit of a problem in flutter that I could not figure out myself. So I have the following code (only the important parts of the code are pasted), class _PrimaryDetailsEditState extends State { String bankName; …
0
votes
1 answer

setState is not updating the UI even though state is updating

I am trying to wait till amplify configuration is done then load the login screen. Even though state seems to be getting updated I am still getting the loadinscreen. Why is that? I am not sure if setState is proper method on the init : Importance of…
user3697484
0
votes
1 answer

Trouble with Flutter stateless widget call

I'm having trouble calling a page from my bottom navigation bar. My nav code looks like this: import 'package:flutter/material.dart'; import 'package:flutter_client_app/home_screen.dart'; import…
0
votes
2 answers

Flutter textfield is not updating another variable

I have the following widget. import 'package:flutter/material.dart'; class AddTaskScreen extends StatelessWidget { @override Widget build(BuildContext context) { String? newTaskTitle; return Container( color: Color(0xFF757575), …
Pranta
  • 2,928
  • 7
  • 24
  • 37
0
votes
1 answer

Flutter build called multiple times from FutureBuilder

I'm developing an app with an infinite scroll. My scroll is returned inside futurebuilder. @override Widget build(BuildContext context) { return FutureBuilder( future: VideoService.getFeed(page: page), builder: (context, AsyncSnapshot…
0
votes
2 answers

How can I use a method of state class in any another state class of same Project?

I have a long method in a State class which I want to use in any other state class. So How can I do such that ?