chooseActiveRoute static method

Future<void> chooseActiveRoute(
  1. int index
)

Switches visual active route among those drawn by computeRoutesAndDraw.

Implementation

static Future<void> chooseActiveRoute(int index) async {
  final c = _controller;
  final res = _lastRoutes;
  if (c == null || res == null) return;
  for (final r in res.routes) {
    final id = 'gmns_alt_${r.index}';
    // Re-add polyline with new style (simple way to recolor)
    await c.addPolyline(PolylineOptions(
      id: id,
      points: r.points,
      color: r.index == index ? const Color(0xFF1976D2) : const Color(0x661976D2),
      width: r.index == index ? 8 : 6,
    ));
  }
  _activeRouteIndex = index;
}