flame-engine / flame-engine/flame

New `frozen` option on route/screen layering

Open
#2,311 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
10.8k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
21

Description

# Problem to solve
Hello guys, I have an issue when I want a A screen to be the frozen background of a B screen. I initially created a new `RouterComponent` with those 2 screens (that are `Component`s), and made the B screen _transparent_ allowing me to see through, thus the A screen.

```dart
router = RouterComponent(
routes: {
'world': Route(WorldScreen.new), //A screen
'collection': Route(CollectionScreen.new, transparent: true), //B screen
},
initialRoute: 'home',
),
```

But it doesn't work well. When I'm on the B screen, all events like tappables or draggables enabled on A screen are still triggered, as if the focus was on the 2 screens instead of the one we selected, thus the B screen.

We can also see that on the [Flame router demo](https://docs.flame-engine.org/1.6.0/flame/router.html#valueroute) just below, when the _Rate me_ button is still active and triggerable even if the dialog box is at foreground. That's a little bit problematic.

![image](https://user-images.githubusercontent.com/30266205/216134422-cad5c4ab-979f-45d4-a039-9ae713584e59.png)

# Proposal
An interesting thing could be a new option `frozen` on a Route, that precises that this route can't have its events triggered if a foreground route has the focus.

What do you think of it ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.