Questions tagged [flutter-state]

369 questions
0
votes
1 answer

How to fetch network data on provider context change in Flutter

I have a Flutter application with some kinda weird functionality, but it's required one. The application has BottomNavigationBar with pages wrapped in IndexedStack, so that if you go to other page of this IndexedStack, the pages do not reload and…
0
votes
3 answers

How to implement Gesture detection - On Tap method in child class?

I want to implement the GestureDetector method onTapin child class. Is there a way to do it in Flutter ? ParentClass.dart Class ParentClass extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector { …
0
votes
2 answers

Flutter change state from related widget class

Lets assume a class "SpecialButton" and its State-Class "SpecialButtonState" class SpecialButton extends StatefulWidget { bool active = false; SpecialButton({Key key}) : super(key: key); @override SpecialButtonState createState() =>…
hypnomaki
  • 593
  • 9
  • 22
0
votes
1 answer

Flutter How to Pop out page automatically according to stream event?

I want to pop out a music player page when the audio stream is stopped. But I am getting error like Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe This is my code which I have placed inside the build method before…
Ranjit Shrestha
  • 622
  • 6
  • 24
0
votes
1 answer

StateNotifierProvider not keeping state between app restarts

Using flutter_riverpod: ^0.12.4 and testing in the android emulator as well as on a physical device. What am I doing wrong that the Sign In screen state value does not persist in the StateNotifierProvider after a restart of the app? The…
Zelf
  • 1,723
  • 2
  • 23
  • 40
0
votes
1 answer

How use setState() inside BottomNavigationBar item in Flutter?

I want to use DropdownButton in BottomNavigationBar items. But unable to use setState(). I see this error :- The instance member 'setState' can't be accessed in an initializer. Try replacing the reference to the instance member with a different…
Ruchira
  • 27
  • 1
  • 8
0
votes
0 answers

With Flutter, how to drag a widget and move another the other way

I'm looking for a way to move a block on the page, and, if I overlap another block, the second should move the other way. On my example, I have a game board (6*6 tiles) and init it with some blocks (Pieces) on some offsets. I thought it should be a…
Doubidou
  • 1,573
  • 3
  • 18
  • 35
0
votes
0 answers

Flutter:I can uninstall an app using android_action.Action.ACTION_DELETE .But after uninstallation restarts my whole app, how handle this issue

I have used following package to uninstall any app inside my flutter app: android_intent.Intent() ..setAction(android_action.Action.ACTION_DELETE) ..setData(Uri.parse("package:$packageName")) ..startActivityForResult().then((data) { …
NASEER ULLAH
  • 87
  • 3
  • 11
0
votes
1 answer

How can I update the ListView after getting a certain data?

I have faced this issue, I read files using this _openFile function. After the reading, I want to update the ListView using that extracted data. But I couldn't find a way to reset the state of the ListView after the execution of _openFile. Any…
user11775939
0
votes
1 answer

Why flutter reload page after navigation pop

ProfileView: enter image description here Sorry for my English. I recently started to study flutter and the following question appeared: I have a ProfileView page, this page has subscribers and subscriptions buttons, when you click on the button,…
0
votes
2 answers

How to set data in an inherited widget from a another widget?

So inherited widget is useful for passing data down the tree, but how do I set that data in the first place if inherited widgets are immutable? I'm trying to set a phone number for OTP auth and then display that number on another screen. Provider is…
0
votes
1 answer

DropdownButton updating with Provider

When i choose item in the below list, it does not change. If i click the others,then nothing happens. How can i change this value both firestore and UI ? I know, i need to update value: constantValue, this code, but how i can do that with…
coldasspirit
  • 127
  • 1
  • 11
0
votes
1 answer

calling setState from drawer?

Context Using the standard flutter demo I added a drawer. I put the contents of my drawer in another class in another file. Both are stateful widgets. I use a floating action button in the drawer with setState incrementing the global variable for…
Rainbowp0ny
  • 169
  • 1
  • 12
0
votes
3 answers

How to add a switch to change Flutter App theme?

I am new to flutter and facing issues while trying to incorporate a button on the Appbar that changes the theme of the entire app. This is the main.dart file code. import 'package:flutter/material.dart'; import…
lAaravl
  • 929
  • 2
  • 9
  • 20
0
votes
1 answer

Flutter setState() not triggering re-build

I have a login page, and I want to change the button into a CupertinoActivityIndicator when it's tapped. Here's my code : class AuthRegister extends StatefulWidget { AuthRegister({Key key, this.authenticator}): super(key: key); final…
Mouradif
  • 2,666
  • 1
  • 20
  • 37