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

popWindow路由异常 #57

Closed
IOCloudFly opened this issue Jan 7, 2022 · 2 comments
Closed

popWindow路由异常 #57

IOCloudFly opened this issue Jan 7, 2022 · 2 comments

Comments

@IOCloudFly
Copy link

问题提交

标题格式:[BUG]: 问题简介

内容需包含:

1、BUG 描述

BrnPopupListWindow.showPopListWindow
点击事件,路由无法跳转
BrnPopupListWindow.showPopListWindow(context, _popWindowKey, offset: 10, data: ["新增个人担保人", "新增企业担保人"], onItemClick: (index, item) { if(index == 0){ print('1111111'); Navigator.push( context, MaterialPageRoute(builder: (context) => GuarantorPersonPage()), ); Get.toNamed(AppPages.guarantorPerson); } else { print('222222'); Get.toNamed(AppPages.guarantorCompany); } },); })
我用了两个路由才能实现跳转,我用了一个原生+getx路由,才能跳转过去。

2、复现步骤
BrnPopupListWindow.showPopListWindow

3、期望行为
希望只要是个路由就能跳转过去

4、运行环境
Flutter 1.22.5 • channel stable
Engine • revision ae90085a84
Tools • Dart 2.10.4

  • 运行设备
    Android oppo R17
  • 系统
    Mac
  • Bruno 版本
  • Flutter Doctor 信息

5、附加信息

包括视频、图片等补充信息

@violinday
Copy link
Collaborator

经过验证,可复现这个问题。
原因是: onItemClick 点击触发后,内部存在 pop逻辑,使浮层消失。若 onItemClick 中存在页面路由,则会将页面路由 pop 掉。

近期会发布小版本修复该问题~

临时解决方案有两个个:
1、在 onDismiss 中添加路由逻辑,类似:

BrnPopupListWindow.showPopListWindow(
  context,
  aaaaa,
  offset: 10,
  data: ["新增个人担保人", "新增企业担保人"],
  onDismiss: (){
    Navigator.push(context, route);
  }
);

2、可 onItemClick 返回 true 拦截点击事件。自定义点击行为,类似:

BrnPopupListWindow.showPopListWindow(
  context,
  _popWindowKey,
  offset: 10,
  data: ["新增个人担保人", "新增企业担保人"],
  onItemClick: (index, item) {
    if (index == 0) {
      print('1111111');
      /// 关闭 浮层
      Navigator.pop(context);
      /// 页面路由
      Navigator.push(context, route);
      return true;  /// 返回true 表示拦截该点击事件
    } else {
      print('222222');
    }
  },
);

@zhoujuanjuan
Copy link
Collaborator

关于 popWindow 路由已做优化 https://github.com/LianjiaTech/bruno/pull/63,可再试下

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

3 participants