If you run the app now, everything should work as expected and the app has all the functionality it needs. But when the user reaches the end of the storyline, the top button reads Restart, but the bottom button doesn't say anything. There is no second choice for the user to make. So it makes more sense to hide the second button. But how do we do this using Flutter?

Let's google this: https://www.google.com/search?q=flutter+hide+widget


//TODO: Step 26 - Use a Flutter Visibility Widget to wrap this FlatButton.

Remember, in order to wrap a Widget in another Widget, you can use the light bulb or

the Show Intention Actions shortcut:

mac: ⌥ + ↩︎

windows: Alt + Enter

HINT

Step 26 SOLUTION


//TODO: Step 27 - Create a method called buttonShouldBeVisible() which checks to see if storyNumber is 0 or 1 or 2 (when both buttons should show choices) and return true if that is the case, else it should return false.

We need a way of checking if at this current point in the storyline if the bottom blue button should be visible or should be hidden. We'll create a method in the story_brain.dart to do this.

Step 27 SOLUTION


//TODO: Step 28 - Set the "visible" property of the Visibility Widget to equal the output from the buttonShouldBeVisible() method in the storyBrain.

The Visibility Widget accepts a property called visible. When this is set to true, the child of the Visibility Widget will be visible, if it's false, it will remove the child Widget from the screen.

Step 28 SOLUTION