【发布时间】:2020-07-23 06:08:32
【问题描述】:
我使用 Stack 小部件作为父小部件。在堆栈小部件数组中,第一个小部件是谷歌地图,第二个小部件是 TextFormField,我需要在屏幕下方设置搜索栏,所以我使用定位小部件并在下面设置
Scaffold(
extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: false,
drawer: Drawer(),
appBar: CommonWidgets.appbar(true),
body: Stack(
children: <Widget>[
Container(
child: GoogleMap(
mapType: MapType.terrain,
myLocationEnabled: true,
compassEnabled: true,
tiltGesturesEnabled: true,
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.height / 5),
// markers: Set.from(model.allmarkers),
initialCameraPosition: _kGooglePlex,
onMapCreated: (GoogleMapController controller) {
// model.mapController.complete(controller);
})),
Positioned(
bottom: 30,
left: 40,
right: 40,
child: TextFormField(
controller: searchController,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
hintText: "Please enter your ",
border: InputBorder.none,
fillColor: Colors.amber,
filled: true)))
],
),
);
现在当我使用键盘输入时,我的搜索栏不会出现在软键盘上方。我认为正如我在定位小部件中设置的那样,它正在修复搜索栏并且不移动它。如何解决这个问题呢。我不能使用除 Stack 之外的任何其他小部件,因为它是一个地图屏幕,所有内容都需要显示在地图上方。
【问题讨论】:
标签: google-maps flutter keyboard