| | |
| | | @override |
| | | void initState() { |
| | | super.initState(); |
| | | _animationController = new AnimationController( |
| | | _animationController = AnimationController( |
| | | duration: const Duration(milliseconds: 300), vsync: this); |
| | | final CurvedAnimation curve = |
| | | CurvedAnimation(parent: _animationController!, curve: Curves.easeIn); |
| | |
| | | subscription = await LocationUtil.startLocation(scanspan, (state, map) { |
| | | if (state == LocationState.success) { |
| | | double lat = map!["latitude"] as double; |
| | | double lng = map!["longitude"] as double; |
| | | double lng = map["longitude"] as double; |
| | | currentPosition = BMFCoordinate(lat, lng); |
| | | _mapController!.setCenterCoordinate(BMFCoordinate(lat, lng), true); |
| | | setCurrentPosition(BMFCoordinate(lat, lng)); |
| | |
| | | } |
| | | |
| | | setCurrentPosition(BMFCoordinate position) async { |
| | | Directory? tempDir = await getExternalStorageDirectory(); |
| | | String tempPath = tempDir!.path; |
| | | if (userMarker == null) { |
| | | _captureController.capturePng(tempPath + "/portrait.png").then((value) { |
| | | MapUtil.addMarker(_mapController, position, value!.path, |
| | | _captureController.capturePng().then((value) { |
| | | MapUtil.addMarker(_mapController, position, value, |
| | | offset: BMFPoint(0, 40), zIndex: 10) |
| | | .then((value) { |
| | | userMarker = value; |
| | |
| | | child: //----------搜索框-------- |
| | | Flex( |
| | | direction: Axis.horizontal, |
| | | crossAxisAlignment: CrossAxisAlignment.center, |
| | | children: [ |
| | | Expanded( |
| | | child: InkWell( |
| | |
| | | LocationUtil.startLocation(0, (state, map) { |
| | | if (state == LocationState.success) { |
| | | double lat = map!["latitude"] as double; |
| | | double lng = map!["longitude"] as double; |
| | | double lng = map["longitude"] as double; |
| | | currentPosition = BMFCoordinate(lat, lng); |
| | | _mapController!.setCenterCoordinate( |
| | | BMFCoordinate(lat, lng), true); |
| | |
| | | ), |
| | | InkWell( |
| | | onTap: () { |
| | | _startLocation(0); |
| | | if(travelRECIng){ |
| | | //正在录制轨迹 |
| | | if( Global.currentPosition!=null) { |
| | | _mapController!.updateMapOptions(BMFMapOptions(center: |
| | | Global.currentPosition |
| | | )); |
| | | } |
| | | }else { |
| | | _startLocation(0); |
| | | } |
| | | }, |
| | | child: Column( |
| | | children: [ |