如何在Flutter应用上隐藏/删除标题栏?

时间:2019-03-24 10:40:56

标签: flutter

如何删除浮动条上的标题栏?

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”文本。

enter image description here

编辑:

我的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,
          ),
        ),
      ),
    );
  }

1 个答案:

答案 0 :(得分:1)

在您的Scaffold中,您需要删除appBar属性:

    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,但这不是您想要的,

我认为他们没有提供关闭appBar的参数,

最后,我建议使用google_maps_flutter插件,该插件仅呈现地图并由 Flutter Team 开发,因此您可以轻松地在您的配置其他工作人员页面/支架。

相关问题