hs_amap_map 1.0.2 copy "hs_amap_map: ^1.0.2" to clipboard
hs_amap_map: ^1.0.2 copied to clipboard

A Flutter plugin for AMap (AutoNavi) maps. Supports 2D/3D map rendering, marker customization, camera position control, and zoom/rotation gestures for both iOS and Android.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:hs_amap_map/hs_amap_map.dart';
import 'package:hs_amap_map_example/map_view.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await HsAmapMap.setPrivacyAgreed(true);
  await HsAmapMap.setApiKey(androidKey: '你的Key', iosKey: '高德Appkey');
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: HomePage());
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    // ✅ 这里的 context 是 HomePage 的 context,它是 MaterialApp 的子 widget,包含 Navigator
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            Navigator.push(
              context,
              PageRouteBuilder(
                pageBuilder: (context, animation, secondaryAnimation) {
                  return MapPage();
                },
              ),
            );
          },
          child: Text('跳转'),
        ),
      ),
    );
  }
}
0
likes
145
points
22
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for AMap (AutoNavi) maps. Supports 2D/3D map rendering, marker customization, camera position control, and zoom/rotation gestures for both iOS and Android.

Repository

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on hs_amap_map

Packages that implement hs_amap_map