[英]how to add border radius to google maps in flutter?
I added a google map widget into a container with a border radius but google maps corners not rounded . 我将一个谷歌地图小部件添加到一个边框半径的容器中,但谷歌地图角落没有圆角。
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(),)
probably an expensive solution but you could use ClipRRect
. 可能是一个昂贵的解决方案,但你可以使用ClipRRect
。 Something like this: 像这样的东西:
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(),
),
),
);
}
Keep in mind that the google_maps_flutter
plugin is only a developer preview. 请注意, google_maps_flutter
插件只是一个开发者预览版。 I'm sure a lot more work will be added to this before they release version 1.0. 我确信在发布1.0版本之前,还会有更多的工作要做。 So don't stress too much about missing features. 所以不要过分强调缺少的功能。 File tickets. 文件票。 :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.