flutter - 向下滑动后窗口小部件不可见

标签 flutter dart

After swiping down and swiping up googlemap widget is not visible and gives this 错误: Unhandled Exception: 'package:flutter/src/services/platform_views.dart': Failed assertion: line 548 pos 12: '!size.isEmpty': is not true.
Here's video what happens
我的代码:

  return SnappingSheet(
          child: SmartRefresher(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: <Widget>[
                Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Icon(
                      Icons.location_on,
                      color: Colors.blueAccent,
                    ),
                    Text(
                      snapshot.data.city.toUpperCase(),
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          fontWeight: FontWeight.w900,
                          fontSize: 36,
                          color: Colors.blueAccent),
                    ),
                  ],
                ),
                Text(
                  snapshot.data.weatherData[0].main.toString(),
                  textAlign: TextAlign.center,
                  style: TextStyle(
                      fontWeight: FontWeight.w900,
                      fontSize: 20,
                      color: Colors.grey),
                ),
                Image.asset(
                  iconWeather(snapshot.data.weatherData[0].icon),
                  height: 160,
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  textBaseline: TextBaseline.ideographic,
                  children: <Widget>[
                    Text(
                      snapshot.data.temp.toInt().toString(),
                      style: TextStyle(
                          fontWeight: FontWeight.w900,
                          fontSize: 65,
                          color: Colors.blueAccent),
                    ),
                    Text(
                      "॰",
                      style: TextStyle(
                          fontWeight: FontWeight.w900,
                          fontSize: 60,
                          color: Colors.blueAccent),
                    )
                  ],
                ),
              ],
            ),
            enablePullDown: true,
            header: ClassicHeader(),
            controller: _refreshController,
            onRefresh: _onRefresh,
            onLoading: _onLoading,
          ),
          sheetBelow: Container(
            color: Colors.white,
            child: GoogleMap(
              initialCameraPosition: CameraPosition(
                  target: LatLng(Location.latitude, Location.longitude),
                  zoom: 18),
//                  markers: ,
              myLocationEnabled: true,
              onMapCreated: onMapCreated,
            ),
          ),
          grabbing: Container(
            color: Colors.blue,
            padding: EdgeInsets.only(top: 10),
            child: Text(
              "See in Map",
              textAlign: TextAlign.center,
              style: TextStyle(
                fontSize: 30,
                color: Colors.white,
                fontWeight: FontWeight.bold,
              ),
            ),
          ),
        );

最佳答案

最好的解决方案是用Stack and Positioned包装GoogleMaps小部件。这样可以防止在折叠图纸时将 map 缩小到零高度。
亚当·约翰逊(AdamJohnsson)
https://github.com/AdamJonsson

关于flutter - 向下滑动后窗口小部件不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59830158/

相关文章:

json - 如何在Flutter ListView构建期间测试json属性是否存在

flutter - 方法 map() 不适用于 map 中的列表

flutter - 使用 Dismissible 和 Provider (NotifyListener) 的笨重动画

android - 如何从在线下载视频并将其存储在本地设备上,然后使用视频播放器在 Flutter 应用程序上播放视频?

flutter - 在拍打状态下显示警报

Flutter:在 Future 函数中使用 try/catch

dart - Flutter:实现 peek & pop 效果

android - Flutter - 为什么 formKey.currentState.reset 实际上没有清除字段?

Flutter:如何使用 Wrap 而不是 ListView.builder?

json - Flutter-错误:不允许使用HTTP 405方法