我正在开发一个新的Flutter项目,它应该在上半屏幕上显示一个谷歌地图,在下半屏幕上展示一个包含信息和操作的面板,就像你在屏幕截图上看到的那样:
我想创建一种方法来隐藏面板,并在用户点击关闭按钮或向下滑动面板时全屏显示地图,另一种方法是,用户应该能够点击按钮以获得初始视图。
这里是类的主体:
body: Stack(
children: [
GoogleMap(
padding: EdgeInsets.only(bottom: bottomPaddingOfMap),
mapType: MapType.normal,
compassEnabled:true,
myLocationButtonEnabled: true,
myLocationEnabled: true,
zoomGesturesEnabled: true,
zoomControlsEnabled: true,
initialCameraPosition: _kGooglePlex,
onMapCreated: (GoogleMapController controller){
_controllerGoogleMap.complete(controller);
newGoogleMapController = controller;
setState(() {
bottomPaddingOfMap = 300.0;
});
locatePosition();
},
),
//extra hamburger Drawer
Positioned(
top: 45.0,
left: 22.0,
child: GestureDetector(
onTap: (){
scaffoldKey.currentState.openDrawer();
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(22.0),
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 6.0,
spreadRadius: 0.5,
offset: Offset(
0.7,
0.7,
),
),
],
),
child: CircleAvatar(
backgroundColor: Colors.white,
child: Icon(Icons.menu, color: Colors.black,),
),
),
),
),
Positioned(
left: 0.0,
right: 0.0,
bottom: 0.0,
child: Container(
height: 350.0,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(topLeft: Radius.circular(18.0), topRight: Radius.circular(18.0)),
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 16.0,
spreadRadius: 0.5,
offset: Offset(0.7, 0.7),
)
]
),
child:
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
RaisedButton.icon(
icon: Icon(Icons.cake),
label: Text("Close"),
onPressed: (){
print("pulsaado");
},
),
],
),
),
),
SizedBox(height: 6.0,),
Text("Hi there!", style: TextStyle(fontSize: 18.0),),
Text("Where do you want to create an alert?", style: TextStyle(fontSize: 20.0, fontFamily: "Brand-Bold"),),
SizedBox(height: 20.0,),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5.0),
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 6.0,
spreadRadius: 0.5,
offset: Offset(0.7, 0.7),
),
],
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
children: [
Icon(Icons.search, color: Colors.blueAccent ),
SizedBox(width: 10.0,),
Text("Search Drop Off"),
],
),
),
),
SizedBox(height: 24.0,),
Row(
children: [
Icon(Icons.home, color: Colors.grey,),
SizedBox(width: 12.0,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Add Home"),
SizedBox(height: 4.0,),
Text("Your living home address", style: TextStyle(color: Colors.black54, fontSize: 12.0),),
],
),
],
),
SizedBox(height: 10.0,),
DividerWidget(),
SizedBox(height: 16.0,),
Row(
children: [
Icon(Icons.home, color: Colors.grey,),
SizedBox(width: 12.0,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Add Work"),
SizedBox(height: 4.0,),
Text("Your office address", style: TextStyle(color: Colors.black54, fontSize: 12.0),),
],
),
],
)
],
),
),
),
),
],
),
我希望你能提出建议,以实现预期的行为。