How can I have text appear on top of a component when it is selected? I am trying to select a component and have the name of the component appear at the top of it. And help is appreciated as I am quite lost
CodePudding user response:
Add TappableComponent to your component and HasTappableComponents to the game to start with.
Then add a TextComponent as a child of your component by overriding onTapDown inside of your component, like this:
final text = TextComponent(text: 'text');
void onTapDown(TapDownEvent event) {
add(text);
}
