tplmapsflutterplugin 1.0.0 copy "tplmapsflutterplugin: ^1.0.0" to clipboard
tplmapsflutterplugin: ^1.0.0 copied to clipboard

outdated

Basic map functionality.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart';

import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
import 'package:tplmapsflutterplugin/TplMapsView.dart';
import 'package:tplmapsflutterplugin/tplmapsflutterplugin.dart';

void main() {
  // it should be the first line in main method
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}


late TplMapsViewController _controller;

class _MyAppState extends State<MyApp> {
  Widget build(BuildContext context) {

    return TplMapsView(
      isShowBuildings: true,
      isZoomEnabled: true,
      showZoomControls: true,
      isTrafficEnabled: true,
      mapMode: MapMode.NIGHT,
      enablePOIs: true,
      setMyLocationEnabled: false,
      myLocationButtonEnabled: false,
      showsCompass: true,
      allGesturesEnabled: true,
      tplMapsViewCreatedCallback: _callback,
    );

  }

  void _callback(TplMapsViewController controller) {
    //controller.setZoomEnabled(true);
    //controller.showBuildings(false);
    _controller = controller;
     controller.showBuildings(false);
    // controller.setZoomEnabled(false);
     controller.showZoomControls(false);
     controller.setTrafficEnabled(false);
     controller.enablePOIs(true);
     controller.setMyLocationEnabled(true);
     controller.myLocationButtonEnabled(true);
     controller.showsCompass(false);

     controller.setCameraPositionAnimated(33.698047971892045, 73.06930062598059,
         14.0);
     controller.addMarker(33.705349, 73.069788);
     controller.addMarker(33.698047971892045, 73.06930062598059);
    // controller.allGesturesEnabled(false);
     controller.setMapMode(MapMode.DEFAULT);
    bool isBuildingsEnabled = controller.isBuildingEnabled;
    print("isBuildingsEnabled: $isBuildingsEnabled");
    bool isTrafficEnabled = controller.isTrafficEnabled;
    print("isTrafficEnabled: $isTrafficEnabled");
    bool isPOIsEnabled = controller.isPOIsEnabled;
    print("isPOIsEnabled: $isPOIsEnabled");
    //mapMode: MapMode.DEFAULT,

     getRouting();
  }


  void getSearchItemsbyName (){
    TPlSearchViewController tPlSearchViewController =
    TPlSearchViewController("Atrium Mall" , 24.8607 , 67.0011 , (retrieveItemsCallback) {

      // You will be get json list response
      log(retrieveItemsCallback);
    },);

    tPlSearchViewController.getSearchItems();

  }

  //24.820159, 67.123933
  //24.830831 67.080857
  
  void getRouting(){
    TPLRoutingViewController tplRoutingViewController = 
        TPLRoutingViewController(24.820159, 67.123933, 24.830831, 67.080857 , (tplRoutingCallBack) {
          log(tplRoutingCallBack);
          _controller.setUpPolyLine();
        },);

    tplRoutingViewController.getSearchItems();

  }

}
2
likes
0
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

Basic map functionality.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on tplmapsflutterplugin

Packages that implement tplmapsflutterplugin