alibaba / alibaba/flutter_boost
[Bug]: A容器内开启1,2两个flutter页面,跳转到B容器开启flutter页面3,然后需要要关闭A容器内的2页面,会直接变成关闭A容器。
- Dominant language
- Dart
- Stars
- 7.2k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
### 请描述遇到的问题,以及您所期望的正确的结果
有个业务场景,在A-activity内用withContainer=false的方式,开启了两个flutter页面1和2,然后跳转到原生B-activity执行业务,然后再跳转C-activity内开启flutter页面3,这时候需要关闭前面的flutter页面2,使用pop(uniqueId)方式会直接关闭A-activity,也就同时关闭了flutter页面1和2。
看了一下flutter_boost的dart内的源代码是判断container != topContainer的时候直接_removeContainer,而不是remove这个container内的指定page。
请问一下,这个是BUG,还是特意设计如此呢?后续是否会对这个判断进行优化?
### 请说明如何操作会遇到上述问题
_No response_
### 在下面填入关键复现代码
Future pop(
{String? uniqueId, Object? result, bool onBackPressed = false}) async {
if (topContainer == null) return false;
BoostContainer? container;
if (uniqueId != null) {
container = _findContainerByUniqueId(uniqueId);
if (container == null) {
Logger.error('uniqueId=$uniqueId not found');
return false;
}
if (container != topContainer) {
_completePendingResultIfNeeded(container.pageInfo.uniqueId,
result: result);
await _removeContainer(container);
return true;
}
} else {
container = topContainer;
}
### 复现的平台
Both
### Flutter SDK版本
3.22.2
### FlutterBoost版本
5.0.2
### 是否延迟初始化FlutterBoost
Yes
### 解决方案
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the Dart pop method shown in the issue, including _findContainerByUniqueId and _removeContainer, to understand how a non-top container is handled. Reproduce the A/B/C activity sequence with FlutterBoost 5.0.2 and verify whether pop(uniqueId) should remove only page 2 or the entire A container; done means the intended behavior is confirmed and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100