首页 > 解决方案 > 如何隐藏/删除 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',但它只删除“谷歌地图”文本。

在此处输入图像描述

编辑:

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

标签: flutter

解决方案


在你的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开发,因此您可以轻松地在页面/脚手架中配置其他人员。


推荐阅读