如何在没有按钮的情况下添加分频器?

How to add dividers in flutter with yes no buttons?

我必须为我的警报对话框添加水平和垂直分隔线,如图所示。

我尝试的唯一方法是这里,最好不要引用这段代码,但我需要按照图像中的预期进行设计。

AlertDialog(
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.all(Radius.circular(10.0))
  ),
  content: Column(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      new Row(
        children: <Widget>[
          Expanded(
            child: Container(
              decoration: BoxDecoration(
                border: Border.all(color: Colors.black)
              ),
              child: new GestureDetector(
                onTap: () => callback(AlertButton.positive),
                child: new Text(
                  positiveActionText,
                  textAlign: TextAlign.center,
                ),
              ),
            ),
          ),
          Expanded(
            child: Container(
              decoration: BoxDecoration(
                border: Border.all(color: Colors.black)
              ),
              child: new GestureDetector(
                onTap: () => callback(AlertButton.negative),
                child: new Text(
                  negativeActionText,
                  textAlign: TextAlign.center,
                ),
              ),
            ),
          ),
        ],
      ),
    ],
  ),
);

下图为图片: Expected design Image

您可以使用 CupertinoAlertDialog,默认情况下有这些行:

你的情况:

showDialog(
    context: context,
    builder: (_) => CupertinoAlertDialog(
        content: Text('Are you sure want to logout?'),
        actions: [
            CupertinoDialogAction(child: Text('Yes'), onPressed: (){}),
            CupertinoDialogAction(child: Text('No'), onPressed: (){}),
        ],
    ),
);

您可以使用分隔线小部件

Divider(
  color: Colors.black87,
  height: 10.0,
  indent: 5.0,// Starting Space
  endIndent: 5.0 // Ending Space
)
var alert = new CupertinoAlertDialog(
  title: new Text("Alert"),
  content: new Text("Test Sample 123."),
  actions: <Widget>[
    new CupertinoDialogAction(
      child: const Text('Discard'),
      isDestructiveAction: true,
      onPressed: (){}
    ),
    new CupertinoDialogAction(
        child: const Text('Cancel'),
        isDefaultAction: true,
        onPressed: () {}
    ),
  ],
);

showDialog(context: context, child: alert);