Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: A容器内开启1,2两个flutter页面,跳转到B容器开启flutter页面3,然后需要要关闭A容器内的2页面,会直接变成关闭A容器。 #2104

Open
fdh19979 opened this issue Aug 1, 2024 · 3 comments

Comments

@fdh19979
Copy link

fdh19979 commented Aug 1, 2024

请描述遇到的问题,以及您所期望的正确的结果

有个业务场景,在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

解决方案

@imcjj
Copy link
Collaborator

imcjj commented Aug 1, 2024

@fdh19979 目前的boost暂不支持根据uniqueId删除内部路由flutter页面,后续会考虑加入这个功能,敬请期待。

@fdh19979
Copy link
Author

fdh19979 commented Aug 2, 2024

@imcjj 如果暂时不支持,我们修改代码实现了这个功能,支持merge pull requests 吗?

@imcjj
Copy link
Collaborator

imcjj commented Aug 2, 2024

@fdh19979 欢迎提交代码,这边会对PR进行Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants