16

在此处输入图像描述

我将谷歌地图小部件添加到具有边框半径但谷歌地图角不圆的容器中。

Container(
            height: 100,
            width: double.infinity,
            margin: EdgeInsets.only(left: 30, right: 30),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(30),
              border: Border.all(
                style: BorderStyle.solid,
              ),
            ),
            child: GoogleMap(),)

4

2 回答 2

28

可能是一个昂贵的解决方案,但您可以使用ClipRRect. 像这样的东西:

Widget build(BuildContext context) {
    return Center(
      child: ClipRRect(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(30),
          topRight: Radius.circular(30),
          bottomRight: Radius.circular(30),
          bottomLeft: Radius.circular(30),
        ),
        child: Align(
          alignment: Alignment.bottomRight,
          heightFactor: 0.3,
          widthFactor: 2.5,
          child: GoogleMap(),
        ),
      ),
    );
  }
于 2018-12-29T20:49:58.757 回答
3

请记住,该google_maps_flutter插件只是开发人员预览版。我敢肯定,在他们发布 1.0 版之前,还会有更多的工作要做。所以不要过分强调缺少的功能。归档票据。:)

于 2019-01-01T00:23:32.007 回答