如何在Flutter应用上隐藏/删除标题栏? [英] How to hide/remove title bar on Flutter app?
问题描述
如何删除浮动条上的标题栏?
How can I remove title bar on flutter bar?
displayMap() {
mapView.show(new MapOptions(
mapViewType: MapViewType.normal,
initialCameraPosition:
new CameraPosition(new Location(11.052992, 106.681612), 3.0),
showUserLocation: false,
title: 'Google Map'));
.....
}
我尝试添加 Container(height:0.0)
并删除 title:'Google Map'
,但它只删除了'Google Map'文本.
I tried add Container(height: 0.0)
and remove title: 'Google Map'
but it only remove 'Google Map' text.
我的脚手架
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,
),
),
),
);
}
推荐答案
在您的 Scaffold
中,您需要删除 appBar
属性:
in your Scaffold
you need to remove your appBar
property:
return Scaffold(
//delete your appBar property in your related Scaffold.
body: YourBodyWidget(),
);
编辑:它与 map_view
插件
MapOptions(
{this.showUserLocation: false,
this.showMyLocationButton: false,
this.showCompassButton: false,
this.hideToolbar = false,
this.initialCameraPosition: _defaultCamera,
this.title: "",
this.mapViewType: MapViewType.normal});
这些是默认的 MapOptions
,也许您可以尝试设置 hideToolbar:true
,但这不是您想要的,
these are the default MapOptions
may be you can try to set hideToolbar:true
but it is not what you want I think,
我认为他们没有提供关闭 appBar
的参数,
I think they are not provide a parameter to close appBar
,
最后,我建议使用 google_maps_flutter 插件,该插件仅呈现地图,由 Flutter团队开发,因此您可以轻松地在页面/支架中配置其他人员.
Lastly I would recommend to use google_maps_flutter plugin, this plugin only render the map and developed by Flutter Team so you can easily configure other staff in your page/scaffold.
这篇关于如何在Flutter应用上隐藏/删除标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!