yjy_google_maps_flutter 2.5.2 copy "yjy_google_maps_flutter: ^2.5.2" to clipboard
yjy_google_maps_flutter: ^2.5.2 copied to clipboard

A Flutter plugin for integrating Google Maps in iOS and Android applications.

example/lib/main.dart

///
/// 发布插件时需要关闭
/// holes
///

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';

import 'package:flutter/material.dart';
// import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
import 'package:yjy_google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';

import 'animate_camera.dart';
import 'lite_mode.dart';
import 'map_click.dart';
import 'map_coordinates.dart';
import 'map_map_id.dart';
import 'map_ui.dart';
import 'marker_icons.dart';
import 'move_camera.dart';
import 'padding.dart';
import 'page.dart';
import 'place_circle.dart';
import 'place_marker.dart';
import 'place_polygon.dart';
import 'place_polyline.dart';
import 'scrolling_map.dart';
import 'snapshot.dart';
import 'tile_overlay.dart';

final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[
  const MapUiPage(),
  const MapCoordinatesPage(),
  const MapClickPage(),
  const AnimateCameraPage(),
  const MoveCameraPage(),
  const PlaceMarkerPage(),
  const MarkerIconsPage(),
  const ScrollingMapPage(),
  const PlacePolylinePage(),
  const PlacePolygonPage(),
  const PlaceCirclePage(),
  const PaddingPage(),
  const SnapshotPage(),
  const LiteModePage(),
  const TileOverlayPage(),
  const MapIdPage(),
];

/// MapsDemo is the Main Application.
class MapsDemo extends StatelessWidget {
  /// Default Constructor
  const MapsDemo({super.key});

  void _pushPage(BuildContext context, GoogleMapExampleAppPage page) {
    Navigator.of(context).push(MaterialPageRoute<void>(
        builder: (_) => Scaffold(
              appBar: AppBar(title: Text(page.title)),
              body: page,
            )));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('GoogleMaps examples')),
      body: ListView.builder(
        itemCount: _allPages.length,
        itemBuilder: (_, int index) => ListTile(
          leading: _allPages[index].leading,
          title: Text(_allPages[index].title),
          onTap: () => _pushPage(context, _allPages[index]),
        ),
      ),
    );
  }
}

void main() {
  final GoogleMapsFlutterPlatform mapsImplementation =
      GoogleMapsFlutterPlatform.instance;
  // if (mapsImplementation is GoogleMapsFlutterAndroid) {
  //   mapsImplementation.useAndroidViewSurface = true;
  //   initializeMapRenderer();
  // }
  runApp(const MaterialApp(home: MapsDemo()));
}

// Completer<AndroidMapRenderer?>? _initializedRendererCompleter;

/// Initializes map renderer to the `latest` renderer type for Android platform.
///
/// The renderer must be requested before creating GoogleMap instances,
/// as the renderer can be initialized only once per application context.
// Future<AndroidMapRenderer?> initializeMapRenderer() async {
//   if (_initializedRendererCompleter != null) {
//     return _initializedRendererCompleter!.future;
//   }
//
//   // final Completer<AndroidMapRenderer?> completer =
//   //     Completer<AndroidMapRenderer?>();
//   // _initializedRendererCompleter = completer;
//
//   WidgetsFlutterBinding.ensureInitialized();
//
//   final GoogleMapsFlutterPlatform mapsImplementation =
//       GoogleMapsFlutterPlatform.instance;
//   // if (mapsImplementation is GoogleMapsFlutterAndroid) {
//   //   unawaited(mapsImplementation
//   //       .initializeWithRenderer(AndroidMapRenderer.latest)
//   //       .then((AndroidMapRenderer initializedRenderer) =>
//   //           completer.complete(initializedRenderer)));
//   // } else {
//   //   completer.complete(null);
//   // }
//   completer.complete(null);
//   return completer.future;
// }
0
likes
130
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for integrating Google Maps in iOS and Android applications.

Repository (GitHub)
View/report issues

Topics

#google-maps #google-maps-flutter #map

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, yjy_google_maps_flutter_platform_interface, yjy_google_maps_flutter_web

More

Packages that depend on yjy_google_maps_flutter