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/