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

直接调用dismiss()或者Navigator.pop(context);都会使当前界面后退 #3

Closed
venliong opened this issue Sep 21, 2019 · 2 comments

Comments

@venliong
Copy link

下面代码正确预期是点击取消确定按钮后只是关闭对话框,但是现在会导致当前界面也关闭。

  var dialog = YYDialog().build(context)
    ..width = 250
    ..widget(
      Container(
        height: 100,
        padding: EdgeInsets.all(0.0),
        child: Row(
          children: <Widget>[
            Text('你们还不是好友,只能发送提醒消息!'),
          ],
        ),
      ),
    );
  dialog.doubleButton(
    padding: EdgeInsets.only(top: 10.0),
    // gravity: Gravity.center,
    withDivider: true,
    text1: "取消",
    color1: Colors.redAccent,
    fontSize1: 14.0,
    fontWeight1: FontWeight.bold,
    onTap1: () {
      print("取消");
      // Navigator.pop(context);
      dialog.dismiss();
    },
    text2: "确定",
    color2: Colors.redAccent,
    fontSize2: 14.0,
    fontWeight2: FontWeight.bold,
    onTap2: () {
      print("确定");
      dialog.dismiss();
      // Navigator.pop(context);
    },
  )..show();
@HggMing
Copy link

HggMing commented Sep 24, 2019

doubleButton有个默认参数,isClickAutoDismiss = true,点击按钮后自动关闭。你onTap中又调用了 dialog.dismiss(); 相当于连续调用两次,导致界面后退。

@AndroidHensen
Copy link
Contributor

fix in v1.0.1

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