我如何调整谷歌Map的高度,以便看到页面的背景稍微.我一直在使用curved_navigation_bar
这将是伟大的,如果有人能帮助我,提前感谢你这么多!.
当前结果
预期输出
导航栏
Widget _content = Container();
Color color = Colors.deepPurple;
class HomePage extends State<MyHomePage>{
@override
Widget build(BuildContext context){
return Scaffold(
backgroundColor: color,
body: _content,
bottomNavigationBar: CurvedNavigationBar(
backgroundColor: color,
items: [
Icon(Icons.home),
Icon(Icons.dashboard),
Icon(Icons.settings)
],
onTap: (index){
setState(() {
if (index ==0){
_content = GoogleMapScreen();
}
else if (index ==1){
_content = GoogleMapScreen();
}
else{
_content = GoogleMapScreen();
}
});
},
),
);
}
}
谷歌Map页面
class GoogleMapScreen extends StatefulWidget{
@override
_GoogleMapScreenState createState() => _GoogleMapScreenState();
}
class _GoogleMapScreenState extends State<GoogleMapScreen>{
Set<Marker> _markers = {};
void _onMapCreated(GoogleMapController controller) {
setState(() {
_markers.add(
Marker(markerId: MarkerId('id-1'),
position: LatLng(39.9042, 116.4074),
infoWindow: InfoWindow(
title: 'Sample Marker',
snippet: 'A secret Place',
)
),
);
});
}
@override
Widget build(BuildContext context){
return Scaffold(
appBar: AppBar(
title: Text('API MAP'),
),
body: GoogleMap(
onMapCreated: _onMapCreated,
markers: _markers,
initialCameraPosition: CameraPosition(target: LatLng(39.9042, 116.4074),
zoom: 15,
))
);
}
}
2条答案
按热度按时间piok6c0g1#
您可以将GoogleMap小部件 Package 到Padding:
yeotifhr2#
你也可以用
SizedBox()
Package googleMap