Questions tagged [flutter-onpressed]

72 questions
1
vote
1 answer

How to set counter to working onLongPress and onTap same time?

I just started to Flutter. And as you know, Flutter have a demo project in the start. Each time I click, the number increases. But i want to when I hold it down the screen, the numbers to increase at a certain speed. But at the same time, the…
user12226101
1
vote
1 answer

if statement on OnPressed flutter

permission_handler: ^8.3.0 I inserted permission handler in pubspec.yaml
carry
  • 91
  • 7
1
vote
1 answer

How to change the color of the selected text of elevated button in Flutter?

I want to change the color of the text in the elevated button when they are selected from black to white. For now, if I select any option from these elevated buttons, the background color changes, but there is no change in the text color. But I want…
1
vote
1 answer

flutter can't access static variable

I want to access a static variable in a stateful widget in a flutter. but it does not work. and someone said that is a private widget and I can't access it. so how can I access the variable isCollapsed in the below code: class BottomNavBar extends…
user16886755
1
vote
0 answers

ElevatedButton in futurebuilder

I have a futureBuilder which populates a listView from Json. On every iteration of my list, I'm calling a custom widget, which returns a card. Works like a charm. But whenever I try and add interactivity inside my child widget like an…
1
vote
1 answer

GestureDetector does not receive events while scrolling

I have a ListView where each item has its own onTap event. If I tap on an item while the list is idle (not scrolling), everything works fine, but if I tap an item immediately following a scroll motion, the GestureDetector doesn't receive anything,…
PM4
  • 624
  • 1
  • 5
  • 18
1
vote
1 answer

Why isn't the image changing using the Provider Package?

I'm working with the Provider Package on Flutter but can't work out why it's not changing the background image when I call mymodel.image. It should access the MyModal class and change the existing image: Image.asset('images/background_image.jpeg',…
Ned Bayne-Powell
  • 181
  • 2
  • 16
1
vote
1 answer

How do I add an onTap to individual images inside an index on Flutter?

Problem: I'm using a Toggle Button inside a grid with an index of images. When the user taps on different images the Toggle Button works and highlights the selected image with a blue border but it doesn't trigger a specific action for that selected…
1
vote
1 answer

How to pass a notifyListeners method to an onPressed button function?

I have a LoginButtonProvider class and that class has two purposes. First: it should provide an onPressed method to my LoginButton widget once the user has typed in both text form fields. The class calls notifyListeners() method once it assigns a…
Aleksa Vujisic
  • 45
  • 1
  • 10
1
vote
3 answers

Flutter app - want to play sound oppressed() without it being pressed

I am working on app in which I can get the app play sound when a button is pressed, but I also want to implement a feature that when the user hover the finger over all buttons without releasing (like piano), each button play its sound. How can I do…
Gigili
  • 600
  • 1
  • 7
  • 19
1
vote
0 answers

Flat button onPressed not working with finger touch on iOs Safari

I developed a game with Flutter that I embedded on a webpage. None of the actions works on finger touch on Safari on the iPad. They respond only to mouse clicks. They do respond to finger touch on Chrome on a mobile device. On the first screen,…
cmaxetom
  • 481
  • 4
  • 10
1
vote
1 answer

Prevent Navigator.push if user press back button

In my app I need execute code before call Navigator.push. But problem is if user press back button before code is execute then there is error: E/flutter ( 8415): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Looking up a…
FlutterFirebase
  • 2,163
  • 6
  • 28
  • 60
1
vote
4 answers

How do I add both onPressed and onLongPress to a Flutter Center Widget inside a Row?

I am trying in vain to add onLongPress to an image button along with onPressed. I get error: The named parameter 'onDoubleTap' isn't defined. I have multiple rows of 2 horizontal image buttons using rows and expanded. Everything works except…
Mark
  • 83
  • 1
  • 8
0
votes
0 answers

Trying to call a Future function() in onPressed option in Flutter

I am trying to show an Unity Ad when a button is pressed. I tried a few things but I can't fix it. Here are my code snippets: main.dart -> Align( alignment: Alignment.bottomCenter, child: Padding( …
0
votes
2 answers

Flutter IconButton onPressed never fires

As I was unaware that ListTiles exists I implemented the following from scratch: My widget-structure looks like this: StudiesItemWidget (equals scaffold of widget, contains the following three) StudiesItemDuration (equals leading…
WaveZee
  • 11
  • 3