r/flutterhelp • u/[deleted] • Feb 06 '22
RESOLVED Waiting for Button Press in a While Loop
I am building a game where I need my while loop to frequently stop and wait for which button is pressed to determine what happens next, my buttons are in another file and I am not sure how to make this happen.
So I need the while loop to run until I need the user to give input.
0
Upvotes
4
u/David_Owens Feb 06 '22
You may need to post/link your code. Can you upload it to a public Github repo?
It sounds like you're trying to do things the wrong way.
1
u/Techne03 Feb 06 '22
The easiest way would be probably to have the button press set a variable. Then have the while loop check the value of that variable.
2
u/StarTrekVeteran Feb 06 '22
are the buttons on the screen the whole time or in a dialog box?