map_page.dart 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:amap_base/amap_base.dart';
  3. import 'package:flutter_note/provide/home_provide.dart';
  4. import 'package:provide/provide.dart';
  5. class MapPage extends StatefulWidget {
  6. @override
  7. _MapPageState createState() => _MapPageState();
  8. }
  9. class _MapPageState extends State<MapPage> {
  10. AMapController _controller;
  11. @override
  12. void initState() {
  13. super.initState();
  14. }
  15. @override
  16. void dispose() {
  17. _controller.dispose();
  18. super.dispose();
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. var provide = Provide.value<HomeProvide>(context);
  23. return Scaffold(
  24. appBar: AppBar(
  25. title: Text('Map'),
  26. ),
  27. body: AMapView(
  28. onAMapViewCreated: (controller) {
  29. _controller = controller;
  30. _controller.showIndoorMap(true);
  31. _controller.setZoomLevel(19);
  32. },
  33. amapOptions: AMapOptions(
  34. compassEnabled: false,
  35. zoomControlsEnabled: true,
  36. logoPosition: LOGO_POSITION_BOTTOM_LEFT,
  37. camera: CameraPosition(
  38. target:
  39. LatLng(provide.latitude, provide.longitude) /*, zoom: 15.0*/),
  40. ),
  41. ),
  42. );
  43. }
  44. }