|
|
@@ -42,6 +42,7 @@ class _MapDemoPageState extends State<MapDemoPage> {
|
|
|
onMapCreated: onMapCreated,
|
|
|
rotateGesturesEnabled: false,
|
|
|
touchPoiEnabled: true,
|
|
|
+ tiltGesturesEnabled: false,
|
|
|
onPoiTouched: _onPoiTouched,
|
|
|
myLocationStyleOptions: MyLocationStyleOptions(
|
|
|
true,
|
|
|
@@ -78,11 +79,10 @@ class _MapDemoPageState extends State<MapDemoPage> {
|
|
|
focusedBorder: InputBorder.none,
|
|
|
hintText: '请输入地址',
|
|
|
hintStyle: TextStyle(
|
|
|
- color: MyColors.c999999,
|
|
|
- fontSize: 16),
|
|
|
+ color: MyColors.c999999, fontSize: 16),
|
|
|
isDense: true,
|
|
|
- contentPadding: const EdgeInsets.fromLTRB(
|
|
|
- 14, 4.5, 8, 4.5)),
|
|
|
+ contentPadding:
|
|
|
+ const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5)),
|
|
|
maxLines: 1,
|
|
|
style: TextStyle(
|
|
|
color: MyColors.c333333,
|
|
|
@@ -111,7 +111,7 @@ class _MapDemoPageState extends State<MapDemoPage> {
|
|
|
],
|
|
|
),
|
|
|
color: Colors.white,
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15,vertical: 30),
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 15, vertical: 30),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
@@ -169,12 +169,10 @@ class _MapDemoPageState extends State<MapDemoPage> {
|
|
|
}
|
|
|
|
|
|
void inquirePOI() {
|
|
|
- Dio()
|
|
|
- .get(
|
|
|
- 'https://restapi.amap.com/v3/place/text?keywords=${_controller.text.toString()}&city=${MyCookie().location.city}&output=json&offset=25&page=1&key=5dcd9f0ed7d51aefb5b2f73dba1069cb&extensions=all')
|
|
|
- .then((value) {
|
|
|
- print(
|
|
|
- 'https://restapi.amap.com/v3/place/text?keywords=${_controller.text.toString()}&city=${MyCookie().location.city}&output=json&offset=25&page=1&key=5dcd9f0ed7d51aefb5b2f73dba1069cb&extensions=all');
|
|
|
+ String v1 =
|
|
|
+ 'https://restapi.amap.com/v3/place/text?keywords=${_controller.text.toString()}&city=${MyCookie().location.city}&output=json&offset=25&page=1&key=5dcd9f0ed7d51aefb5b2f73dba1069cb&extensions=all';
|
|
|
+ print(v1);
|
|
|
+ Dio().get(v1).then((value) {
|
|
|
print(value);
|
|
|
PoiBeanEntity entity =
|
|
|
PoiBeanEntity().fromJson(json.decode(value.toString()));
|
|
|
@@ -185,13 +183,11 @@ class _MapDemoPageState extends State<MapDemoPage> {
|
|
|
double.parse(element.location.split(',')[0])),
|
|
|
icon: BitmapDescriptor.fromIconPath('images/地址.png'),
|
|
|
infoWindow: InfoWindow(title: element.name),
|
|
|
- // onTap: (markerId) {
|
|
|
- // print(markerId);
|
|
|
- // MapUtil.gotoAMap(double.parse(element.location.split(',')[0]),
|
|
|
- // double.parse(element.location.split(',')[1]));
|
|
|
- // },
|
|
|
- // onDragEnd: (markerId, endPosition) =>
|
|
|
- // _onMarkerDragEnd(markerId, endPosition),
|
|
|
+ onTap: (markerId) {
|
|
|
+ print(markerId);
|
|
|
+ MapUtil.gotoAMap(double.parse(element.location.split(',')[0]),
|
|
|
+ double.parse(element.location.split(',')[1]));
|
|
|
+ },
|
|
|
);
|
|
|
});
|
|
|
setState(() {
|
|
|
@@ -202,7 +198,7 @@ class _MapDemoPageState extends State<MapDemoPage> {
|
|
|
double.parse(entity.pois[0].location.split(',')[0])),
|
|
|
zoom: 18,
|
|
|
)));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
showToast('未搜索到你查找的地点');
|
|
|
}
|
|
|
});
|