美文网首页
一个小缺陷

一个小缺陷

作者: 动哒APP | 来源:发表于2021-06-13 17:48 被阅读0次
    import 'package:flutter/material.dart';
    
    import 'package:amap_flutter_map/amap_flutter_map.dart';
    import 'package:amap_flutter_base/amap_flutter_base.dart';
    
    class RunPage extends StatefulWidget {
      RunPage({Key key}) : super(key: key);
    
      @override
      _RunPageState createState() => _RunPageState();
    }
    
    class _RunPageState extends State<RunPage> {
      List<Widget> _approvalNumberWidget = <Widget>[];
    
      static const AMapApiKey amapApiKeys = AMapApiKey(
          androidKey: 'f80b827969ecf361f33aee48accfa025',
          iosKey: '96be023e56b7ff4f1bc0cd67ac8f5a83');
    
      @override
      Widget build(BuildContext context) {
        final AMapWidget map = AMapWidget(
          mapType: MapType.satellite,
          apiKey: amapApiKeys,
          onMapCreated: onMapCreated,
          zoomGesturesEnabled: true,
          myLocationStyleOptions: MyLocationStyleOptions(
            true,
            circleFillColor: Colors.lightBlue,
            circleStrokeColor: Colors.blue,
            circleStrokeWidth: 1,
          ),
        );
    
        return Scaffold(
          body: ConstrainedBox(
            constraints: BoxConstraints.expand(),
            child: Stack(
              alignment: Alignment.center,
              children: [
                GestureDetector(
                  child: Container(
    //              height: MediaQuery.of(context).size.height,
    //              width: MediaQuery.of(context).size.width,
                    child: map,
                  ),
                  onScaleUpdate: (ScaleUpdateDetails details) {
                    print('查看缩放数值:');
                    print(details.scale);
                    print(details.horizontalScale);
                    print(details.verticalScale);
                  },
                ),
              ],
            ),
          ),
        );
      }
    
      AMapController _mapController;
      void onMapCreated(AMapController controller) {
        setState(() {
          _mapController = controller;
          getApprovalNumber();
        });
      }
    
      /// 获取审图号
      void getApprovalNumber() async {
        //普通地图审图号
        String mapContentApprovalNumber =
        (await _mapController.getMapContentApprovalNumber());
        //卫星地图审图号
        String satelliteImageApprovalNumber =
        (await _mapController.getSatelliteImageApprovalNumber());
        setState(() {
          _approvalNumberWidget.add(Text(mapContentApprovalNumber));
          _approvalNumberWidget.add(Text(satelliteImageApprovalNumber));
        });
        print('地图审图号(普通地图): $mapContentApprovalNumber');
        print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
      }
    }
    
    

    相关文章

      网友评论

          本文标题:一个小缺陷

          本文链接:https://www.haomeiwen.com/subject/jqsgeltx.html