flutter - 我怎样才能让这个折叠栏与我的谷歌地图一起显示?
问题描述
在学习颤振设计的细节方面遇到问题......有人知道我如何让折叠导航侧边栏适合我的谷歌地图吗?我希望地图在它的右边。我的地图顶部还有一些以堆栈形式存在的浮动文本小部件。如果我删除我的谷歌地图,该栏会显示并正常工作。启用我的地图后它不可见。
return Stack(children: [
Scaffold(
key: _scaffoldKey,
resizeToAvoidBottomPadding: true,
appBar: AppBar(
elevation: 0.0,
backgroundColor: drawerBackgroundColor,
title: Text(
"Collapsing Navigation Drawer/Sidebar",
),
),
body: Stack(children: <Widget>[
Container(
color: selectedColor,
),
CollapsingNavigationDrawer(),
Stack(children: <Widget>[
Container(
child: GoogleMap(
markers: Set<Marker>.of(markers.values),
initialCameraPosition:
CameraPosition(target: LatLng(lat, lng), zoom: 10.0),
myLocationEnabled: true,
compassEnabled: true,
myLocationButtonEnabled: true,
mapType: MapType.normal,
onMapCreated: (GoogleMapController controller) {
controller.setMapStyle(Utils.mapStyles);
}),
),
解决方案
Stack 接受多个孩子并从下到上对它们进行排序。所以第一项是最底部的,最后一项是最顶部的。所以先放置地图,然后放置 CollapsingNavigationDrawer
Stack(children: <Widget>[
Stack(children: <Widget>[
Container(
child: GoogleMap(
markers: Set<Marker>.of(markers.values),
initialCameraPosition:
CameraPosition(target: LatLng(lat, lng), zoom: 10.0),
myLocationEnabled: true,
compassEnabled: true,
myLocationButtonEnabled: true,
mapType: MapType.normal,
onMapCreated: (GoogleMapController controller) {
controller.setMapStyle(Utils.mapStyles);
}),
),
CollapsingNavigationDrawer(),
]
推荐阅读
- python - if a user enters a fraction as one of the values of the matrix that it will simply convert to float
- css - React Router 强加了自己的导航栏样式。我可以更改链接样式,但我仍然有无法摆脱的边框和填充
- python - 试图使这项工作不知道为什么
- python - 更新包含列表中所有元素的数据框
- python - openpyxl 替换单元格范围并刷新工作簿
- android - 是否有任何用于颤振的 WIFI RTT?
- google-chrome - 替换谷歌浏览器中的cookies
- recommendation-engine - 如何在推荐引擎中对关键词进行优先级排序
- c++ - 从其他标题中隐藏宏
- php - PHP 字符串中的类常量:数组是的,标量不是真的