Questions tagged [flutter-onpressed]
72 questions
4
votes
2 answers
Use async function with RaisedButton onPressed() to pass object to another route
I want to be able to press a button an Navigate to another screen while passing an object as an argument. The object is created with the getPlayer() function that is within a different dart file; hence, the async function. Whenever I run the code I…

Ayren King
- 417
- 8
- 16
3
votes
2 answers
calling setState from the parent widget in flutter does not update the state
Parent Widget
class _FamilyListPageState extends State {
String initialValue = 'Search Families';
void eraseInitialValue() { <-------------- This function is passed down to the child widget
setState(() {
…

CodeR_Ax20
- 91
- 1
- 8
3
votes
2 answers
Making a new list from existing list in flutter; changes both list upon action on new list
i am making a list in flutter from an existing list and when i used this new list and perform some action on it like change its quantity parameter it changes the parameter of existing list also. Can some one tell me where i am going wrong.
Existing…

Umair
- 1,759
- 6
- 23
- 44
2
votes
1 answer
Flutter ImagePicker - Getting image asynchronously in onPressed shows lint warning
I am implementing a profile picture upload with ImagePicker and put the logic into the onPressed function of a button like this:
OutlinedButton.icon(
icon: Icon(Icons.upload),
label: Text("Select profile picture"),
onPressed:…

Big_Chair
- 2,781
- 3
- 31
- 58
2
votes
1 answer
Flutter: is it possible to resize IconButton when it is clicked (onPressed)?
I have a row, whose children are few buttons. I use them to pick color of my item, and when one icon is clicked I save color on server.
Now, I would like the chosen Icon to resize (to get bigger). So that it really look like "selected".
Do you have…

No Ziffer
- 45
- 4
2
votes
2 answers
ElevatedButton doesn't react after clicking in Flutter
i have two TextFormFields (name and age). After typing something in inputs and clicking 'send' nothing happens.
Here's my code:
my edit_page
class UserForm extends StatefulWidget {
const UserForm({Key? key}) : super(key: key);
@override
…

Adam
- 33
- 5
2
votes
1 answer
Flutter theme changing clicking on IconButton and SwitchTile
My app currently has a SwitchTile in the Drawer to set the theme but I also want to change it in a detail page using an IconButton.
I'm a newbie in Flutter and programming, so I'm not an expert and I think that I'm using the onPressed event in the…

theFreeman96
- 114
- 1
- 8
2
votes
2 answers
onPressed create multiple instances of CheckboxListTile in Flutter
I'm new to flutter so I'm not sure how to go about this. I want to be able to add another instance of the same CheckboxListTile when a user presses a button right below the most recent CheckboxListTile.
The code for how it currently is is…

Fira Shofa
- 25
- 4
2
votes
3 answers
Staggered grid view Flutter onTap is not working on tile in my code
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:landregapp/HomePage.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import…

Nns_ninteyFIve
- 439
- 4
- 12
1
vote
1 answer
Make onPressed wait for ads to be loaded
let me tell you the process I want and what is happening
Process:
Press the ElevatedButton then show adScreenLoadingDialog till _isAdLoaded=true then display the ad and go to the next screen.
What is happening: there are two conditions:
First, if…

H Amr
- 177
- 1
- 13
1
vote
1 answer
Closure call with mismatched arguments: function '_TasksListState.build..' Receiver: Closure: (bool) => Null
task_list.dart
import 'package:flutter/material.dart';
import 'package:todoey_app/widgets/task_tile.dart';
import 'package:todoey_app/models/task.dart';
class TasksList extends StatefulWidget {
@override
State createState() =>…

Gole Book
- 11
- 1
1
vote
3 answers
Select and Unselect (other) Buttons when clicked
I have a Grid.View.builder with Buttons inside. I want to be able to select just one Button at a time!
At the moment I can select Buttons but when I select other buttons the previous Button stays selected.
How can I achieve this?
In…

Val
- 31
- 1
- 7
1
vote
1 answer
Flutter button doesn't work when passing variables between files
I'm building a workout app with a sign out button and a delete exercise button. I've made a single file instead of 2 and passed variable. I did this so That I don't have to make 2 files.
the problem is with function; in the onPressed call back in…

MuhammedHazem
- 37
- 10
1
vote
3 answers
ElevatedButton disable onPressed
There are 4 ElevatedButtons in my widget in a Row. If one of them is pressed an image will be shown based on the button. This image comes from an API so it takes a bit to load.
Is it possible to disable the not-selected buttons while the data from…

Ballazx
- 431
- 4
- 12
1
vote
1 answer
how to get dynamically the id from list - flutter
I have a cardView list DUMMY_CATEGORIES on my homepage called from a category model with an id.
I want to pass the id in my homepage and then open a new page performing a onPressed method.
How can I do that?
This is my Homepage
class _HomePageState…

Giovanni
- 512
- 2
- 6
- 23