如何删除颤动栏上的标题栏?
displayMap() {
mapView.show(new MapOptions(
mapViewType: MapViewType.normal,
initialCameraPosition:
new CameraPosition(new Location(11.052992, 106.681612), 3.0),
showUserLocation: false,
title: 'Google Map'));
.....
}
Run Code Online (Sandbox Code Playgroud)
我尝试添加Container(height: 0.0)和删除,title: 'Google Map'但它只删除了“谷歌地图”文本。
编辑:
我的 Scaffold
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Demo App'),
),
body: new Center(
child: Container(
child: RaisedButton(
child: Text('Touch'),
color: Colors.blue,
textColor: Colors.white,
elevation: 7.0,
onPressed: displayMap,
),
),
),
);
}
Run Code Online (Sandbox Code Playgroud)
小智 19
在某些情况下,需要使用 AppBar 但不显示标题,其中一种情况是当我们同时使用 AppBar 和 TabBar 时。
在这种情况下,您需要删除 AppBar 标题并包含以下属性:toolbarHeight: 0
DefaultTabController(
length: 2,
child: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
bottom: TabBar(
isScrollable: false,
indicatorColor: Colors.blue,
onTap: (index) { },
tabs: [
Tab(text: "Pending"),
Tab(text: "Done"),
],
),
//this property
toolbarHeight: 0,
), body: TabBarView(...)
)
)
Run Code Online (Sandbox Code Playgroud)
在您Scaffold需要删除您的appBar财产:
return Scaffold(
//delete your appBar property in your related Scaffold.
body: YourBodyWidget(),
);
Run Code Online (Sandbox Code Playgroud)
编辑:它与map_view插件有关
MapOptions(
{this.showUserLocation: false,
this.showMyLocationButton: false,
this.showCompassButton: false,
this.hideToolbar = false,
this.initialCameraPosition: _defaultCamera,
this.title: "",
this.mapViewType: MapViewType.normal});
Run Code Online (Sandbox Code Playgroud)
这些是默认MapOptions设置,您可以尝试设置,hideToolbar:true但我认为这不是您想要的,
我认为他们没有提供关闭参数appBar,
最后,我建议使用google_maps_flutter插件,该插件仅渲染地图并由Flutter 团队开发,因此您可以轻松地在您的页面/脚手架中配置其他人员。
| 归档时间: |
|
| 查看次数: |
7339 次 |
| 最近记录: |