Questions tagged [flutter-state]

369 questions
1
vote
2 answers

Flutter periodic refresh and popping all other page caused error

I have an ArticlesPage widget, which has a periodic timer to route the same page again. This is a way to pull in new articles from external API. To avoid having too many pages in the screen stack, I pop all other pages using…
user1187968
  • 7,154
  • 16
  • 81
  • 152
1
vote
0 answers

Flutter - how to avoid reloading Google Maps between routes?

I have Google Maps on several routes of my app. Would there be away to avoid reloading the Google Map on a new route? I was thinking of doing away with routes, and using a big Stack, with Google Maps on the bottom, and just switching on and off…
giorgio79
  • 3,787
  • 9
  • 53
  • 85
1
vote
2 answers

Can a StatelessWidget contain member variables?

I have a StatelessWidget that uses a ScopedModel to store its data. The widget basically presents a list of checkboxes and some buttons to save the state of the checked boxes. Now I want to keep track of if the user has altered any of the…
Magnus
  • 17,157
  • 19
  • 104
  • 189
1
vote
1 answer

How to redraw entire widget tree with different argument?

I have a button on pressed method that does some async task. At the end of this task, I need to redraw the entire widget with new updated arguments. This is my Widget Class. class UIMain extends StatefulWidget { final bool loginState; final…
GunJack
  • 1,928
  • 2
  • 22
  • 35
1
vote
2 answers

StatefulWidgets in ReorderableListView don't keep their state when reordering the list

Here I have a trimmed down page which creates a ReorderableListView, which has its body set to two RecipeStepWidgets with UniqueKeys set (I've also tried this with ValueKey and ObjectKey) import 'package:flutter/material.dart'; import…
CyanBlob
  • 64
  • 1
  • 7
1
vote
3 answers

flutter share state across multiple instances of a widget

In my flutter app, I have a ConnectivityStatus widget which displays the current connection status of the app to my raspberry pi. In the initState of my widget, I subscribe to a timer to check the connection every 5 seconds and update the state…
1
vote
1 answer

The Flutter app crashes when navigating to the new screen by clicking the list item on the FancyBottomNavigation tab screen

I am rebuilding an application that has already been developed with native Android using Flutter. I'm new to Flutter and Dart. But, I staying in my previous UI with minimal changes. However, so far everything has been well done with browsing. So,…
1
vote
1 answer

Why does a child state of StatefulWidget doesn't get reset when constructor parameter changes?

I have a custom widget class: class FancyButton extends StatefulWidget { final Function() onTap; final String text; final IconData icon; bool enabled; FancyButton({this.onTap, this.text, this.icon, this.enabled = true}) @override …
1
vote
3 answers

Can I use RefreshIndicator in Stateless flutter widget?

I'm fetching some json data from the internet and displaying in a listview builder inside a stateless widget Now I want to refresh the data using RefreshIndicator. Do I need a stateful widget for this or can I manage to do this with a stateless…
1
vote
1 answer

Provider/ChangeNotifier: Set state after Widget is build

Im using the Provider/ChangenNotifier Pattern to handle state as described in the official docs. I have a state field which I want to set after a Widget is build. However if I try to set in in the build method. I get an Error: setState() or…
yN.
  • 1,847
  • 5
  • 30
  • 47
1
vote
1 answer

Preserve page state while using Navigator

I have a PageView( ) displaying four different pages and a BottomNavigationBar used to navigate to those pages. I have a FloatingActionButton on the first page when I use Navigator.push() to push the second route and Navigator.pop to pop it out the…
0
votes
2 answers

how to call setState inside FutureBuilder>in flutter

I am trying to call setState inside a ListView.builder which itself is inside a FutureBuilder FutureBuilder>( future: BidRepository().bidsTrucker('new'), builder: (context, snapshot) { if (!snapshot.hasData) { …
0
votes
3 answers

Widget builded with null value from api call in initState

I'm having trouble displaying the result of api call in widget. I'm getting "Unexpected null value" error. From some reasons I don't want to use FutureBuilder in this case. With FutureBuilder everything is ok. class Album { final int userId; …
woywie87
  • 7
  • 2
0
votes
1 answer

Flutter state, update content based on bottom navigation bar item's index

I'm building a flutter application, and at some point, i had to add a bottom Sheet so i used "showModalBottomSheet". and i wanted also to show a navigation bar inside it, so i added a customized widget of a "BottomNavigationBar", and now i want to…
0
votes
0 answers

How to display data in real time

I have a payment list that I need to import from a subcollection included in a payments collection and display it in real time. I use the stream to get a real-time change in the display of my data obtained from the firebase. Unfortunately, it didn't…
Chatti
  • 1