首页 > 解决方案 > DraggableScrollableView 和 GoogleMaps - 地图显示为白色空白页

问题描述

我正在尝试将 DraggableScrollableSheet 用作 Scaffold bottomSheet 和带有 Google Maps 的主体,但到目前为止还没有运气。有什么提示可能是错的吗?

    return Scaffold(
        appBar: AppBar(
          title: Text("Meeting"),
          backgroundColor: Colors.black,
          automaticallyImplyLeading: false,
        ),
        body: Stack(
          children: <Widget>[
            GoogleMap(
              markers: Set<Marker>.of(markers.values),
              // YOUR MARKS IN MAP
              initialCameraPosition: CameraPosition(
                  target: LatLng(47.502941, 18.999161),
                  zoom: 1),
              myLocationEnabled: true,
              zoomControlsEnabled: true,

            ),
          ],
        ),
        bottomSheet:             DraggableScrollableSheet(
          initialChildSize: 0.3,
          minChildSize: 0.1,
          maxChildSize: 0.9,
          builder: (context, scrollController) {
            return SingleChildScrollView(
              child: Card(
                 Text("test"),
            );
          },
        ),
        ,
        bottomNavigationBar: BottomNavigationBar(
          backgroundColor: Colors.white,
          selectedItemColor: Colors.black,
          unselectedItemColor: Colors.black,
          iconSize: 26,
          items: const <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.close),
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.check),
            ),
          ],
        ));
  }
}

标签: flutter

解决方案


我不知道到底出了什么问题。但我一直使用可拖动工作表的方式是将其与主视图放在一个堆栈中。你可以试试。如果问题与谷歌地图有关,那么您可以检查地图 api 密钥是否设置正确。


推荐阅读