Flutter google_maps_flutter程序包阻止AlertDialog

时间:2019-01-10 02:30:21

标签: google-maps flutter

我目前正在使用google_maps_flutter程序包,并将其放置在堆栈中并用按钮覆盖。按下按钮后,将弹出警报。

我当前遇到的问题是它在第一次加载时就可以工作,但是如果我退出应用程序,将其置于后台,然后重新进入应用程序,则将不再显示alertDialog。它存在于屏幕上是因为我无法移动地图,因此必须单击按钮通常所在的区域,但该区域不可见。

有什么想法吗?

 @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Center(
        child: new Stack(
          children: <Widget>[
            new Container(
              height: MediaQuery.of(context).size.height,
              width: MediaQuery.of(context).size.width,
              child: new Opacity(
                opacity: opacity,
                child: new GoogleMap(
                  onMapCreated: initializeMap,
                  options: GoogleMapOptions(
                    //trackCameraPosition: true,
                    compassEnabled: true,
                    myLocationEnabled: true,
                  ),
                ),
              ),
            ),
            new Align(
              alignment: new Alignment(0, 1),
              child: new GestureDetector(
                onTap: () {
                  alert();
                },
                child: new Image.asset(
                  'assets/test.png',
                  height: 150.0,
                  fit: BoxFit.cover,
                ),
              ),
            ),
          ],
        ),
      ),
    ),
  }

alert() {
    return showCupertinoDialog(
        context: context,
        builder: (BuildContext context) {
          return new CupertinoAlertDialog(
            title: new Text("hello"),
            content: new Text("hello"),
            actions: <Widget>[
              CupertinoDialogAction(
                isDefaultAction: true,
                child: Text("Ok"),
                onPressed: () {
                  Navigator.pop(context);
                }
              ),
              CupertinoDialogAction(
                child: Text("Cancel"),
                onPressed: () {
                  Navigator.pop(context);
                }
              )
            ],
          );
        },
      );
}

1 个答案:

答案 0 :(得分:0)

请紧记plot_scat <- function(data, x, y, ser) { ggplot(data, aes(x = get(x), y = get(y), color = factor(get(ser)))) + geom_point() + facet_grid(. ~ get(ser)) } plot_scat(data = cont, x = "value", y = "variable", ser = "group") 是0.0.3版的开发人员预览版。给它一点时间!