onLocationSelected method

void onLocationSelected(
  1. MPLocation? location
)

Implementation

void onLocationSelected(MPLocation? location) {
  if (location == null) {
    mapController.deSelectLocation();
    return;
  }
  var description = location.description;
  var type = location.typeName;
  var building = location.buildingName;
  var floor = location.floorName;
  scaffoldKey.currentState!.showBottomSheet((context) {
    return Container(
      height: MediaQuery.of(context).size.height * 0.35,
      width: MediaQuery.of(context).size.width,
      color: Colors.white,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          const SizedBox(height: 30),
          Text(
            'Description: $description',
          ),
          const SizedBox(height: 10),
          Text(
            'type: $type',
          ),
          const SizedBox(height: 10),
          Text(
            '$building - $floor',
          ),
          const SizedBox(height: 30),
          ElevatedButton(
            onPressed: () {
              orginLocation = location;
            },
            style: ElevatedButton.styleFrom(
              textStyle: const TextStyle(fontSize: 20),
              maximumSize: const Size(300, 40),
            ),
            child: Text("set as origin location"),
          ),
          const SizedBox(height: 30),
          (orginLocation != null && orginLocation != location)
              ? ElevatedButton(
                  onPressed: () => _routeStuff(location),
                  style: ElevatedButton.styleFrom(
                      textStyle: const TextStyle(fontSize: 20),
                      maximumSize: const Size(150, 40)),
                  child: const Row(
                    children: [
                      Icon(Icons.keyboard_arrow_left_rounded),
                      Text("directions")
                    ],
                  ))
              : Container(),
          // ElevatedButton(
          //     onPressed: () => _editDisplayRule(location),
          //     child: const Row(
          //       children: [
          //         Icon(Icons.colorize),
          //         SizedBox(
          //           width: 5,
          //         ),
          //         Text("Display Rule")
          //       ],
          //     ))
        ],
      ),
    );
  });
}