dencity_map_plugin 0.0.2 copy "dencity_map_plugin: ^0.0.2" to clipboard
dencity_map_plugin: ^0.0.2 copied to clipboard

An Android Native Plugin Support for Dencitylite Android Applications

dencity_map_plugin #

An Android Native Plugin Support for Dencitylite Android Applications

Pub Dev

👋 Get started #

This is a plugin for Dencitylite Android Applications. This plugin is used to show the map in the Dencitylite Android Applications.

Prerequisites #

Add the following dependencies in your project level android/app/src/main/res/strings.xml file.

    <string name="google_maps_key">GOOGLE_MAPS_API_KEY</string>
import com.dencity.dencity_map_plugin.NativeViewFactory
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterActivity() {
    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        flutterEngine
            .platformViewsController
            .registry
            .registerViewFactory("com.dencity.dencity_map_plugin/map_view",
                NativeViewFactory(this)
            )
    }
}

🚀 Installation #

Add dependency #

Add the plugin to your pubspec.yaml file

dependencies:
  dencity_map_plugin: <latest_version>

The latest version is: Pub The latest version including pre-releases is: Pub

Usage #

@override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: PlatformViewLink(
          viewType: 'com.dencity.dencity_map_plugin/map_view',
          surfaceFactory: (context, controller) {
            return AndroidViewSurface(
              controller: controller as AndroidViewController,
              gestureRecognizers: const <Factory<
                  OneSequenceGestureRecognizer>>{},
              hitTestBehavior: PlatformViewHitTestBehavior.opaque,
            );
          },
          onCreatePlatformView: (params) {
            return PlatformViewsService.initSurfaceAndroidView(
              id: params.id,
              viewType: 'com.dencity.dencity_map_plugin/map_view',
              layoutDirection: TextDirection.ltr,
              creationParams: const <String, dynamic>{},
              creationParamsCodec: const StandardMessageCodec(),
              onFocus: () {
                params.onFocusChanged(true);
              },
            )
              ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
              ..create();
          },
        ),
      ),
    );
  }

🔑 Generate App key #

  1. Go to the Google Maps Platform > Credentials page.
  2. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key.
  3. Click Close.The new API key is listed on the Credentials page under API keys.(Remember to restrict the API key before using it in production.)

👨‍💻 Developer Details #

GitHub Icon LinkedIn Icon

1
likes
0
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

An Android Native Plugin Support for Dencitylite Android Applications

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on dencity_map_plugin

Packages that implement dencity_map_plugin