是否在Google Map上使用TextFormField?

时间:2020-07-31 13:52:41

标签: android flutter dart

有什么办法可以吸引到这个人吗?

 useEffect(() => {
let ignore = false;

if (!ignore)  getNote()
return () => { ignore = true; }
},[]);

要显示在下面的地图顶部?

// Note that ES6 modules cannot directly export class objects.
// This file should be imported using the CommonJS-style:
//   import x = require('[~THE MODULE~]');
//
// Alternatively, if --allowSyntheticDefaultImports or
// --esModuleInterop is turned on, this file can also be
// imported as a default import:
//   import x from '[~THE MODULE~]';
//
// Refer to the TypeScript documentation at
// https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require
// to understand common workarounds for this limitation of ES6 modules.

谢天谢地,凸起的按钮显示得很好……我希望TextFormField位于地图的顶部或底部。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

TextFormField没有自身大小,它从其父级获取大小,所以我想这是您的问题。尝试将文本字段包装在大小合适的盒子或大小合适的容器中,然后放入堆栈中:

Stack(
                children: <Widget>[
                  Container(
                    child: GoogleMap(
                      markers: Set<Marker>.of(markers.values),
                        initialCameraPosition: CameraPosition(
                            target: LatLng(lat, lng),
                            zoom: 9.0),
                        myLocationEnabled: true,
                        compassEnabled: true,
                        myLocationButtonEnabled: true,
                        mapType: MapType.normal,
                        onMapCreated: (GoogleMapController controller) {
                          controller.setMapStyle(Utils.mapStyles);
                        }),
                  ),
                  Stack(
                      children: <Widget>[
                    Positioned(
                    bottom: 0,
                    right: 250,
                    child: RaisedButton(
                          onPressed: _dosomething ,
                          child: Text("dosomething"),
                          color: Colors.grey,
                          textColor: Colors.black,)),
                    ]),
                  Container( 
                  height: MediaQuery.of(context).size.width * 0.3,
                  width: MediaQuery.of(context).size.width * 0.8,
                  child: Row(
                         children: <Widget> [

                          Expanded(
child: TextFormField(
                  controller: feedbackController,
                  cursorColor: Colors.white,
                  style: TextStyle(
                    color: Colors.white,
                  ),
                  decoration: InputDecoration(labelText: 'text input'),
 
                        )

                          ]
                         )
                  )

    ]),