diff --git a/.github/workflows/ci-mobile.yml b/.github/workflows/ci-mobile.yml new file mode 100644 index 0000000..0e8db9a --- /dev/null +++ b/.github/workflows/ci-mobile.yml @@ -0,0 +1,95 @@ +name: ci-mobile + +on: + push: + branches: + - main + paths: + - 'mobile/**' + - 'packages/ferrostar_flutter/**' + pull_request: + paths: + - 'mobile/**' + - 'packages/ferrostar_flutter/**' + +jobs: + test-mobile: + name: Flutter tests (iOS) + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + cache: true + + - name: Install dependencies (plugin) + working-directory: packages/ferrostar_flutter + run: flutter pub get + + - name: Install dependencies (app) + working-directory: mobile + run: flutter pub get + + - name: Analyze (plugin) + working-directory: packages/ferrostar_flutter + run: flutter analyze + + - name: Analyze (app) + working-directory: mobile + run: flutter analyze + + - name: Test (plugin) + working-directory: packages/ferrostar_flutter + run: flutter test + + - name: Test (app) + working-directory: mobile + run: flutter test + + test-mobile-ios: + name: Flutter integration tests (iOS simulator) + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - uses: flutter-actions/setup-flutter@v3 + with: + channel: stable + + - name: Install dependencies (plugin) + working-directory: packages/ferrostar_flutter + run: flutter pub get + + - name: Install dependencies (app) + working-directory: mobile + run: flutter pub get + + - name: Boot iPhone 17 simulator + run: | + UDID=$(xcrun simctl list devices available --json \ + | python3 -c " + import json,sys + devs = json.load(sys.stdin)['devices'] + for runtime, devices in devs.items(): + for d in devices: + if 'iPhone 17' in d['name'] and d['isAvailable']: + print(d['udid']); exit() + ") + xcrun simctl boot "$UDID" + echo "SIM_UDID=$UDID" >> "$GITHUB_ENV" + + - name: Enable Flutter SPM integration + working-directory: mobile + run: flutter config --enable-swift-package-manager + + - name: Build (simulator, no codesign) + working-directory: mobile + run: flutter build ios --no-codesign --simulator + + - name: Run integration smoke test + working-directory: mobile + run: flutter test integration_test/navigation_smoke_test.dart -d "$SIM_UDID" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5187496..e2c830d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,13 +70,18 @@ jobs: with: node-version: 22 cache: npm - cache-dependency-path: frontend/package-lock.json + cache-dependency-path: web/package-lock.json - run: npm ci - working-directory: frontend + working-directory: web - run: npm run build - working-directory: frontend + working-directory: web + + - name: regenerate mobile style and verify it matches committed artifact + run: | + npm --prefix web run build:mobile-style + git diff --exit-code mobile/assets/styles/beebeebike-style.json publish: needs: [lint, test-backend, test-frontend] diff --git a/.gitignore b/.gitignore index 992d701..d0c43b2 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,13 @@ data/tiles/ # ── GSD baseline (auto-generated) ── vendor/ + +# Flutter +**/.dart_tool/ +**/.flutter-plugins +**/.flutter-plugins-dependencies +**/.packages +**/flutter_export_environment.sh +**/Pods/ +**/.symlinks/ +mobile/ios/Runner.xcworkspace/xcshareddata/swiftpm/ diff --git a/CLAUDE.md b/CLAUDE.md index a2fc040..54cc7cf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -39,15 +39,44 @@ cargo clippy -- -D warnings Backend uses `SQLX_OFFLINE=true` for Docker builds (no live DB needed at compile time). Locally, sqlx connects to Postgres at build time for query checking. -### Frontend only +### Web app (Svelte) ```bash -cd frontend +cd web npm ci npm run dev # Vite dev server on :5173, proxies /api → localhost:3000 -npm run build # production build → frontend/dist/ +npm run build # production build → web/dist/ ``` +### Mobile app (iOS only) + +```bash +cd mobile +flutter pub get +flutter test + +# Run on iOS simulator (defaults point to docker dev stack: +# api 127.0.0.1:3000, tile server 127.0.0.1:8080) +flutter run -d ios + +# Override for non-default environments: +flutter run -d ios \ + --dart-define=BEEBEEBIKE_API_BASE_URL=http://other-host:3000 \ + --dart-define=BEEBEEBIKE_TILE_SERVER_BASE_URL=http://other-host:8080 +``` + +Platform scope: iOS only in v0.1. `ferrostar_flutter` (at `packages/ferrostar_flutter/`) is a path dependency and must be present. + +### Map style (web + mobile) + +The bicycle-planning visual style lives in [web/src/lib/bicycle-style.js](web/src/lib/bicycle-style.js) as `buildBicycleStyle`. It wraps [`@versatiles/style`](https://github.com/versatiles-org/versatiles-style)'s `colorful` style with a custom palette and adds an extra set of bike-priority layers. Both web (at runtime) and mobile (at build time) call the same function. Mobile bundles a pre-baked artifact at `mobile/assets/styles/beebeebike-style.json` whose URLs use the `{{TILE_BASE}}` placeholder, swapped at runtime for `AppConfig.tileServerBaseUrl`. After editing the shared builder, regenerate the mobile artifact: + +```bash +npm --prefix web run build:mobile-style +``` + +CI fails if the committed mobile artifact diverges from what the script produces. + ### Static data (not in repo) OSM extract and vector tiles must be downloaded before first run: @@ -97,7 +126,7 @@ Rating values are discrete: -7, -3, -1, 0 (eraser), 1, 3, 7. The paint endpoint | db | 5432 | PostGIS (spatial queries for rated areas) | | graphhopper | 8989 | Bicycle routing with custom model support | | tiles | 8080 | VersaTiles vector tile server | -| frontend (dev only) | 5173 (default) | Vite dev server with API proxy | +| web (dev only) | 5173 (default) | Vite dev server with API proxy | ### Migrations diff --git a/README.md b/README.md index 91154c6..fa1e60c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,20 @@ Then open the app at `http://localhost:5173`. Docker Compose files live at the project root and are meant to be run from there. +## Mobile app (iOS) + +Flutter client in `mobile/`. Requires the `ferrostar_flutter` plugin at `packages/ferrostar_flutter/`. + +```bash +cd mobile +flutter pub get +flutter run -d ios \ + --dart-define=BEEBEEBIKE_API_BASE_URL=http://127.0.0.1:3000 \ + --dart-define=BEEBEEBIKE_TILE_STYLE_URL=http://127.0.0.1:8080/tiles/assets/styles/colorful/style.json +``` + +> Android support is planned for a future release. + ## Contributing Contributions are welcome. Please open an issue first so we can talk through the idea, the shape of the change, and any bike-brain edge cases before you start building. diff --git a/backend/Dockerfile b/backend/Dockerfile index 2e9a4ee..6944cbd 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,10 +1,10 @@ # syntax=docker/dockerfile:1.7 -FROM node:22-bookworm AS frontend-builder -WORKDIR /app/frontend -COPY frontend/package.json frontend/package-lock.json ./ +FROM node:22-bookworm AS web-builder +WORKDIR /app/web +COPY web/package.json web/package-lock.json ./ RUN --mount=type=cache,target=/root/.npm npm ci -COPY frontend ./ +COPY web ./ ARG VITE_FATHOM_URL RUN npm run build @@ -24,6 +24,6 @@ FROM debian:bookworm-slim WORKDIR /app RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* COPY --from=backend-builder /usr/local/bin/beebeebike-backend /usr/local/bin/ -COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist -ENV STATIC_DIR=/app/frontend/dist +COPY --from=web-builder /app/web/dist /app/web/dist +ENV STATIC_DIR=/app/web/dist CMD ["beebeebike-backend"] diff --git a/backend/src/config.rs b/backend/src/config.rs index aa90818..72253ae 100644 --- a/backend/src/config.rs +++ b/backend/src/config.rs @@ -22,7 +22,7 @@ impl Config { photon_url: env::var("PHOTON_URL") .unwrap_or_else(|_| "https://photon.komoot.io".into()), listen_addr: env::var("LISTEN_ADDR").unwrap_or_else(|_| "0.0.0.0:3000".into()), - static_dir: env::var("STATIC_DIR").unwrap_or_else(|_| "../frontend/dist".into()), + static_dir: env::var("STATIC_DIR").unwrap_or_else(|_| "../web/dist".into()), rating_weight: env::var("RATING_WEIGHT") .ok() .and_then(|v| v.parse().ok()) diff --git a/compose.dev.yml b/compose.dev.yml index 6680767..504cfb2 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -1,7 +1,7 @@ services: - frontend: + web: image: node:22-bookworm - working_dir: /workspace/frontend + working_dir: /workspace/web command: ["sh", "-c", "npm ci && npm run dev -- --host 0.0.0.0"] environment: VITE_API_PROXY_TARGET: http://backend:3000 @@ -11,9 +11,9 @@ services: - "${VITE_DEV_PORT:-5173}:${VITE_DEV_PORT:-5173}" volumes: - .:/workspace - - frontend_node_modules:/workspace/frontend/node_modules + - web_node_modules:/workspace/web/node_modules depends_on: - backend volumes: - frontend_node_modules: + web_node_modules: diff --git a/compose.prod.yml b/compose.prod.yml index 5e15ae7..4222945 100644 --- a/compose.prod.yml +++ b/compose.prod.yml @@ -51,7 +51,7 @@ services: GRAPHHOPPER_URL: http://graphhopper:8989 PHOTON_URL: https://photon.komoot.io LISTEN_ADDR: 0.0.0.0:3000 - STATIC_DIR: /app/frontend/dist + STATIC_DIR: /app/web/dist depends_on: - db - graphhopper diff --git a/compose.yml b/compose.yml index cdb67db..6624325 100644 --- a/compose.yml +++ b/compose.yml @@ -53,7 +53,7 @@ services: GRAPHHOPPER_URL: http://graphhopper:8989 PHOTON_URL: https://photon.komoot.io LISTEN_ADDR: 0.0.0.0:3000 - STATIC_DIR: /app/frontend/dist + STATIC_DIR: /app/web/dist depends_on: - db - graphhopper diff --git a/docs/superpowers/plans/2026-04-16-beebeebike-mobile-app.md b/docs/superpowers/plans/2026-04-16-beebeebike-mobile-app.md index 607f8c8..b2f884e 100644 --- a/docs/superpowers/plans/2026-04-16-beebeebike-mobile-app.md +++ b/docs/superpowers/plans/2026-04-16-beebeebike-mobile-app.md @@ -2,7 +2,7 @@ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. -**Goal:** Build the Flutter mobile client in `mobile/` that reproduces BeeBeeBike's routing and overlay experience on iOS/Android, then adds turn-by-turn navigation by consuming the new backend `/api/navigate` endpoint and the standalone `ferrostar_flutter` plugin from Plan A. +**Goal:** Build the Flutter mobile client in `mobile/` that reproduces BeeBeeBike's routing and overlay experience on iOS (Android support follows later), then adds turn-by-turn navigation by consuming the backend `/api/navigate` endpoint (Plan B ✅) and the `ferrostar_flutter` plugin (Plan A ✅). **Architecture:** `mobile/` is a thin Flutter client. Dio talks to the existing backend for auth, geocoding, preview routing, ratings overlay, home location, and navigation-route JSON. Riverpod owns session, route preview, navigation, and settings state. `maplibre_gl` renders the map; a separate `NavigationService` orchestrates `ferrostar_flutter`, `geolocator`, `flutter_compass`, and `flutter_tts` so UI widgets stay declarative. @@ -10,11 +10,39 @@ **Parent spec:** `docs/superpowers/specs/2026-04-16-mobile-navigation-app-design.md` -**Dependencies:** Plan A must provide `packages/ferrostar_flutter/`. Plan B must provide `POST /api/navigate`. This plan assumes both exist by the time Task 6 starts. +**Platform scope:** iOS only. `ferrostar_flutter` v0.1.0 ships iOS bindings only. Android support will follow when the plugin gains Android bindings. Flutter project is created with `--platforms=ios` for now; adding Android later is a one-line `flutter create --platforms=android` re-run. + +**Dependencies:** +- ✅ **Plan A complete** — `packages/ferrostar_flutter/` v0.1.0 merged (PR #29, commit `63f7084`). iOS only. +- ✅ **Plan B complete** — `POST /api/navigate` merged (PR #26, commit `999e31b`). + +Both dependencies are live on `main`. Task 6 can proceed immediately. + +--- + +## Repo Layout After This Plan + +This plan introduces `mobile/` and renames `frontend/` → `web/` to reflect the multi-client nature of the project. Android is stubbed with a placeholder directory so the layout is ready when the plugin gains Android support. + +``` +web/ # Svelte web app (renamed from frontend/) +mobile/ # Flutter mobile app +├── ios/ # iOS platform code (active — v0.1) +├── android/ # Android platform code (stub — future) +├── lib/ # Dart source (shared across platforms) +├── test/ +├── pubspec.yaml +└── README.md +packages/ +└── ferrostar_flutter/ # iOS-only turn-by-turn plugin (Plan A) +backend/ # Rust/Axum API (unchanged) +``` + +The `frontend/` → `web/` rename happens in **Task 9** (Phase 7) so it does not block mobile development; do it last to avoid merge conflicts with any ongoing web work. --- -## File Structure +## Flutter App File Structure ``` mobile/ @@ -93,10 +121,12 @@ cd /Users/pv/code/ortschaft flutter create \ --org=land._001 \ --project-name=beebeebike \ - --platforms=ios,android \ + --platforms=ios \ mobile ``` +iOS only for now. To add Android later: `flutter create --platforms=android mobile` from the repo root. + - [ ] **Step 2: Add Flutter-specific ignore rules** Append these lines to the root `.gitignore`: @@ -278,13 +308,21 @@ Create `mobile/README.md`: ````markdown # BeeBeeBike mobile -Run locally: +> **Platform support:** iOS only (v0.1). Android support will be added once `ferrostar_flutter` gains Android bindings. + +Run locally on iOS simulator: ```bash flutter pub get -flutter run \ - --dart-define=BEEBEEBIKE_API_BASE_URL=http://10.0.2.2:3000 \ - --dart-define=BEEBEEBIKE_TILE_STYLE_URL=http://10.0.2.2:8080/tiles/assets/styles/colorful/style.json +flutter run -d ios \ + --dart-define=BEEBEEBIKE_API_BASE_URL=http://127.0.0.1:3000 \ + --dart-define=BEEBEEBIKE_TILE_STYLE_URL=http://127.0.0.1:8080/tiles/assets/styles/colorful/style.json +``` + +Run tests: + +```bash +flutter test ``` ```` @@ -1673,12 +1711,191 @@ Expected: clean if no fixes were needed. If you had to patch issues during the s --- +## Phase 7: Repo Housekeeping + +### Task 9: Rename `frontend/` → `web/` + +**Files:** +- Rename: `frontend/` → `web/` +- Modify: `compose.yml`, `compose.dev.yml`, `compose.prod.yml` (volume/context paths) +- Modify: `.github/workflows/ci.yml` (working-directory references) +- Modify: `CLAUDE.md` (build instructions) +- Modify: root `README.md` + +Do this after mobile work is merged and no open PRs touch `frontend/`. + +- [ ] **Step 1: Rename the directory** + +```bash +cd /Users/pv/code/ortschaft +git mv frontend web +``` + +- [ ] **Step 2: Update compose files** + +Search for `frontend` in all compose files and replace with `web`: + +```bash +sed -i '' 's|./frontend|./web|g' compose.yml compose.dev.yml compose.prod.yml +``` + +- [ ] **Step 3: Update CI workflow** + +In `.github/workflows/ci.yml`, update any `working-directory: frontend` → `working-directory: web` and path filters from `frontend/**` → `web/**`. + +- [ ] **Step 4: Verify the stack still builds** + +```bash +docker compose -f compose.yml -f compose.dev.yml build frontend +``` + +- [ ] **Step 5: Commit** + +```bash +git add -A +git commit -m "chore: rename frontend/ to web/" +``` + +--- + +### Task 10: Add GHA CI workflow for the mobile app + +**Files:** +- Create: `.github/workflows/ci-mobile.yml` + +Path-gated so it only runs when `mobile/` or `packages/ferrostar_flutter/` change. iOS-only for now. + +- [ ] **Step 1: Create the workflow** + +Create `.github/workflows/ci-mobile.yml`: + +```yaml +name: ci-mobile + +on: + push: + paths: + - 'mobile/**' + - 'packages/ferrostar_flutter/**' + pull_request: + paths: + - 'mobile/**' + - 'packages/ferrostar_flutter/**' + +jobs: + test-mobile: + name: Flutter tests (iOS) + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.19.x' + channel: 'stable' + cache: true + + - name: Install dependencies (plugin) + working-directory: packages/ferrostar_flutter + run: flutter pub get + + - name: Install dependencies (app) + working-directory: mobile + run: flutter pub get + + - name: Analyze (plugin) + working-directory: packages/ferrostar_flutter + run: flutter analyze + + - name: Analyze (app) + working-directory: mobile + run: flutter analyze + + - name: Test (plugin) + working-directory: packages/ferrostar_flutter + run: flutter test + + - name: Test (app) + working-directory: mobile + run: flutter test +``` + +- [ ] **Step 2: Commit** + +```bash +git add .github/workflows/ci-mobile.yml +git commit -m "ci: add path-gated Flutter test workflow for mobile and plugin" +``` + +--- + +### Task 11: Update root README and CLAUDE.md + +**Files:** +- Modify: `README.md` +- Modify: `CLAUDE.md` + +- [ ] **Step 1: Add mobile section to root README** + +Add a "Mobile app" section after the existing web/backend sections: + +```markdown +## Mobile app (iOS) + +Flutter client in `mobile/`. Requires the `ferrostar_flutter` plugin at `packages/ferrostar_flutter/`. + +```bash +cd mobile +flutter pub get +flutter run -d ios \ + --dart-define=BEEBEEBIKE_API_BASE_URL=http://127.0.0.1:3000 \ + --dart-define=BEEBEEBIKE_TILE_STYLE_URL=http://127.0.0.1:8080/tiles/assets/styles/colorful/style.json +``` + +> Android support is planned for a future release. +``` + +- [ ] **Step 2: Update CLAUDE.md build instructions** + +Add a new section to `CLAUDE.md` under `## Build & Run`: + +```markdown +### Mobile app (iOS only) + +```bash +cd mobile +flutter pub get +flutter test + +# Run on iOS simulator +flutter run -d ios \ + --dart-define=BEEBEEBIKE_API_BASE_URL=http://127.0.0.1:3000 \ + --dart-define=BEEBEEBIKE_TILE_STYLE_URL=http://127.0.0.1:8080/tiles/assets/styles/colorful/style.json +``` + +Platform scope: iOS only in v0.1. `ferrostar_flutter` (at `packages/ferrostar_flutter/`) is a path dependency and must be present. +``` + +Also update the `### Frontend only` section header to `### Web app (frontend)` or update it to reference `web/` after the Task 9 rename. + +- [ ] **Step 3: Commit** + +```bash +git add README.md CLAUDE.md +git commit -m "docs: add mobile app build instructions and iOS platform note" +``` + +--- + ## Self-Review Notes - **Spec coverage:** This plan covers auth bootstrap, search, route preview via `POST /api/route`, settings/home flows, read-only ratings overlay, navigation entry, turn banner UI, rerouting orchestration, mute/close affordances, and the thin-client architecture described in the spec. - **Explicit omissions preserved:** The plan does not add painting, background navigation, offline downloads, or preference sliders, matching the spec's out-of-scope list. - **Dependency boundary is clear:** The mobile app does not parse GraphHopper navigation JSON itself. It treats `/api/navigate` as an opaque Mapbox Directions payload and hands it to `ferrostar_flutter`, exactly as Plan A and Plan B require. +- **iOS only:** `ferrostar_flutter` v0.1.0 is iOS-only. All navigation features in Tasks 6–7 are iOS-only. The app scaffolds with `--platforms=ios`; Android will be added via `flutter create --platforms=android` when the plugin supports it. +- **Plan A and Plan B are done:** Both dependencies landed on `main` before this plan was executed. No blocking work remains. ## After This Plan -If Tasks 1-8 are complete, the repo has all three deliverables from the spec: plugin, backend navigation endpoint, and the mobile app shell that consumes both. The next decision is whether to finish by merging all three plans sequentially or to execute Plan B in parallel while Plan A is still stabilizing. +Tasks 1–8 deliver the iOS mobile app shell consuming both completed dependencies. Phase 7 (Tasks 9–11) finalises repo layout (`frontend/` → `web/`), CI coverage for the Flutter stack, and updated documentation. Android support is the logical next milestone — it unblocks once `ferrostar_flutter` gains Android bindings. diff --git a/docs/superpowers/plans/2026-04-17-beebeebike-mobile-ride-ready.md b/docs/superpowers/plans/2026-04-17-beebeebike-mobile-ride-ready.md new file mode 100644 index 0000000..e517602 --- /dev/null +++ b/docs/superpowers/plans/2026-04-17-beebeebike-mobile-ride-ready.md @@ -0,0 +1,1062 @@ +# BeeBeeBike Mobile Ride-Ready Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Wire real GPS, TTS, and live navigation state into the iOS app so it can guide a real bike ride. + +**Architecture:** Three stubs in `navigation_provider.dart` are replaced with real platform integrations (`geolocator`, `flutter_tts`). `NavigationService` gains a `stateStream` getter (backed by a broadcast `StreamController`) so the UI can watch live `NavigationState`. `NavigationScreen` becomes a `ConsumerStatefulWidget` that starts/stops the service in `initState`/`dispose` and renders turn instructions from real state. + +**Tech Stack:** Flutter/Dart, Riverpod 2.x, `geolocator ^13.0.1`, `flutter_tts ^4.0.2`, `ferrostar_flutter` (path dep), `integration_test` (sdk: flutter) + +--- + +## File Map + +| Path | Action | Responsibility | +|------|--------|----------------| +| `mobile/lib/navigation/location_converter.dart` | Create | Pure function `positionToUserLocation(Position) → UserLocation` | +| `mobile/test/navigation/location_converter_test.dart` | Create | Unit tests for the conversion | +| `mobile/lib/navigation/navigation_service.dart` | Modify | Add `_stateController`, `_stateSub`, `stateStream` getter | +| `mobile/test/navigation/navigation_service_test.dart` | Modify | Add test verifying stateStream forwards controller state | +| `mobile/lib/providers/navigation_provider.dart` | Modify | Wire GPS stream, TTS speak, add `flutterTtsProvider` + `navigationStateProvider` | +| `mobile/test/providers/navigation_provider_test.dart` | Create | Unit test: speakInstruction calls FlutterTts.speak | +| `mobile/lib/screens/navigation_screen.dart` | Rewrite | ConsumerStatefulWidget watching live NavigationState | +| `mobile/lib/widgets/turn_banner.dart` | Modify | Add optional `icon` parameter | +| `mobile/test/screens/navigation_screen_test.dart` | Create | Widget test: live state renders correctly | +| `mobile/ios/Runner/Info.plist` | Modify | Add `NSLocationWhenInUseUsageDescription` | +| `mobile/pubspec.yaml` | Modify | Add `integration_test` to dev_dependencies | +| `mobile/integration_test/navigation_smoke_test.dart` | Create | Boot app, assert Scaffold renders | +| `.github/workflows/ci-mobile.yml` | Modify | Add `test-mobile-ios` simulator job | + +--- + +## Task 1: GPS stream wiring + +**Files:** +- Create: `mobile/lib/navigation/location_converter.dart` +- Create: `mobile/test/navigation/location_converter_test.dart` +- Modify: `mobile/lib/providers/navigation_provider.dart` +- Modify: `mobile/ios/Runner/Info.plist` + +- [ ] **Step 1: Write failing test** + +Create `mobile/test/navigation/location_converter_test.dart`: + +```dart +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:geolocator/geolocator.dart'; + +import 'package:beebeebike/navigation/location_converter.dart'; + +void main() { + test('maps Position fields to UserLocation', () { + final pos = Position( + latitude: 52.52, + longitude: 13.405, + accuracy: 4.5, + heading: 270.0, + speed: 3.2, + timestamp: DateTime.fromMillisecondsSinceEpoch(1000), + altitude: 0, + altitudeAccuracy: 0, + headingAccuracy: 0, + speedAccuracy: 0, + ); + + final result = positionToUserLocation(pos); + + expect(result.lat, 52.52); + expect(result.lng, 13.405); + expect(result.horizontalAccuracyM, 4.5); + expect(result.courseDeg, 270.0); + expect(result.speedMps, 3.2); + expect(result.timestampMs, 1000); + }); + + test('sets courseDeg to null when heading is zero', () { + final pos = Position( + latitude: 52.52, + longitude: 13.405, + accuracy: 5, + heading: 0.0, + speed: 0, + timestamp: DateTime.fromMillisecondsSinceEpoch(0), + altitude: 0, + altitudeAccuracy: 0, + headingAccuracy: 0, + speedAccuracy: 0, + ); + + final result = positionToUserLocation(pos); + + expect(result.courseDeg, isNull); + }); +} +``` + +- [ ] **Step 2: Run test — expect FAIL** + +```bash +cd mobile && flutter test test/navigation/location_converter_test.dart +``` + +Expected: FAIL — `Target of URI doesn't exist: 'package:beebeebike/navigation/location_converter.dart'` + +- [ ] **Step 3: Create `location_converter.dart`** + +```dart +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:geolocator/geolocator.dart'; + +UserLocation positionToUserLocation(Position p) => UserLocation( + lat: p.latitude, + lng: p.longitude, + horizontalAccuracyM: p.accuracy, + courseDeg: p.heading > 0 ? p.heading : null, + speedMps: p.speed, + timestampMs: p.timestamp.millisecondsSinceEpoch, + ); +``` + +- [ ] **Step 4: Run test — expect PASS** + +```bash +cd mobile && flutter test test/navigation/location_converter_test.dart +``` + +Expected: All tests pass. + +- [ ] **Step 5: Wire GPS into provider** + +Replace the stub in `mobile/lib/providers/navigation_provider.dart`: + +```dart +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:geolocator/geolocator.dart'; + +import '../api/client.dart'; +import '../api/routing_api.dart'; +import '../navigation/location_converter.dart'; +import '../navigation/navigation_service.dart'; + +final navigationServiceProvider = Provider((ref) { + final dio = ref.watch(dioProvider); + final routingApi = RoutingApi(dio); + return NavigationService( + createController: (osrmJson, waypoints) => + FerrostarFlutter.instance.createController( + osrmJson: osrmJson, + waypoints: waypoints, + ), + loadNavigationRoute: ({required origin, required destination}) => + routingApi.computeNavigationRoute(origin, destination), + locationStream: Geolocator.getPositionStream().map(positionToUserLocation), + speakInstruction: (_) async {}, + ); +}); +``` + +- [ ] **Step 6: Add iOS location permission to `mobile/ios/Runner/Info.plist`** + +Add this key/string pair inside the root ``, after `CADisableMinimumFrameDurationOnPhone`: + +```xml + NSLocationWhenInUseUsageDescription + BeeBeeBike needs your location to navigate your bike route. +``` + +- [ ] **Step 7: Run full unit test suite — expect PASS** + +```bash +cd mobile && flutter test test/ +``` + +Expected: All tests pass (existing navigation_service_test.dart etc). + +- [ ] **Step 8: Commit** + +```bash +git add mobile/lib/navigation/location_converter.dart \ + mobile/test/navigation/location_converter_test.dart \ + mobile/lib/providers/navigation_provider.dart \ + mobile/ios/Runner/Info.plist +git commit -m "feat(mobile): wire real geolocator stream into NavigationService" +``` + +--- + +## Task 2: TTS wiring + +**Files:** +- Create: `mobile/test/providers/navigation_provider_test.dart` +- Modify: `mobile/lib/providers/navigation_provider.dart` + +- [ ] **Step 1: Write failing test** + +Create `mobile/test/providers/navigation_provider_test.dart`: + +```dart +import 'package:beebeebike/app.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/providers/navigation_provider.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_tts/flutter_tts.dart'; +import 'package:mocktail/mocktail.dart'; + +class MockFlutterTts extends Mock implements FlutterTts {} + +void main() { + test('speakInstruction calls FlutterTts.speak with the given text', () async { + final mockTts = MockFlutterTts(); + when(() => mockTts.speak(any())).thenAnswer((_) async => 1); + + final container = ProviderContainer( + overrides: [ + appConfigProvider.overrideWithValue( + const AppConfig( + apiBaseUrl: 'http://localhost', + tileStyleUrl: 'http://localhost/tiles', + ), + ), + flutterTtsProvider.overrideWithValue(mockTts), + ], + ); + addTearDown(container.dispose); + + final service = container.read(navigationServiceProvider); + await service.speakInstruction('Turn left'); + + verify(() => mockTts.speak('Turn left')).called(1); + }); +} +``` + +- [ ] **Step 2: Run test — expect FAIL** + +```bash +cd mobile && flutter test test/providers/navigation_provider_test.dart +``` + +Expected: FAIL — `flutterTtsProvider` is not defined. + +- [ ] **Step 3: Add `flutterTtsProvider` and wire TTS into provider** + +Replace `mobile/lib/providers/navigation_provider.dart` with: + +```dart +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_tts/flutter_tts.dart'; +import 'package:geolocator/geolocator.dart'; + +import '../api/client.dart'; +import '../api/routing_api.dart'; +import '../navigation/location_converter.dart'; +import '../navigation/navigation_service.dart'; + +final flutterTtsProvider = Provider((ref) => FlutterTts()); + +final navigationServiceProvider = Provider((ref) { + final dio = ref.watch(dioProvider); + final routingApi = RoutingApi(dio); + final tts = ref.watch(flutterTtsProvider); + return NavigationService( + createController: (osrmJson, waypoints) => + FerrostarFlutter.instance.createController( + osrmJson: osrmJson, + waypoints: waypoints, + ), + loadNavigationRoute: ({required origin, required destination}) => + routingApi.computeNavigationRoute(origin, destination), + locationStream: Geolocator.getPositionStream().map(positionToUserLocation), + speakInstruction: (text) async { await tts.speak(text); }, + ); +}); +``` + +- [ ] **Step 4: Run test — expect PASS** + +```bash +cd mobile && flutter test test/providers/navigation_provider_test.dart +``` + +Expected: All tests pass. + +- [ ] **Step 5: Run full suite — expect PASS** + +```bash +cd mobile && flutter test test/ +``` + +Expected: All tests pass. + +- [ ] **Step 6: Commit** + +```bash +git add mobile/lib/providers/navigation_provider.dart \ + mobile/test/providers/navigation_provider_test.dart +git commit -m "feat(mobile): wire flutter_tts for spoken navigation instructions" +``` + +--- + +## Task 3: NavigationService state stream + +**Files:** +- Modify: `mobile/lib/navigation/navigation_service.dart` +- Modify: `mobile/test/navigation/navigation_service_test.dart` +- Modify: `mobile/lib/providers/navigation_provider.dart` + +- [ ] **Step 1: Write failing test** + +In `mobile/test/navigation/navigation_service_test.dart`, add `_stateCtrl` and `emitState` to the existing `FakeFerrostarFlutterPlatform`, and add a new test. The full file becomes: + +```dart +import 'dart:async'; + +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:ferrostar_flutter/src/ferrostar_flutter_platform.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:beebeebike/navigation/navigation_service.dart'; + +class FakeFerrostarFlutterPlatform extends FerrostarFlutterPlatform { + final _deviationCtrl = StreamController.broadcast(); + final _stateCtrl = StreamController.broadcast(); + int replaceRouteCalls = 0; + + void emitDeviation(RouteDeviation d) => _deviationCtrl.add(d); + void emitState(NavigationState s) => _stateCtrl.add(s); + + @override + Future createController({ + required Map osrmJson, + required List waypoints, + required NavigationConfig config, + }) async => + 'fake-id'; + + @override + Future updateLocation({ + required String controllerId, + required UserLocation location, + }) async {} + + @override + Future replaceRoute({ + required String controllerId, + required Map osrmJson, + }) async { + replaceRouteCalls++; + } + + @override + Future dispose({required String controllerId}) async {} + + @override + Stream stateStream({required String controllerId}) => + _stateCtrl.stream; + + @override + Stream spokenInstructionStream( + {required String controllerId}) => + const Stream.empty(); + + @override + Stream deviationStream({required String controllerId}) => + _deviationCtrl.stream; +} + +void main() { + test('reroutes by calling replaceRoute when deviation stream emits', () async { + final fakePlatform = FakeFerrostarFlutterPlatform(); + final fakeController = FerrostarController('test', fakePlatform); + + final service = NavigationService( + createController: (osrmJson, waypoints) async => fakeController, + loadNavigationRoute: ({required origin, required destination}) async => { + 'routes': [ + {'distance': 1234} + ] + }, + locationStream: const Stream.empty(), + speakInstruction: (_) async {}, + ); + addTearDown(() => service.dispose()); + + await service.start( + origin: const WaypointInput(lat: 52.52, lng: 13.405), + destination: const WaypointInput(lat: 52.51, lng: 13.45), + ); + + fakePlatform.emitDeviation( + RouteDeviation( + deviationM: 87, + durationOffRouteMs: 12000, + userLocation: const UserLocation( + lat: 52.521, + lng: 13.406, + horizontalAccuracyM: 5, + timestampMs: 1, + ), + ), + ); + + await pumpEventQueue(); + expect(fakePlatform.replaceRouteCalls, 1); + }); + + test('stateStream forwards NavigationState emitted by the controller', () async { + final fakePlatform = FakeFerrostarFlutterPlatform(); + final fakeController = FerrostarController('test', fakePlatform); + + final service = NavigationService( + createController: (osrmJson, waypoints) async => fakeController, + loadNavigationRoute: ({required origin, required destination}) async => { + 'routes': [ + {'distance': 1234} + ] + }, + locationStream: const Stream.empty(), + speakInstruction: (_) async {}, + ); + addTearDown(() => service.dispose()); + + final received = []; + service.stateStream.listen(received.add); + + await service.start( + origin: const WaypointInput(lat: 52.52, lng: 13.405), + destination: const WaypointInput(lat: 52.51, lng: 13.45), + ); + + const state = NavigationState(status: TripStatus.navigating, isOffRoute: false); + fakePlatform.emitState(state); + await pumpEventQueue(); + + expect(received, [state]); + }); +} +``` + +- [ ] **Step 2: Run test — expect FAIL** + +```bash +cd mobile && flutter test test/navigation/navigation_service_test.dart +``` + +Expected: FAIL — `The getter 'stateStream' isn't defined for the class 'NavigationService'` + +- [ ] **Step 3: Add stateStream to NavigationService** + +Replace `mobile/lib/navigation/navigation_service.dart` with: + +```dart +import 'dart:async'; + +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/foundation.dart'; + +typedef CreateController = Future Function( + Map osrmJson, + List waypoints, +); +typedef LoadNavigationRoute = Future> Function({ + required List origin, + required List destination, +}); +typedef SpeakInstruction = Future Function(String text); + +class NavigationService { + NavigationService({ + required this.createController, + required this.loadNavigationRoute, + required this.locationStream, + required this.speakInstruction, + }); + + final CreateController createController; + final LoadNavigationRoute loadNavigationRoute; + final Stream locationStream; + final SpeakInstruction speakInstruction; + + FerrostarController? _controller; + StreamSubscription? _locationSub; + StreamSubscription? _spokenSub; + StreamSubscription? _deviationSub; + StreamSubscription? _stateSub; + WaypointInput? _destination; + + final _stateController = StreamController.broadcast(); + + Stream get stateStream => _stateController.stream; + + Future start({ + required WaypointInput origin, + required WaypointInput destination, + }) async { + await dispose(); + _destination = destination; + final routeJson = await loadNavigationRoute( + origin: [origin.lng, origin.lat], + destination: [destination.lng, destination.lat], + ); + final waypoints = [origin, destination]; + _controller = await createController(routeJson, waypoints); + + _stateSub = _controller!.stateStream.listen( + _stateController.add, + onError: _stateController.addError, + ); + + _spokenSub = _controller!.spokenInstructionStream.listen( + (instruction) => speakInstruction(instruction.text), + ); + + _deviationSub = _controller!.deviationStream.listen((deviation) async { + try { + final dest = _destination; + if (dest == null) return; + final rerouteJson = await loadNavigationRoute( + origin: [deviation.userLocation.lng, deviation.userLocation.lat], + destination: [dest.lng, dest.lat], + ); + await _controller!.replaceRoute(rerouteJson); + } catch (e, st) { + debugPrint('NavigationService reroute error: $e\n$st'); + } + }); + + _locationSub = locationStream.listen( + (location) => _controller?.updateLocation(location), + ); + } + + Future dispose() async { + await _locationSub?.cancel(); + await _spokenSub?.cancel(); + await _deviationSub?.cancel(); + await _stateSub?.cancel(); + await _controller?.dispose(); + _locationSub = null; + _spokenSub = null; + _deviationSub = null; + _stateSub = null; + _controller = null; + } +} +``` + +- [ ] **Step 4: Run test — expect PASS** + +```bash +cd mobile && flutter test test/navigation/navigation_service_test.dart +``` + +Expected: Both tests pass. + +- [ ] **Step 5: Add navigationStateProvider to navigation_provider.dart** + +Append to `mobile/lib/providers/navigation_provider.dart` (add after `navigationServiceProvider`): + +```dart +final navigationStateProvider = StreamProvider((ref) { + return ref.watch(navigationServiceProvider).stateStream; +}); +``` + +- [ ] **Step 6: Run full test suite — expect PASS** + +```bash +cd mobile && flutter test test/ +``` + +Expected: All tests pass. + +- [ ] **Step 7: Commit** + +```bash +git add mobile/lib/navigation/navigation_service.dart \ + mobile/test/navigation/navigation_service_test.dart \ + mobile/lib/providers/navigation_provider.dart +git commit -m "feat(mobile): expose NavigationService.stateStream for live nav state" +``` + +--- + +## Task 4: Live NavigationScreen + +**Files:** +- Create: `mobile/test/screens/navigation_screen_test.dart` +- Modify: `mobile/lib/widgets/turn_banner.dart` +- Rewrite: `mobile/lib/screens/navigation_screen.dart` + +- [ ] **Step 1: Write failing test** + +Create `mobile/test/screens/navigation_screen_test.dart`: + +```dart +import 'package:beebeebike/navigation/navigation_service.dart'; +import 'package:beebeebike/providers/navigation_provider.dart'; +import 'package:beebeebike/screens/navigation_screen.dart'; +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows live instruction and distance from NavigationState', + (tester) async { + const fakeState = NavigationState( + status: TripStatus.navigating, + isOffRoute: false, + currentVisual: VisualInstruction( + primaryText: 'Turn left onto Test Street', + maneuverType: 'turn', + maneuverModifier: 'left', + triggerDistanceM: 150, + ), + progress: TripProgress( + distanceToNextManeuverM: 150, + distanceRemainingM: 3200, + durationRemainingMs: 720000, + ), + ); + + final fakeService = NavigationService( + createController: (_, __) => throw UnimplementedError(), + loadNavigationRoute: ({required origin, required destination}) => + throw UnimplementedError(), + locationStream: const Stream.empty(), + speakInstruction: (_) async {}, + ); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + navigationStateProvider + .overrideWith((ref) => Stream.value(fakeState)), + navigationServiceProvider.overrideWithValue(fakeService), + ], + child: const MaterialApp(home: NavigationScreen()), + ), + ); + + await tester.pumpAndSettle(); + + expect(find.text('Turn left onto Test Street'), findsOneWidget); + expect(find.text('150 m'), findsOneWidget); + }); +} +``` + +- [ ] **Step 2: Run test — expect FAIL** + +```bash +cd mobile && flutter test test/screens/navigation_screen_test.dart +``` + +Expected: FAIL — finds hardcoded 'Turn left onto Kastanienallee' but not 'Turn left onto Test Street'. + +- [ ] **Step 3: Add `icon` parameter to TurnBanner** + +Replace `mobile/lib/widgets/turn_banner.dart`: + +```dart +import 'package:flutter/material.dart'; + +class TurnBanner extends StatelessWidget { + const TurnBanner({ + super.key, + required this.primaryText, + required this.distanceText, + this.icon = Icons.straight, + }); + + final String primaryText; + final String distanceText; + final IconData icon; + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.all(16), + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: const Color(0xFF2F8F56), + borderRadius: BorderRadius.circular(20), + ), + child: Row( + children: [ + Icon(icon, color: Colors.white), + const SizedBox(width: 12), + Expanded( + child: Text( + primaryText, + style: const TextStyle( + color: Colors.white, fontWeight: FontWeight.w700), + ), + ), + Text(distanceText, style: const TextStyle(color: Colors.white)), + ], + ), + ); + } +} +``` + +- [ ] **Step 4: Rewrite NavigationScreen** + +Replace `mobile/lib/screens/navigation_screen.dart`: + +```dart +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../providers/navigation_provider.dart'; +import '../providers/route_provider.dart'; +import '../widgets/turn_banner.dart'; + +class NavigationScreen extends ConsumerStatefulWidget { + const NavigationScreen({super.key}); + + @override + ConsumerState createState() => _NavigationScreenState(); +} + +class _NavigationScreenState extends ConsumerState { + @override + void initState() { + super.initState(); + _startNavigation(); + } + + @override + void dispose() { + ref.read(navigationServiceProvider).dispose(); + super.dispose(); + } + + Future _startNavigation() async { + final routeState = ref.read(routeControllerProvider); + final origin = routeState.origin; + final destination = routeState.destination; + if (origin == null || destination == null) return; + + try { + await ref.read(navigationServiceProvider).start( + origin: WaypointInput(lat: origin.lat, lng: origin.lng), + destination: + WaypointInput(lat: destination.lat, lng: destination.lng), + ); + } catch (e, st) { + debugPrint('NavigationScreen: failed to start navigation: $e\n$st'); + } + } + + @override + Widget build(BuildContext context) { + final navState = ref.watch(navigationStateProvider); + + return Scaffold( + body: Stack( + children: [ + Container(color: const Color(0xFFCFE3D3)), + Align( + alignment: Alignment.topCenter, + child: SafeArea( + child: navState.when( + loading: () => const TurnBanner( + primaryText: 'Starting navigation...', + distanceText: '', + ), + error: (e, _) => const TurnBanner( + primaryText: 'Navigation error', + distanceText: '', + icon: Icons.error_outline, + ), + data: (state) => TurnBanner( + primaryText: state.currentVisual?.primaryText ?? 'On route', + distanceText: state.progress != null + ? _formatDistance( + state.progress!.distanceToNextManeuverM) + : '', + icon: state.currentVisual != null + ? _iconForManeuver( + state.currentVisual!.maneuverType, + state.currentVisual!.maneuverModifier, + ) + : Icons.straight, + ), + ), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: SafeArea( + top: false, + child: Container( + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.vertical(top: Radius.circular(24)), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + navState.when( + loading: () => const Text('Loading...'), + error: (_, __) => const Text('—'), + data: (state) { + final p = state.progress; + if (p == null) return const Text('—'); + return Text(_formatEta(p.durationRemainingMs)); + }, + ), + Row( + children: [ + const Icon(Icons.volume_up_outlined), + const SizedBox(width: 16), + GestureDetector( + onTap: () { + ref.read(navigationServiceProvider).dispose(); + Navigator.of(context).pop(); + }, + child: const Icon(Icons.close), + ), + ], + ), + ], + ), + ), + ), + ), + ], + ), + ); + } +} + +IconData _iconForManeuver(String type, String? modifier) { + if (type == 'turn') { + if (modifier == 'left') return Icons.turn_left; + if (modifier == 'right') return Icons.turn_right; + if (modifier == 'sharp left') return Icons.turn_sharp_left; + if (modifier == 'sharp right') return Icons.turn_sharp_right; + if (modifier == 'slight left') return Icons.turn_slight_left; + if (modifier == 'slight right') return Icons.turn_slight_right; + } + if (type == 'arrive') return Icons.flag; + return Icons.straight; +} + +String _formatDistance(double meters) { + if (meters >= 1000) return '${(meters / 1000).toStringAsFixed(1)} km'; + return '${meters.round()} m'; +} + +String _formatEta(int durationRemainingMs) { + final eta = + DateTime.now().add(Duration(milliseconds: durationRemainingMs)); + final h = eta.hour.toString().padLeft(2, '0'); + final m = eta.minute.toString().padLeft(2, '0'); + final minRemaining = (durationRemainingMs / 60000).round(); + return '$h:$m arrival · $minRemaining min'; +} +``` + +- [ ] **Step 5: Run test — expect PASS** + +```bash +cd mobile && flutter test test/screens/navigation_screen_test.dart +``` + +Expected: All tests pass. + +- [ ] **Step 6: Run full suite — expect PASS** + +```bash +cd mobile && flutter test test/ +``` + +Expected: All tests pass. + +- [ ] **Step 7: Commit** + +```bash +git add mobile/lib/screens/navigation_screen.dart \ + mobile/lib/widgets/turn_banner.dart \ + mobile/test/screens/navigation_screen_test.dart +git commit -m "feat(mobile): live turn instructions and ETA in NavigationScreen" +``` + +--- + +## Task 5: iOS integration smoke test + CI job + +**Files:** +- Modify: `mobile/pubspec.yaml` +- Create: `mobile/integration_test/navigation_smoke_test.dart` +- Modify: `.github/workflows/ci-mobile.yml` + +- [ ] **Step 1: Add `integration_test` to pubspec.yaml** + +In `mobile/pubspec.yaml`, add to `dev_dependencies`: + +```yaml +dev_dependencies: + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + flutter_lints: ^5.0.0 + build_runner: ^2.4.13 + freezed: ^2.5.7 + json_serializable: ^6.9.0 + http_mock_adapter: ^0.6.1 + mocktail: ^1.0.4 +``` + +- [ ] **Step 2: Run `flutter pub get`** + +```bash +cd mobile && flutter pub get +``` + +Expected: Resolves without errors. + +- [ ] **Step 3: Create smoke test** + +Create `mobile/integration_test/navigation_smoke_test.dart`: + +```dart +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:beebeebike/main.dart' as app; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + testWidgets('app launches and renders the map screen', (tester) async { + app.main(); + await tester.pumpAndSettle(const Duration(seconds: 5)); + expect(find.byType(Scaffold), findsWidgets); + }); +} +``` + +- [ ] **Step 4: Add `test-mobile-ios` job to `ci-mobile.yml`** + +Replace `.github/workflows/ci-mobile.yml` with: + +```yaml +name: ci-mobile + +on: + push: + paths: + - 'mobile/**' + - 'packages/ferrostar_flutter/**' + pull_request: + paths: + - 'mobile/**' + - 'packages/ferrostar_flutter/**' + +jobs: + test-mobile: + name: Flutter tests (iOS) + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.19.x' + channel: 'stable' + cache: true + + - name: Install dependencies (plugin) + working-directory: packages/ferrostar_flutter + run: flutter pub get + + - name: Install dependencies (app) + working-directory: mobile + run: flutter pub get + + - name: Analyze (app) + working-directory: mobile + run: flutter analyze + + - name: Test (app) + working-directory: mobile + run: flutter test + + test-mobile-ios: + name: Flutter integration tests (iOS simulator) + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - uses: flutter-actions/setup-flutter@v3 + with: + channel: stable + + - name: Install dependencies (plugin) + working-directory: packages/ferrostar_flutter + run: flutter pub get + + - name: Install dependencies (app) + working-directory: mobile + run: flutter pub get + + - name: Boot iPhone 17 simulator + run: | + UDID=$(xcrun simctl list devices available --json \ + | python3 -c " + import json,sys + devs = json.load(sys.stdin)['devices'] + for runtime, devices in devs.items(): + for d in devices: + if 'iPhone 17' in d['name'] and d['isAvailable']: + print(d['udid']); exit() + ") + xcrun simctl boot "$UDID" + echo "SIM_UDID=$UDID" >> "$GITHUB_ENV" + + - name: Enable Flutter SPM integration + working-directory: mobile + run: flutter config --enable-swift-package-manager + + - name: Build (simulator, no codesign) + working-directory: mobile + run: flutter build ios --no-codesign --simulator + + - name: Run integration smoke test + working-directory: mobile + run: flutter test integration_test/navigation_smoke_test.dart -d "$SIM_UDID" +``` + +- [ ] **Step 5: Run unit tests one final time** + +```bash +cd mobile && flutter test test/ +``` + +Expected: All tests pass. + +- [ ] **Step 6: Commit** + +```bash +git add mobile/pubspec.yaml \ + mobile/integration_test/navigation_smoke_test.dart \ + .github/workflows/ci-mobile.yml +git commit -m "feat(mobile): iOS simulator smoke test + ci-mobile integration job" +``` diff --git a/docs/superpowers/plans/2026-04-18-mobile-auth-maptap-login-tests.md b/docs/superpowers/plans/2026-04-18-mobile-auth-maptap-login-tests.md new file mode 100644 index 0000000..d9970ea --- /dev/null +++ b/docs/superpowers/plans/2026-04-18-mobile-auth-maptap-login-tests.md @@ -0,0 +1,1381 @@ +# BeeBeeBike Mobile: Auth Bootstrap, Map Tap Fix, Login & Widget Tests + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Fix anonymous session bootstrap, map tap destination setting, and login screen; cover all user-facing flows with widget tests. + +**Architecture:** Auth is eagerly initialized in `BeeBeeBikeApp` so the session cookie is ready before any route API call. Map tap replaces the unreliable native `onMapClick` (broken on iOS 26) with a Flutter `GestureDetector` + `MapLibreMapController.toLatLng()`. Login screen wires into the existing `authControllerProvider.login()`. Widget tests use `InterceptorsWrapper` to mock the backend and verify each screen's behaviour without a running server. + +**Tech Stack:** Flutter 3.19+, Dart 3.3+, Riverpod 2.x, maplibre_gl ^0.20.0, Dio 5 + `InterceptorsWrapper` for mocking, `flutter_test`, `mocktail`. + +--- + +## File Map + +| Action | Path | Responsibility | +|--------|------|----------------| +| Modify | `mobile/lib/app.dart` | Eagerly watch `authControllerProvider` | +| Modify | `mobile/lib/screens/map_screen.dart` | ConsumerStatefulWidget, `onMapCreated`, GestureDetector tap | +| Create | `mobile/lib/screens/login_screen.dart` | Email/password login form | +| Modify | `mobile/lib/screens/settings_screen.dart` | Enable "Log in" tile → navigate to LoginScreen | +| Create | `mobile/test/helpers/test_helpers.dart` | Mock Dio, TestFixtures, `buildTestWidget` helper | +| Create | `mobile/test/screens/search_screen_test.dart` | Search flow widget tests | +| Create | `mobile/test/screens/map_screen_test.dart` | Route preview, error, Start button widget tests | +| Create | `mobile/test/screens/settings_login_test.dart` | Auth state display + login form tests | + +--- + +## Task 1: Eagerly Bootstrap Anonymous Session on App Startup + +**Files:** +- Modify: `mobile/lib/app.dart` + +The `authControllerProvider` is lazy by default — it only initialises when first `watch`ed. Nothing on the map screen watches it, so the session cookie is not set before route API calls. Watching it in `BeeBeeBikeApp.build()` ensures the `/api/auth/anonymous` call completes before the user can interact. + +- [ ] **Step 1: Write the failing test** + +Add to `mobile/test/app_smoke_test.dart` inside `main()`: + +```dart +testWidgets('auth provider is initialised on startup', (tester) async { + SharedPreferences.setMockInitialValues({}); + final prefs = await SharedPreferences.getInstance(); + + final dio = Dio(BaseOptions(baseUrl: 'http://localhost:3000')); + int authMeCallCount = 0; + dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + if (options.path == '/api/auth/me') { + authMeCallCount++; + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401), + )); + } else if (options.path == '/api/auth/anonymous') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: {'id': 'anon-1', 'account_type': 'anonymous', 'display_name': ''}, + )); + } else { + handler.next(options); + } + }, + )); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + appConfigProvider.overrideWithValue(const AppConfig( + apiBaseUrl: 'http://localhost:3000', + tileStyleUrl: 'http://localhost:8080/tiles/style.json', + )), + dioProvider.overrideWithValue(dio), + sharedPreferencesProvider.overrideWithValue(prefs), + ], + child: const BeeBeeBikeApp(), + ), + ); + await tester.pump(); // let async providers settle + + expect(authMeCallCount, equals(1), + reason: 'authControllerProvider must be initialised on app startup'); +}); +``` + +Also add the necessary imports at the top of `app_smoke_test.dart`: + +```dart +import 'package:beebeebike/api/client.dart'; +import 'package:dio/dio.dart'; +``` + +- [ ] **Step 2: Run the test to confirm it fails** + +```bash +cd mobile && flutter test test/app_smoke_test.dart -v +``` + +Expected: FAIL — `authMeCallCount` is 0 because `authControllerProvider` is never initialised. + +- [ ] **Step 3: Modify `app.dart` to watch auth on every build** + +Replace `BeeBeeBikeApp` with a `ConsumerWidget` that watches `authControllerProvider`: + +```dart +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import 'config/app_config.dart'; +import 'providers/auth_provider.dart'; +import 'screens/map_screen.dart'; + +final appConfigProvider = Provider((ref) => AppConfig.fromEnvironment()); + +class BeeBeeBikeApp extends ConsumerWidget { + const BeeBeeBikeApp({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + // Eagerly initialise auth so the session cookie is ready before any + // route/geocode API call. The value is intentionally ignored here. + ref.watch(authControllerProvider); + + return MaterialApp( + title: 'BeeBeeBike', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed( + seedColor: const Color(0xFF2E6F66), + brightness: Brightness.light, + ), + scaffoldBackgroundColor: const Color(0xFFF7F3EC), + useMaterial3: true, + ), + home: const MapScreen(), + ); + } +} +``` + +- [ ] **Step 4: Run the test to confirm it passes** + +```bash +cd mobile && flutter test test/app_smoke_test.dart -v +``` + +Expected: all tests PASS including the new one. + +- [ ] **Step 5: Run the full test suite to check for regressions** + +```bash +cd mobile && flutter test +``` + +Expected: All tests pass. + +- [ ] **Step 6: Commit** + +```bash +git add mobile/lib/app.dart mobile/test/app_smoke_test.dart +git commit -m "feat(mobile): eagerly bootstrap anonymous auth session on app startup" +``` + +--- + +## Task 2: Fix Map Tap — GestureDetector + MapLibreMapController.toLatLng + +**Files:** +- Modify: `mobile/lib/screens/map_screen.dart` + +The native `onMapClick` callback in `maplibre_gl` does not fire on iOS 26. Replace it with a Flutter-level `GestureDetector` that sits above the map (but below the search bar and bottom card), captures `onTapUp`, and converts the screen coordinate to a `LatLng` using `MapLibreMapController.toLatLng()`. + +`MapScreen` must become a `ConsumerStatefulWidget` to hold the controller reference. + +- [ ] **Step 1: Write the failing widget test** + +Create `mobile/test/screens/map_screen_test.dart`: + +```dart +import 'package:beebeebike/api/client.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/models/route_state.dart'; +import 'package:beebeebike/providers/auth_provider.dart'; +import 'package:beebeebike/providers/route_provider.dart'; +import 'package:beebeebike/providers/search_history_provider.dart'; +import 'package:beebeebike/screens/map_screen.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + group('MapScreen route preview', () { + testWidgets('shows CircularProgressIndicator while route is loading', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(() => _LoadingRouteController()), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); + + testWidgets('shows error card when route fails', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(() => _ErrorRouteController()), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + + expect(find.text('Could not load route'), findsOneWidget); + }); + + testWidgets('shows RouteSummary with Start button when preview is available', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(() => _PreviewRouteController()), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + + expect(find.text('Start'), findsOneWidget); + expect(find.textContaining('min'), findsOneWidget); + }); + + testWidgets('Start button navigates to NavigationScreen', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(() => _PreviewRouteController()), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + await tester.tap(find.text('Start')); + await tester.pumpAndSettle(); + + // NavigationScreen has a close (X) button + expect(find.byIcon(Icons.close), findsOneWidget); + }); + }); +} + +// Stub route controllers for testing state variants + +class _LoadingRouteController extends RouteController { + @override + RouteState build() => const RouteState(isLoading: true); +} + +class _ErrorRouteController extends RouteController { + @override + RouteState build() => const RouteState(error: 'routing failed'); +} + +class _PreviewRouteController extends RouteController { + @override + RouteState build() => RouteState( + preview: _fakePreview(), + origin: _fakeOrigin(), + destination: _fakeDest(), + ); +} +``` + +The `_fakePreview`, `_fakeOrigin`, `_fakeDest` helpers and `testProviderOverrides()` are defined in Task 4. + +- [ ] **Step 2: Run the test to confirm it fails (because `test_helpers.dart` doesn't exist yet)** + +```bash +cd mobile && flutter test test/screens/map_screen_test.dart 2>&1 | head -20 +``` + +Expected: compile error — `../helpers/test_helpers.dart` not found. + +- [ ] **Step 3: Rewrite `map_screen.dart` as `ConsumerStatefulWidget`** + +Replace the entire file: + +```dart +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:maplibre_gl/maplibre_gl.dart'; + +import '../app.dart'; +import '../models/geocode_result.dart'; +import '../models/location.dart'; +import '../providers/route_provider.dart'; +import '../screens/navigation_screen.dart'; +import '../screens/search_screen.dart'; +import '../screens/settings_screen.dart'; +import '../widgets/route_summary.dart'; +import '../widgets/search_bar.dart'; + +class MapScreen extends ConsumerStatefulWidget { + const MapScreen({super.key}); + + @override + ConsumerState createState() => _MapScreenState(); +} + +class _MapScreenState extends ConsumerState { + MapLibreMapController? _mapController; + + @override + Widget build(BuildContext context) { + final routeState = ref.watch(routeControllerProvider); + final preview = routeState.preview; + + return Scaffold( + body: Stack( + children: [ + MapLibreMap( + styleString: ref.watch(appConfigProvider).tileStyleUrl, + initialCameraPosition: const CameraPosition( + target: LatLng(52.5200, 13.4050), + zoom: 13, + ), + myLocationEnabled: true, + myLocationTrackingMode: MyLocationTrackingMode.none, + onMapCreated: (controller) { + setState(() => _mapController = controller); + }, + ), + // Transparent tap layer — sits above the map but below UI widgets. + // HitTestBehavior.translucent lets taps on the search bar and bottom + // card fall through to those widgets' own recognizers. + GestureDetector( + behavior: HitTestBehavior.translucent, + onTapUp: (details) async { + final controller = _mapController; + if (controller == null) return; + final point = Point( + details.localPosition.dx, + details.localPosition.dy, + ); + final coords = await controller.toLatLng(point); + if (!mounted) return; + ref.read(routeControllerProvider.notifier).setDestination( + Location( + id: 'geo:${coords.latitude},${coords.longitude}', + name: + '${coords.latitude.toStringAsFixed(4)}, ${coords.longitude.toStringAsFixed(4)}', + label: 'Dropped pin', + lng: coords.longitude, + lat: coords.latitude, + ), + ); + }, + child: const SizedBox.expand(), + ), + BeeBeeBikeSearchBar( + onTap: () async { + final result = await Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const SearchScreen()), + ); + if (result == null || !context.mounted) return; + + Position? pos; + try { + pos = await Geolocator.getLastKnownPosition() ?? + await Geolocator.getCurrentPosition(); + } catch (_) {} + if (!context.mounted) return; + ref.read(routeControllerProvider.notifier).setOrigin( + Location( + id: 'gps', + name: 'Current location', + label: 'Current location', + lng: pos?.longitude ?? 13.4533, + lat: pos?.latitude ?? 52.5065, + ), + ); + if (!context.mounted) return; + ref.read(routeControllerProvider.notifier).setDestination( + Location( + id: result.id, + name: result.name, + label: result.label, + lng: result.lng, + lat: result.lat, + ), + ); + }, + onAvatarTap: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const SettingsScreen()), + ); + }, + ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + FloatingActionButton( + onPressed: () {}, + child: const Icon(Icons.my_location), + ), + const SizedBox(height: 8), + Container( + width: double.infinity, + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24), + ), + child: routeState.isLoading + ? const Padding( + padding: EdgeInsets.symmetric(vertical: 8), + child: Center(child: CircularProgressIndicator()), + ) + : routeState.error != null + ? Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.error_outline, + color: Colors.red), + const SizedBox(height: 8), + Text( + 'Could not load route', + style: Theme.of(context) + .textTheme + .bodyMedium, + ), + ], + ) + : preview == null + ? const Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Center( + child: SizedBox( + width: 36, + child: Divider(thickness: 4), + ), + ), + SizedBox(height: 12), + Text('Home'), + Text('Saved places'), + ], + ) + : RouteSummary( + durationMinutes: + (preview.time / 60).round(), + distanceKm: preview.distance / 1000, + onStart: () => + Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => + const NavigationScreen(), + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} +``` + +- [ ] **Step 4: Run `flutter analyze` to confirm no errors** + +```bash +cd mobile && flutter analyze lib/screens/map_screen.dart +``` + +Expected: `No issues found!` + +- [ ] **Step 5: Commit** + +```bash +git add mobile/lib/screens/map_screen.dart +git commit -m "fix(mobile): replace onMapClick with GestureDetector+toLatLng for iOS 26 compat" +``` + +--- + +## Task 3: Login Screen + +**Files:** +- Create: `mobile/lib/screens/login_screen.dart` +- Modify: `mobile/lib/screens/settings_screen.dart` + +The settings screen shows "Log in / Coming soon (disabled)" for anonymous users. Replace this with a working `LoginScreen`. `authControllerProvider.login(email, password)` already exists. + +- [ ] **Step 1: Write the failing test** + +Create `mobile/test/screens/settings_login_test.dart`: + +```dart +import 'package:beebeebike/screens/login_screen.dart'; +import 'package:beebeebike/screens/settings_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + group('SettingsScreen', () { + testWidgets('shows Log in tile when anonymous', (tester) async { + await tester.pumpWidget(buildTestWidget(const SettingsScreen())); + await tester.pump(); + + expect(find.text('Log in'), findsOneWidget); + // Must be tappable — not disabled + final tile = tester.widget( + find.ancestor(of: find.text('Log in'), matching: find.byType(ListTile)), + ); + expect(tile.enabled, isTrue); + }); + + testWidgets('tapping Log in navigates to LoginScreen', (tester) async { + await tester.pumpWidget(buildTestWidget(const SettingsScreen())); + await tester.pump(); + await tester.tap(find.text('Log in')); + await tester.pumpAndSettle(); + + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('shows email and Log out when authenticated', (tester) async { + await tester.pumpWidget(buildTestWidget( + const SettingsScreen(), + authenticated: true, + )); + await tester.pump(); + + expect(find.text('test@example.com'), findsOneWidget); + expect(find.text('Log out'), findsOneWidget); + expect(find.text('Log in'), findsNothing); + }); + }); + + group('LoginScreen', () { + testWidgets('renders email and password fields and Log in button', (tester) async { + await tester.pumpWidget(buildTestWidget(const LoginScreen())); + await tester.pump(); + + expect(find.byKey(const Key('login_email')), findsOneWidget); + expect(find.byKey(const Key('login_password')), findsOneWidget); + expect(find.text('Log in'), findsOneWidget); + }); + + testWidgets('shows error message on invalid credentials', (tester) async { + await tester.pumpWidget(buildTestWidget( + const LoginScreen(), + loginSucceeds: false, + )); + await tester.pump(); + + await tester.enterText(find.byKey(const Key('login_email')), 'bad@example.com'); + await tester.enterText(find.byKey(const Key('login_password')), 'wrong'); + await tester.tap(find.text('Log in')); + await tester.pumpAndSettle(); + + expect(find.text('Invalid email or password'), findsOneWidget); + }); + + testWidgets('pops on successful login', (tester) async { + // Wrap in a Navigator so pop() can work + await tester.pumpWidget(buildTestWidget( + const LoginScreen(), + authenticated: false, + loginSucceeds: true, + )); + await tester.pump(); + + await tester.enterText(find.byKey(const Key('login_email')), 'test@example.com'); + await tester.enterText(find.byKey(const Key('login_password')), 'correct'); + await tester.tap(find.text('Log in')); + await tester.pumpAndSettle(); + + // After pop, LoginScreen should be gone + expect(find.byType(LoginScreen), findsNothing); + }); + }); +} +``` + +- [ ] **Step 2: Run the test to confirm it fails (compile error — LoginScreen missing)** + +```bash +cd mobile && flutter test test/screens/settings_login_test.dart 2>&1 | head -20 +``` + +Expected: compile error — `login_screen.dart` not found. + +- [ ] **Step 3: Create `login_screen.dart`** + +```dart +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../providers/auth_provider.dart'; + +class LoginScreen extends ConsumerStatefulWidget { + const LoginScreen({super.key}); + + @override + ConsumerState createState() => _LoginScreenState(); +} + +class _LoginScreenState extends ConsumerState { + final _formKey = GlobalKey(); + final _emailController = TextEditingController(); + final _passwordController = TextEditingController(); + bool _loading = false; + String? _error; + + @override + void dispose() { + _emailController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + Future _submit() async { + if (!(_formKey.currentState?.validate() ?? false)) return; + setState(() { + _loading = true; + _error = null; + }); + try { + await ref.read(authControllerProvider.notifier).login( + _emailController.text.trim(), + _passwordController.text, + ); + if (mounted) Navigator.of(context).pop(); + } catch (_) { + if (mounted) { + setState(() { + _error = 'Invalid email or password'; + _loading = false; + }); + } + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Log in')), + body: Padding( + padding: const EdgeInsets.all(24), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + TextFormField( + key: const Key('login_email'), + controller: _emailController, + keyboardType: TextInputType.emailAddress, + decoration: const InputDecoration(labelText: 'Email'), + validator: (v) => + (v == null || v.trim().isEmpty) ? 'Enter your email' : null, + ), + const SizedBox(height: 16), + TextFormField( + key: const Key('login_password'), + controller: _passwordController, + obscureText: true, + decoration: const InputDecoration(labelText: 'Password'), + validator: (v) => + (v == null || v.isEmpty) ? 'Enter your password' : null, + ), + const SizedBox(height: 8), + if (_error != null) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + _error!, + style: TextStyle( + color: Theme.of(context).colorScheme.error), + ), + ), + const SizedBox(height: 16), + FilledButton( + onPressed: _loading ? null : _submit, + child: _loading + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Text('Log in'), + ), + ], + ), + ), + ), + ); + } +} +``` + +- [ ] **Step 4: Modify `settings_screen.dart` to enable Log in and navigate to LoginScreen** + +Replace the `else` branch in `SettingsScreen.build()`: + +```dart +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../providers/auth_provider.dart'; +import '../providers/location_provider.dart'; +import 'login_screen.dart'; + +class SettingsScreen extends ConsumerWidget { + const SettingsScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final user = ref.watch(authControllerProvider).valueOrNull; + final home = ref.watch(homeLocationProvider).valueOrNull; + + return Scaffold( + appBar: AppBar(title: const Text('Settings')), + body: ListView( + children: [ + ListTile( + title: Text(user?.email ?? 'Guest'), + subtitle: Text(user?.accountType ?? 'Loading...'), + ), + if (home != null) + ListTile( + title: const Text('Home'), + subtitle: Text(home.label), + ), + if (user?.email != null) + ListTile( + title: const Text('Log out'), + onTap: () => + ref.read(authControllerProvider.notifier).logout(), + ) + else + ListTile( + title: const Text('Log in'), + onTap: () => Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const LoginScreen()), + ), + ), + ], + ), + ); + } +} +``` + +- [ ] **Step 5: Run `flutter analyze` on both files** + +```bash +cd mobile && flutter analyze lib/screens/login_screen.dart lib/screens/settings_screen.dart +``` + +Expected: `No issues found!` + +- [ ] **Step 6: Commit** + +```bash +git add mobile/lib/screens/login_screen.dart mobile/lib/screens/settings_screen.dart +git commit -m "feat(mobile): add login screen and wire settings to it" +``` + +--- + +## Task 4: Widget Test Helpers + +**Files:** +- Create: `mobile/test/helpers/test_helpers.dart` + +Shared utilities used by all widget tests in Tasks 5–7: mock Dio with `InterceptorsWrapper`, `TestFixtures` constants, and `buildTestWidget()` / `testProviderOverrides()` helpers. + +- [ ] **Step 1: Create `test/helpers/test_helpers.dart`** + +```dart +import 'package:beebeebike/api/client.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/models/location.dart'; +import 'package:beebeebike/models/route_preview.dart'; +import 'package:beebeebike/providers/search_history_provider.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +abstract class TestFixtures { + static const Map anonymousUser = { + 'id': 'anon-1', + 'account_type': 'anonymous', + 'display_name': '', + }; + + static const Map loggedInUser = { + 'id': 'user-1', + 'email': 'test@example.com', + 'display_name': 'Test User', + 'account_type': 'standard', + }; + + static const Map geocodeResponse = { + 'features': [ + { + 'geometry': { + 'coordinates': [13.4050, 52.5200] + }, + 'properties': { + 'osm_type': 'N', + 'osm_id': '42', + 'name': 'Alexanderplatz', + 'district': 'Mitte', + 'osm_value': 'station', + }, + }, + ], + }; + + static const Map routePreviewJson = { + 'geometry': { + 'type': 'LineString', + 'coordinates': [ + [13.4050, 52.5200], + [13.4533, 52.5065], + ], + }, + 'distance': 5000.0, + 'time': 1200.0, + }; +} + +RoutePreview fakePreview() => RoutePreview.fromJson( + Map.from(TestFixtures.routePreviewJson)); + +Location fakeOrigin() => const Location( + id: 'gps', name: 'Current location', label: 'Current location', + lng: 13.4533, lat: 52.5065); + +Location fakeDest() => const Location( + id: 'N:42', name: 'Alexanderplatz', label: 'Mitte · station', + lng: 13.4050, lat: 52.5200); + +/// Builds a mock [Dio] instance that handles common backend endpoints. +/// +/// [authenticated]: if true, `/api/auth/me` returns a logged-in user instead +/// of 401 + anonymous bootstrap. +/// [geocodeReturnsResults]: if false, geocode returns an empty feature list. +/// [routeSucceeds]: if false, `/api/route` returns 500. +/// [loginSucceeds]: if false, `/api/auth/login` returns 401. +Dio buildMockDio({ + bool authenticated = false, + bool geocodeReturnsResults = true, + bool routeSucceeds = true, + bool loginSucceeds = true, +}) { + final dio = Dio(BaseOptions(baseUrl: 'http://localhost:3000')); + dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + final path = options.path; + + if (path == '/api/auth/me') { + if (authenticated) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.loggedInUser, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401, + data: {'error': 'unauthorized'}), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/auth/anonymous') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.anonymousUser, + )); + return; + } + + if (path == '/api/auth/login') { + if (loginSucceeds) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.loggedInUser, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401, + data: {'error': 'unauthorized'}), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/auth/logout') { + handler.resolve(Response(requestOptions: options, statusCode: 200)); + return; + } + + if (path == '/api/geocode') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: geocodeReturnsResults + ? TestFixtures.geocodeResponse + : {'features': []}, + )); + return; + } + + if (path == '/api/route') { + if (routeSucceeds) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.routePreviewJson, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 500), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/locations/home') { + handler.resolve(Response( + requestOptions: options, + statusCode: 404, + )); + return; + } + + handler.next(options); + }, + )); + return dio; +} + +/// Riverpod overrides shared across widget tests. +List testProviderOverrides({ + bool authenticated = false, + bool geocodeReturnsResults = true, + bool routeSucceeds = true, + bool loginSucceeds = true, +}) { + SharedPreferences.setMockInitialValues({}); + return [ + appConfigProvider.overrideWithValue(const AppConfig( + apiBaseUrl: 'http://localhost:3000', + tileStyleUrl: 'http://localhost:8080/tiles/style.json', + )), + dioProvider.overrideWithValue(buildMockDio( + authenticated: authenticated, + geocodeReturnsResults: geocodeReturnsResults, + routeSucceeds: routeSucceeds, + loginSucceeds: loginSucceeds, + )), + sharedPreferencesProvider.overrideWith((_) async { + SharedPreferences.setMockInitialValues({}); + return SharedPreferences.getInstance(); + }), + ]; +} + +/// Wraps [child] in a [ProviderScope] with test overrides and a [MaterialApp]. +/// +/// Callers that need fine-grained provider control should use +/// [testProviderOverrides] + [UncontrolledProviderScope] directly. +Widget buildTestWidget( + Widget child, { + bool authenticated = false, + bool geocodeReturnsResults = true, + bool routeSucceeds = true, + bool loginSucceeds = true, +}) { + return ProviderScope( + overrides: testProviderOverrides( + authenticated: authenticated, + geocodeReturnsResults: geocodeReturnsResults, + routeSucceeds: routeSucceeds, + loginSucceeds: loginSucceeds, + ), + child: MaterialApp(home: child), + ); +} +``` + +- [ ] **Step 2: Run `flutter analyze` on the helpers file** + +```bash +cd mobile && flutter analyze test/helpers/test_helpers.dart +``` + +Expected: `No issues found!` + +- [ ] **Step 3: Commit** + +```bash +git add mobile/test/helpers/test_helpers.dart +git commit -m "test(mobile): add widget test helpers with mock Dio and provider overrides" +``` + +--- + +## Task 5: SearchScreen Widget Tests + +**Files:** +- Create: `mobile/test/screens/search_screen_test.dart` + +Tests the full search flow: typing triggers a debounced API call, results appear as ListTiles, and tapping a result pops the route with the correct `GeocodeResult`. + +- [ ] **Step 1: Write the tests** + +```dart +import 'package:beebeebike/models/geocode_result.dart'; +import 'package:beebeebike/screens/search_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + group('SearchScreen', () { + testWidgets('shows search results after typing a query', (tester) async { + await tester.pumpWidget(buildTestWidget(const SearchScreen())); + await tester.pump(); + + final field = find.byType(TextField); + expect(field, findsOneWidget); + + await tester.enterText(field, 'Alex'); + // Wait for the 400 ms debounce + async search + await tester.pump(const Duration(milliseconds: 500)); + await tester.pump(); // let FutureBuilder/setState settle + + expect(find.text('Alexanderplatz'), findsOneWidget); + expect(find.text('Mitte · station'), findsOneWidget); + }); + + testWidgets('shows empty list when query returns no results', (tester) async { + await tester.pumpWidget(buildTestWidget( + const SearchScreen(), + geocodeReturnsResults: false, + )); + await tester.pump(); + + await tester.enterText(find.byType(TextField), 'nowhere'); + await tester.pump(const Duration(milliseconds: 500)); + await tester.pump(); + + expect(find.byType(ListTile), findsNothing); + }); + + testWidgets('tapping a result pops with the selected GeocodeResult', (tester) async { + GeocodeResult? returned; + + await tester.pumpWidget(ProviderScope( + overrides: testProviderOverrides(), + child: MaterialApp( + home: Builder(builder: (ctx) { + return ElevatedButton( + onPressed: () async { + returned = await Navigator.of(ctx).push( + MaterialPageRoute(builder: (_) => const SearchScreen()), + ); + }, + child: const Text('Open'), + ); + }), + ), + )); + + await tester.tap(find.text('Open')); + await tester.pumpAndSettle(); + + await tester.enterText(find.byType(TextField), 'Alex'); + await tester.pump(const Duration(milliseconds: 500)); + await tester.pump(); + + await tester.tap(find.text('Alexanderplatz')); + await tester.pumpAndSettle(); + + expect(returned, isNotNull); + expect(returned!.name, equals('Alexanderplatz')); + expect(returned!.id, equals('N:42')); + expect(returned!.lng, closeTo(13.405, 0.001)); + expect(returned!.lat, closeTo(52.52, 0.001)); + }); + + testWidgets('shows CircularProgressIndicator while loading', (tester) async { + await tester.pumpWidget(buildTestWidget(const SearchScreen())); + await tester.pump(); + + await tester.enterText(find.byType(TextField), 'Mitte'); + await tester.pump(const Duration(milliseconds: 500)); + // Don't pump again — catch the loading state + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); + }); +} +``` + +- [ ] **Step 2: Run the tests (they should fail since test_helpers.dart has compile errors without Task 4 being done first)** + +Ensure Task 4 is complete, then: + +```bash +cd mobile && flutter test test/screens/search_screen_test.dart -v +``` + +Expected: all 4 tests PASS. + +- [ ] **Step 3: Commit** + +```bash +git add mobile/test/screens/search_screen_test.dart +git commit -m "test(mobile): add SearchScreen widget tests" +``` + +--- + +## Task 6: MapScreen Widget Tests + +**Files:** +- Modify: `mobile/test/screens/map_screen_test.dart` + +Add the missing helper functions and imports that the stub test file from Task 2 needs, then verify all four cases: loading state, error state, route preview, and Start-button navigation. + +- [ ] **Step 1: Finalize `map_screen_test.dart` with full imports and helpers** + +Replace the stub created in Task 2 step 1 with the complete file: + +```dart +import 'package:beebeebike/api/client.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/models/route_state.dart'; +import 'package:beebeebike/providers/route_provider.dart'; +import 'package:beebeebike/providers/search_history_provider.dart'; +import 'package:beebeebike/screens/map_screen.dart'; +import 'package:beebeebike/screens/navigation_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + group('MapScreen route card', () { + testWidgets('shows CircularProgressIndicator while route is loading', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(_LoadingRouteController.new), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); + + testWidgets('shows "Could not load route" when route fails', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(_ErrorRouteController.new), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + + expect(find.text('Could not load route'), findsOneWidget); + }); + + testWidgets('shows RouteSummary with duration and distance when preview is ready', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(_PreviewRouteController.new), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + + expect(find.text('Start'), findsOneWidget); + // 1200 s / 60 = 20 min, 5000 m / 1000 = 5.0 km + expect(find.textContaining('20 min'), findsOneWidget); + expect(find.textContaining('5.0 km'), findsOneWidget); + }); + + testWidgets('Start button pushes NavigationScreen', (tester) async { + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(), + routeControllerProvider.overrideWith(_PreviewRouteController.new), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget(UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + )); + await tester.pump(); + await tester.tap(find.text('Start')); + await tester.pump(); // begin navigation screen init + + // NavigationScreen shows the close button + expect(find.byIcon(Icons.close), findsOneWidget); + }); + + testWidgets('shows placeholder text when no route is set', (tester) async { + await tester.pumpWidget(buildTestWidget(const MapScreen())); + await tester.pump(); + + expect(find.text('Home'), findsOneWidget); + expect(find.text('Saved places'), findsOneWidget); + }); + }); +} + +class _LoadingRouteController extends RouteController { + @override + RouteState build() => const RouteState(isLoading: true); +} + +class _ErrorRouteController extends RouteController { + @override + RouteState build() => const RouteState(error: 'routing failed'); +} + +class _PreviewRouteController extends RouteController { + @override + RouteState build() => RouteState( + preview: fakePreview(), + origin: fakeOrigin(), + destination: fakeDest(), + ); +} +``` + +- [ ] **Step 2: Run the tests** + +```bash +cd mobile && flutter test test/screens/map_screen_test.dart -v +``` + +Expected: all 5 tests PASS. + +- [ ] **Step 3: Commit** + +```bash +git add mobile/test/screens/map_screen_test.dart +git commit -m "test(mobile): add MapScreen widget tests for route card states" +``` + +--- + +## Task 7: SettingsScreen & LoginScreen Widget Tests + +**Files:** +- Finalize: `mobile/test/screens/settings_login_test.dart` + +The stub in Task 3 step 1 already has the full test content. After Tasks 3 and 4 are complete, this file should compile and all tests should pass. + +- [ ] **Step 1: Run the tests** + +```bash +cd mobile && flutter test test/screens/settings_login_test.dart -v +``` + +Expected: +``` +✓ SettingsScreen shows Log in tile when anonymous +✓ SettingsScreen tapping Log in navigates to LoginScreen +✓ SettingsScreen shows email and Log out when authenticated +✓ LoginScreen renders email and password fields and Log in button +✓ LoginScreen shows error message on invalid credentials +✓ LoginScreen pops on successful login +``` + +- [ ] **Step 2: If any test fails, debug** + +For the "pops on successful login" test: `loginSucceeds: true` is the default. The `_submit()` method calls `authControllerProvider.login()` and then pops. If the provider is not being overridden correctly in `buildTestWidget`, the real Dio will be used and the login will fail. Verify that `dioProvider` is correctly overridden in `buildTestWidget`. + +For the "shows error message" test: `loginSucceeds: false` causes the mock Dio to return 401 for `/api/auth/login`. The `_submit()` method catches the `DioException` and sets `_error = 'Invalid email or password'`. If the test fails, add a print to `_submit()` to confirm the catch block runs. + +- [ ] **Step 3: Run the full test suite** + +```bash +cd mobile && flutter test +``` + +Expected output (12 existing + new tests): +``` +All tests passed! +``` + +- [ ] **Step 4: Commit** + +```bash +git add mobile/test/screens/settings_login_test.dart +git commit -m "test(mobile): add SettingsScreen and LoginScreen widget tests" +``` + +--- + +## Self-Review + +**Spec coverage:** +- ✅ UI tests surface "searching doesn't turn up results" → SearchScreen test #1 and #2 +- ✅ UI tests surface "tapping search result doesn't result in route" → SearchScreen test #3 checks return value; MapScreen test setup validates route state → RouteSummary +- ✅ UI tests surface "tapping map doesn't result in navigation" → MapScreen test "Start button pushes NavigationScreen" +- ✅ Anonymous session on app startup → Task 1 (authControllerProvider watched in BeeBeeBikeApp, test asserts /api/auth/me called on startup) +- ✅ onMapClick fixed → Task 2 (GestureDetector + toLatLng) +- ✅ Login fixed → Task 3 (LoginScreen + settings wire-up) +- ✅ Widget tests exercise all features → Tasks 5–7 + +**Placeholder scan:** None found. + +**Type consistency:** +- `fakePreview()`, `fakeOrigin()`, `fakeDest()` defined in `test_helpers.dart` and used by both `map_screen_test.dart` and `settings_login_test.dart` (indirectly). +- `RouteController` subclasses (`_LoadingRouteController`, etc.) override `build()` returning `RouteState` — matches the `NotifierProvider` declaration. +- `buildTestWidget` and `testProviderOverrides` parameter names match across all usage sites. diff --git a/docs/superpowers/plans/2026-04-18-navigation-camera-lifecycle.md b/docs/superpowers/plans/2026-04-18-navigation-camera-lifecycle.md new file mode 100644 index 0000000..fb84911 --- /dev/null +++ b/docs/superpowers/plans/2026-04-18-navigation-camera-lifecycle.md @@ -0,0 +1,1211 @@ +# Navigation Camera Lifecycle Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make the navigation map fly to the rider on Start, follow with heading-up camera, yield to user pan/zoom, offer a recenter button, and react to reroute/arrival per [the spec](../specs/2026-04-18-navigation-camera-lifecycle-design.md). + +**Architecture:** A `NavigationCameraController` (ChangeNotifier) holds the 4-state machine (`awaitingFirstFix`, `following`, `free`, `arrived`) and persists `followZoom`. It is injected into `NavigationScreen` via a Riverpod provider so tests can drive it directly. `NavigationScreen` wires maplibre callbacks and `navigationStateProvider` transitions to the controller, and swaps three small widgets (`RecenterFab`, `ReroutingToast`, `ArrivedSheet`) based on controller state and nav state. + +**Tech Stack:** Flutter 3.19+, Riverpod 2.x, maplibre_gl 0.20.0 (has `onCameraTrackingDismissed`, `updateMyLocationTrackingMode`), ferrostar_flutter (exposes `NavigationState` with `snappedLocation`, `isOffRoute`, `status`). + +--- + +## File Structure + +| File | Responsibility | Change | +|---|---|---| +| `mobile/lib/navigation/camera_controller.dart` | State machine (ChangeNotifier); no Flutter widget imports | **rewrite** (stub → real) | +| `mobile/lib/providers/navigation_camera_provider.dart` | `navigationCameraControllerProvider` | **create** | +| `mobile/lib/widgets/recenter_fab.dart` | Small FAB with `Icons.my_location`, tap callback | **create** | +| `mobile/lib/widgets/rerouting_toast.dart` | Pill with spinner + "Rerouting…" text | **create** | +| `mobile/lib/widgets/arrived_sheet.dart` | Bottom-sheet content for arrival: headline + Done button | **create** | +| `mobile/lib/services/route_drawing.dart` | Existing route overlay; add `fitCamera` opt-out | **modify** | +| `mobile/lib/screens/navigation_screen.dart` | Wire everything: initial camera, state listener, FAB, toast, sheet | **rewrite** | +| `mobile/test/navigation/camera_controller_test.dart` | Existing 1-test file — replace with full state-machine coverage | **rewrite** | +| `mobile/test/widgets/recenter_fab_test.dart` | New | **create** | +| `mobile/test/widgets/rerouting_toast_test.dart` | New | **create** | +| `mobile/test/widgets/arrived_sheet_test.dart` | New | **create** | +| `mobile/test/screens/navigation_screen_test.dart` | Existing — keep passing after rewrite | **verify unchanged behavior** | +| `mobile/test/screens/navigation_screen_lifecycle_test.dart` | New lifecycle assertions | **create** | + +--- + +## Tasks + +### Task 1: Replace `NavigationCameraController` stub with state machine + +**Files:** +- Modify: `mobile/lib/navigation/camera_controller.dart` +- Modify: `mobile/test/navigation/camera_controller_test.dart` + +- [ ] **Step 1: Replace the existing test file with full state-machine coverage** + +Overwrite `mobile/test/navigation/camera_controller_test.dart` with: + +```dart +import 'package:flutter_test/flutter_test.dart'; +import 'package:beebeebike/navigation/camera_controller.dart'; + +void main() { + group('NavigationCameraController', () { + test('starts in awaitingFirstFix with default zoom 17', () { + final c = NavigationCameraController(); + expect(c.mode, CameraMode.awaitingFirstFix); + expect(c.followZoom, 17.0); + }); + + test('onFirstFix transitions awaitingFirstFix -> following', () { + final c = NavigationCameraController(); + c.onFirstFix(); + expect(c.mode, CameraMode.following); + }); + + test('onFirstFix is a no-op if already following', () { + final c = NavigationCameraController()..onFirstFix(); + c.onFirstFix(); + expect(c.mode, CameraMode.following); + }); + + test('onTrackingDismissed transitions following -> free', () { + final c = NavigationCameraController()..onFirstFix(); + c.onTrackingDismissed(); + expect(c.mode, CameraMode.free); + }); + + test('onTrackingDismissed is a no-op in awaitingFirstFix', () { + final c = NavigationCameraController(); + c.onTrackingDismissed(); + expect(c.mode, CameraMode.awaitingFirstFix); + }); + + test('onTrackingDismissed is a no-op in arrived', () { + final c = NavigationCameraController()..onArrived(); + c.onTrackingDismissed(); + expect(c.mode, CameraMode.arrived); + }); + + test('onZoomChanged mutates followZoom iff mode == free', () { + final c = NavigationCameraController(); + c.onZoomChanged(14.0); + expect(c.followZoom, 17.0); // awaitingFirstFix: ignored + c.onFirstFix(); + c.onZoomChanged(15.5); + expect(c.followZoom, 17.0); // following: ignored + c.onTrackingDismissed(); + c.onZoomChanged(13.2); + expect(c.followZoom, 13.2); // free: captured + }); + + test('onRecenterTapped transitions free -> following', () { + final c = NavigationCameraController() + ..onFirstFix() + ..onTrackingDismissed(); + c.onRecenterTapped(); + expect(c.mode, CameraMode.following); + }); + + test('onRecenterTapped is a no-op in following', () { + final c = NavigationCameraController()..onFirstFix(); + c.onRecenterTapped(); + expect(c.mode, CameraMode.following); + }); + + test('onArrived transitions any state to arrived', () { + for (final setup in [ + () => NavigationCameraController(), + () => NavigationCameraController()..onFirstFix(), + () => NavigationCameraController() + ..onFirstFix() + ..onTrackingDismissed(), + ]) { + final c = setup(); + c.onArrived(); + expect(c.mode, CameraMode.arrived); + } + }); + + test('notifies listeners on every successful transition', () { + final c = NavigationCameraController(); + var notifications = 0; + c.addListener(() => notifications++); + c.onFirstFix(); + c.onTrackingDismissed(); + c.onZoomChanged(14.0); + c.onRecenterTapped(); + c.onArrived(); + expect(notifications, 5); + }); + + test('does not notify on no-op transitions', () { + final c = NavigationCameraController(); + var notifications = 0; + c.addListener(() => notifications++); + c.onTrackingDismissed(); // no-op from awaitingFirstFix + c.onRecenterTapped(); // no-op from awaitingFirstFix + expect(notifications, 0); + }); + }); +} +``` + +- [ ] **Step 2: Run tests to verify they fail** + +Run: `cd mobile && flutter test test/navigation/camera_controller_test.dart` +Expected: FAIL — old `NavigationCameraController` has `followMode` bool, not `mode` enum. + +- [ ] **Step 3: Rewrite `mobile/lib/navigation/camera_controller.dart`** + +```dart +import 'package:flutter/foundation.dart'; + +enum CameraMode { awaitingFirstFix, following, free, arrived } + +class NavigationCameraController extends ChangeNotifier { + CameraMode _mode = CameraMode.awaitingFirstFix; + double _followZoom = 17.0; + + CameraMode get mode => _mode; + double get followZoom => _followZoom; + + void onFirstFix() { + if (_mode != CameraMode.awaitingFirstFix) return; + _mode = CameraMode.following; + notifyListeners(); + } + + void onTrackingDismissed() { + if (_mode != CameraMode.following) return; + _mode = CameraMode.free; + notifyListeners(); + } + + void onZoomChanged(double zoom) { + if (_mode != CameraMode.free) return; + _followZoom = zoom; + notifyListeners(); + } + + void onRecenterTapped() { + if (_mode != CameraMode.free) return; + _mode = CameraMode.following; + notifyListeners(); + } + + void onArrived() { + if (_mode == CameraMode.arrived) return; + _mode = CameraMode.arrived; + notifyListeners(); + } +} +``` + +- [ ] **Step 4: Run tests to verify they pass** + +Run: `cd mobile && flutter test test/navigation/camera_controller_test.dart` +Expected: PASS, all 11 tests. + +- [ ] **Step 5: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/navigation/camera_controller.dart mobile/test/navigation/camera_controller_test.dart +git commit -m "feat(mobile): navigation camera state machine" +``` + +--- + +### Task 2: Add `fitCamera` opt-out to `RouteOverlay.draw` + +Context: `RouteOverlay.draw` currently calls `animateCamera(newLatLngBounds(...))` to fit the route. `NavigationScreen` needs to set its own camera (origin at zoom 17), so we must make bounds-fit opt-out while keeping current `MapScreen` behavior default. + +**Files:** +- Modify: `mobile/lib/services/route_drawing.dart:40-75` + +- [ ] **Step 1: Modify `RouteOverlay.draw` signature** + +Change [mobile/lib/services/route_drawing.dart:40-75](../../../mobile/lib/services/route_drawing.dart#L40-L75) to accept a `fitCamera` bool and gate the `animateCamera` call on it: + +```dart + static Future draw( + MapLibreMapController controller, + RoutePreview preview, { + bool fitCamera = true, + }) async { + final coords = _decodeLineString(preview.geometry); + final line = await controller.addLine(LineOptions( + geometry: coords, + lineColor: _routeLineColor, + lineWidth: 5.0, + lineOpacity: 0.9, + )); + final origin = await controller.addCircle(CircleOptions( + geometry: coords.first, + circleRadius: 8.0, + circleColor: _markerFillColor, + circleStrokeColor: _markerStrokeColor, + circleStrokeWidth: 2.0, + )); + final destination = await controller.addCircle(CircleOptions( + geometry: coords.last, + circleRadius: 8.0, + circleColor: _markerFillColor, + circleStrokeColor: _markerStrokeColor, + circleStrokeWidth: 2.0, + )); + if (fitCamera) { + await controller.animateCamera( + CameraUpdate.newLatLngBounds( + _boundsFor(coords), + left: 40, + top: 100, + right: 40, + bottom: 240, + ), + ); + } + return RouteOverlay._(line, origin, destination); + } +``` + +- [ ] **Step 2: Run all tests to verify nothing broke** + +Run: `cd mobile && flutter test` +Expected: PASS (existing tests do not assert `animateCamera` was called; they just render the screen). + +- [ ] **Step 3: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/services/route_drawing.dart +git commit -m "feat(mobile): RouteOverlay.draw fitCamera opt-out" +``` + +--- + +### Task 3: Create `RecenterFab` widget + +**Files:** +- Create: `mobile/lib/widgets/recenter_fab.dart` +- Create: `mobile/test/widgets/recenter_fab_test.dart` + +- [ ] **Step 1: Write the failing test** + +Create `mobile/test/widgets/recenter_fab_test.dart`: + +```dart +import 'package:beebeebike/widgets/recenter_fab.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders my_location icon and fires onTap when tapped', + (tester) async { + var tapped = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold(body: RecenterFab(onTap: () => tapped++)), + )); + + expect(find.byIcon(Icons.my_location), findsOneWidget); + await tester.tap(find.byType(RecenterFab)); + await tester.pumpAndSettle(); + expect(tapped, 1); + }); +} +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `cd mobile && flutter test test/widgets/recenter_fab_test.dart` +Expected: FAIL — `RecenterFab` not found. + +- [ ] **Step 3: Create the widget** + +Create `mobile/lib/widgets/recenter_fab.dart`: + +```dart +import 'package:flutter/material.dart'; + +class RecenterFab extends StatelessWidget { + const RecenterFab({super.key, required this.onTap}); + + final VoidCallback onTap; + + @override + Widget build(BuildContext context) { + return FloatingActionButton.small( + heroTag: 'nav-recenter-fab', + onPressed: onTap, + child: const Icon(Icons.my_location), + ); + } +} +``` + +- [ ] **Step 4: Run test to verify it passes** + +Run: `cd mobile && flutter test test/widgets/recenter_fab_test.dart` +Expected: PASS. + +- [ ] **Step 5: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/widgets/recenter_fab.dart mobile/test/widgets/recenter_fab_test.dart +git commit -m "feat(mobile): RecenterFab widget" +``` + +--- + +### Task 4: Create `ReroutingToast` widget + +**Files:** +- Create: `mobile/lib/widgets/rerouting_toast.dart` +- Create: `mobile/test/widgets/rerouting_toast_test.dart` + +- [ ] **Step 1: Write the failing test** + +Create `mobile/test/widgets/rerouting_toast_test.dart`: + +```dart +import 'package:beebeebike/widgets/rerouting_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders text and spinner', (tester) async { + await tester.pumpWidget(const MaterialApp( + home: Scaffold(body: ReroutingToast()), + )); + expect(find.text('Rerouting…'), findsOneWidget); + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); +} +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `cd mobile && flutter test test/widgets/rerouting_toast_test.dart` +Expected: FAIL — `ReroutingToast` not found. + +- [ ] **Step 3: Create the widget** + +Create `mobile/lib/widgets/rerouting_toast.dart`: + +```dart +import 'package:flutter/material.dart'; + +class ReroutingToast extends StatelessWidget { + const ReroutingToast({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.symmetric(horizontal: 32, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.75), + borderRadius: BorderRadius.circular(24), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: const [ + SizedBox( + width: 16, + height: 16, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: AlwaysStoppedAnimation(Colors.white), + ), + ), + SizedBox(width: 12), + Text('Rerouting…', + style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600)), + ], + ), + ); + } +} +``` + +- [ ] **Step 4: Run test to verify it passes** + +Run: `cd mobile && flutter test test/widgets/rerouting_toast_test.dart` +Expected: PASS. + +- [ ] **Step 5: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/widgets/rerouting_toast.dart mobile/test/widgets/rerouting_toast_test.dart +git commit -m "feat(mobile): ReroutingToast widget" +``` + +--- + +### Task 5: Create `ArrivedSheet` widget + +**Files:** +- Create: `mobile/lib/widgets/arrived_sheet.dart` +- Create: `mobile/test/widgets/arrived_sheet_test.dart` + +- [ ] **Step 1: Write the failing test** + +Create `mobile/test/widgets/arrived_sheet_test.dart`: + +```dart +import 'package:beebeebike/widgets/arrived_sheet.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders Arrived headline and fires onDone when Done tapped', + (tester) async { + var tapped = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold(body: ArrivedSheet(onDone: () => tapped++)), + )); + + expect(find.text('Arrived'), findsOneWidget); + await tester.tap(find.widgetWithText(FilledButton, 'Done')); + await tester.pumpAndSettle(); + expect(tapped, 1); + }); +} +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `cd mobile && flutter test test/widgets/arrived_sheet_test.dart` +Expected: FAIL — `ArrivedSheet` not found. + +- [ ] **Step 3: Create the widget** + +Create `mobile/lib/widgets/arrived_sheet.dart`: + +```dart +import 'package:flutter/material.dart'; + +class ArrivedSheet extends StatelessWidget { + const ArrivedSheet({super.key, required this.onDone}); + + final VoidCallback onDone; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(20), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text('Arrived', style: Theme.of(context).textTheme.headlineSmall), + const SizedBox(height: 16), + FilledButton(onPressed: onDone, child: const Text('Done')), + ], + ), + ); + } +} +``` + +- [ ] **Step 4: Run test to verify it passes** + +Run: `cd mobile && flutter test test/widgets/arrived_sheet_test.dart` +Expected: PASS. + +- [ ] **Step 5: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/widgets/arrived_sheet.dart mobile/test/widgets/arrived_sheet_test.dart +git commit -m "feat(mobile): ArrivedSheet widget" +``` + +--- + +### Task 6: Add `navigationCameraControllerProvider` + +Provider wrapping `NavigationCameraController`. Needed so lifecycle tests can read/drive the controller from outside the screen. + +**Files:** +- Create: `mobile/lib/providers/navigation_camera_provider.dart` + +- [ ] **Step 1: Create the provider file** + +Create `mobile/lib/providers/navigation_camera_provider.dart`: + +```dart +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../navigation/camera_controller.dart'; + +final navigationCameraControllerProvider = + Provider.autoDispose((ref) { + final controller = NavigationCameraController(); + ref.onDispose(controller.dispose); + return controller; +}); +``` + +- [ ] **Step 2: Verify compile** + +Run: `cd mobile && flutter analyze lib/providers/navigation_camera_provider.dart` +Expected: no issues. + +- [ ] **Step 3: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/providers/navigation_camera_provider.dart +git commit -m "feat(mobile): navigationCameraControllerProvider" +``` + +--- + +### Task 7: Wire `NavigationScreen` to the new camera lifecycle + +This is the biggest task. We rewrite `navigation_screen.dart` to: +- Use the origin from `routeControllerProvider` as `initialCameraPosition` (zoom 17), falling back to Berlin centroid if origin is null (keeps the existing screen test valid). +- Read `navigationCameraControllerProvider` and rebuild on its changes via `AnimatedBuilder` wrapping the affected UI regions. +- `ref.listen(navigationStateProvider, ...)` handles three transitions: + - `prev.snappedLocation == null && next.snappedLocation != null` → `cam.onFirstFix()`, animate to location at `cam.followZoom`, set `trackingCompass`. + - `prev.isOffRoute == false && next.isOffRoute == true` → `setState(_rerouting = true)`. + - `prev.isOffRoute == true && next.isOffRoute == false` → `setState(_rerouting = false)`. + - `prev.status != complete && next.status == complete` → disable tracking, animate to destination at zoom 17, `cam.onArrived()`. +- Maplibre callbacks: `onCameraTrackingDismissed` → `cam.onTrackingDismissed()`; `onCameraIdle` → `cam.onZoomChanged(pos.zoom)`. +- Recenter FAB tap → animate to user at `cam.followZoom`, set `trackingCompass`, `cam.onRecenterTapped()`. +- `RouteOverlay.draw` called with `fitCamera: false`. +- Bottom sheet swaps to `ArrivedSheet` when `cam.mode == arrived`. +- `ReroutingToast` shown under `TurnBanner` when `_rerouting == true`. +- `RecenterFab` shown bottom-right above bottom sheet when `cam.mode == free`. + +**Files:** +- Modify: `mobile/lib/screens/navigation_screen.dart` (full rewrite) + +- [ ] **Step 1: Rewrite `mobile/lib/screens/navigation_screen.dart`** + +```dart +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:maplibre_gl/maplibre_gl.dart'; + +import '../navigation/camera_controller.dart'; +import '../navigation/navigation_service.dart'; +import '../providers/navigation_camera_provider.dart'; +import '../providers/navigation_provider.dart'; +import '../providers/route_provider.dart'; +import '../services/map_style_loader.dart'; +import '../services/route_drawing.dart'; +import '../widgets/arrived_sheet.dart'; +import '../widgets/recenter_fab.dart'; +import '../widgets/rerouting_toast.dart'; +import '../widgets/turn_banner.dart'; + +const _defaultCenter = LatLng(52.5200, 13.4050); +const _followZoomOnStart = 17.0; + +class NavigationScreen extends ConsumerStatefulWidget { + const NavigationScreen({super.key}); + + @override + ConsumerState createState() => _NavigationScreenState(); +} + +class _NavigationScreenState extends ConsumerState { + late final NavigationService _navigationService; + MapLibreMapController? _mapController; + RouteOverlay? _routeOverlay; + bool _ttsEnabled = true; + bool _rerouting = false; + + @override + void initState() { + super.initState(); + _navigationService = ref.read(navigationServiceProvider); + _startNavigation(); + } + + @override + void dispose() { + _navigationService.dispose(); + super.dispose(); + } + + Future _startNavigation() async { + final routeState = ref.read(routeControllerProvider); + final origin = routeState.origin; + final destination = routeState.destination; + if (origin == null || destination == null) return; + try { + await _navigationService.start( + origin: WaypointInput(lat: origin.lat, lng: origin.lng), + destination: + WaypointInput(lat: destination.lat, lng: destination.lng), + ); + } catch (e, st) { + debugPrint('NavigationScreen: failed to start navigation: $e\n$st'); + } + } + + Future _drawRouteIfReady() async { + final controller = _mapController; + if (controller == null) return; + if (_routeOverlay != null) return; + final preview = ref.read(routeControllerProvider).preview; + if (preview == null) return; + _routeOverlay = + await RouteOverlay.draw(controller, preview, fitCamera: false); + } + + Future _handleFirstFix(UserLocation loc) async { + final controller = _mapController; + if (controller == null) return; + final cam = ref.read(navigationCameraControllerProvider); + cam.onFirstFix(); + await controller + .animateCamera(CameraUpdate.newLatLngZoom( + LatLng(loc.lat, loc.lng), cam.followZoom)); + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.trackingCompass); + } + + Future _handleArrival() async { + final controller = _mapController; + if (controller == null) return; + final destination = ref.read(routeControllerProvider).destination; + final cam = ref.read(navigationCameraControllerProvider); + cam.onArrived(); + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.none); + if (destination != null) { + await controller.animateCamera(CameraUpdate.newLatLngZoom( + LatLng(destination.lat, destination.lng), 17)); + } + } + + Future _handleRecenterTap() async { + final controller = _mapController; + if (controller == null) return; + final snapped = ref.read(navigationStateProvider).value?.snappedLocation; + if (snapped == null) return; + final cam = ref.read(navigationCameraControllerProvider); + cam.onRecenterTapped(); + await controller.animateCamera(CameraUpdate.newLatLngZoom( + LatLng(snapped.lat, snapped.lng), cam.followZoom)); + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.trackingCompass); + } + + void _onNavStateChange( + AsyncValue? prev, AsyncValue next) { + final prevState = prev?.value; + final nextState = next.value; + if (nextState == null) return; + + if (prevState?.snappedLocation == null && + nextState.snappedLocation != null) { + _handleFirstFix(nextState.snappedLocation!); + } + + if ((prevState?.isOffRoute ?? false) != nextState.isOffRoute) { + setState(() => _rerouting = nextState.isOffRoute); + } + + if (prevState?.status != TripStatus.complete && + nextState.status == TripStatus.complete) { + _handleArrival(); + } + } + + @override + Widget build(BuildContext context) { + final navState = ref.watch(navigationStateProvider); + final styleAsync = ref.watch(mapStyleProvider); + final cam = ref.watch(navigationCameraControllerProvider); + final origin = ref.watch(routeControllerProvider).origin; + + ref.listen>( + navigationStateProvider, _onNavStateChange); + + final initialTarget = + origin != null ? LatLng(origin.lat, origin.lng) : _defaultCenter; + + return Scaffold( + body: Stack( + children: [ + styleAsync.when( + loading: () => const ColoredBox(color: Color(0xFFCFE3D3)), + error: (e, _) => Center(child: Text('Map error: $e')), + data: (style) => MapLibreMap( + styleString: style, + initialCameraPosition: CameraPosition( + target: initialTarget, + zoom: _followZoomOnStart, + ), + myLocationEnabled: true, + myLocationTrackingMode: MyLocationTrackingMode.none, + trackCameraPosition: true, + onMapCreated: (controller) async { + _mapController = controller; + await _drawRouteIfReady(); + }, + onCameraTrackingDismissed: () { + ref + .read(navigationCameraControllerProvider) + .onTrackingDismissed(); + }, + onCameraIdle: () { + final c = _mapController; + if (c == null) return; + final zoom = c.cameraPosition?.zoom; + if (zoom != null) { + ref + .read(navigationCameraControllerProvider) + .onZoomChanged(zoom); + } + }, + ), + ), + Align( + alignment: Alignment.topCenter, + child: SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + navState.when( + loading: () => const TurnBanner( + primaryText: 'Starting navigation...', + distanceText: '', + ), + error: (e, _) => const TurnBanner( + primaryText: 'Navigation error', + distanceText: '', + icon: Icons.error_outline, + ), + data: (state) => TurnBanner( + primaryText: + state.currentVisual?.primaryText ?? 'On route', + distanceText: state.progress != null + ? _formatDistance( + state.progress!.distanceToNextManeuverM) + : '', + icon: state.currentVisual != null + ? _iconForManeuver( + state.currentVisual!.maneuverType, + state.currentVisual!.maneuverModifier, + ) + : Icons.straight, + ), + ), + if (_rerouting) const ReroutingToast(), + ], + ), + ), + ), + if (cam.mode == CameraMode.free) + Align( + alignment: Alignment.bottomRight, + child: SafeArea( + child: Padding( + padding: const EdgeInsets.only(right: 16, bottom: 140), + child: RecenterFab(onTap: _handleRecenterTap), + ), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: SafeArea( + top: false, + child: Container( + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.vertical(top: Radius.circular(24)), + ), + child: cam.mode == CameraMode.arrived + ? ArrivedSheet(onDone: () => Navigator.of(context).pop()) + : _EtaSheet( + navState: navState, + ttsEnabled: _ttsEnabled, + onToggleTts: () => + setState(() => _ttsEnabled = !_ttsEnabled), + onClose: () => Navigator.of(context).pop(), + ), + ), + ), + ), + ], + ), + ); + } +} + +class _EtaSheet extends StatelessWidget { + const _EtaSheet({ + required this.navState, + required this.ttsEnabled, + required this.onToggleTts, + required this.onClose, + }); + + final AsyncValue navState; + final bool ttsEnabled; + final VoidCallback onToggleTts; + final VoidCallback onClose; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + navState.when( + loading: () => const Text('Loading...'), + error: (_, __) => const Text('—'), + data: (state) { + final p = state.progress; + if (p == null) return const Text('—'); + return Text(_formatEta(p.durationRemainingMs)); + }, + ), + Row( + children: [ + IconButton( + icon: Icon( + ttsEnabled ? Icons.volume_up : Icons.volume_off), + onPressed: onToggleTts, + ), + const SizedBox(width: 16), + GestureDetector( + onTap: onClose, + child: const Icon(Icons.close), + ), + ], + ), + ], + ), + ); + } +} + +IconData _iconForManeuver(String type, String? modifier) { + final mod = modifier?.replaceAll('_', ' '); + if (type == 'turn') { + if (mod == 'left') return Icons.turn_left; + if (mod == 'right') return Icons.turn_right; + if (mod == 'sharp left') return Icons.turn_sharp_left; + if (mod == 'sharp right') return Icons.turn_sharp_right; + if (mod == 'slight left') return Icons.turn_slight_left; + if (mod == 'slight right') return Icons.turn_slight_right; + } + if (type == 'arrive') return Icons.flag; + return Icons.straight; +} + +String _formatDistance(double meters) { + if (meters >= 1000) return '${(meters / 1000).toStringAsFixed(1)} km'; + return '${meters.round()} m'; +} + +String _formatEta(int durationRemainingMs) { + final eta = + DateTime.now().add(Duration(milliseconds: durationRemainingMs)); + final h = eta.hour.toString().padLeft(2, '0'); + final m = eta.minute.toString().padLeft(2, '0'); + final minRemaining = (durationRemainingMs / 60000).round(); + return '$h:$m arrival · $minRemaining min'; +} +``` + +- [ ] **Step 2: Run all existing tests; confirm `navigation_screen_test.dart` still passes** + +Run: `cd mobile && flutter test test/screens/navigation_screen_test.dart` +Expected: PASS (existing test asserts `TurnBanner` content; our rewrite still renders it). + +- [ ] **Step 3: Run the full suite to confirm no regressions** + +Run: `cd mobile && flutter test` +Expected: PASS (existing ~30 tests all green; new widget tests from Tasks 3-5 all green). + +- [ ] **Step 4: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/lib/screens/navigation_screen.dart +git commit -m "feat(mobile): wire NavigationScreen to camera lifecycle" +``` + +--- + +### Task 8: Lifecycle widget test + +Assert the screen-level visibility rules: recenter FAB, rerouting toast, arrived sheet. + +**Files:** +- Create: `mobile/test/screens/navigation_screen_lifecycle_test.dart` + +- [ ] **Step 1: Write the failing test** + +Create `mobile/test/screens/navigation_screen_lifecycle_test.dart`: + +```dart +import 'dart:async'; + +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/models/location.dart'; +import 'package:beebeebike/navigation/camera_controller.dart'; +import 'package:beebeebike/navigation/navigation_service.dart'; +import 'package:beebeebike/providers/navigation_camera_provider.dart'; +import 'package:beebeebike/providers/navigation_provider.dart'; +import 'package:beebeebike/providers/route_provider.dart'; +import 'package:beebeebike/screens/navigation_screen.dart'; +import 'package:beebeebike/services/map_style_loader.dart'; +import 'package:beebeebike/widgets/arrived_sheet.dart'; +import 'package:beebeebike/widgets/recenter_fab.dart'; +import 'package:beebeebike/widgets/rerouting_toast.dart'; +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +NavigationState _baseState({ + TripStatus status = TripStatus.navigating, + bool isOffRoute = false, + UserLocation? snapped, +}) { + return NavigationState( + status: status, + isOffRoute: isOffRoute, + snappedLocation: snapped, + progress: const TripProgress( + distanceToNextManeuverM: 150, + distanceRemainingM: 3200, + durationRemainingMs: 720000, + ), + ); +} + +Future<(WidgetTester, StreamController, + NavigationCameraController)> + _pump(WidgetTester tester) async { + final navStream = StreamController.broadcast(); + final cam = NavigationCameraController(); + + final fakeService = NavigationService( + createController: (_, __) => throw UnimplementedError(), + loadNavigationRoute: ({required origin, required destination}) => + throw UnimplementedError(), + locationStream: const Stream.empty(), + speakInstruction: (_) async {}, + ); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + appConfigProvider.overrideWithValue( + const AppConfig( + apiBaseUrl: 'http://localhost', + tileServerBaseUrl: 'http://localhost', + tileStyleUrl: 'http://localhost/tiles', + ), + ), + mapStyleProvider.overrideWith((ref) => Future.value('{}')), + navigationStateProvider + .overrideWith((ref) => navStream.stream), + navigationServiceProvider.overrideWithValue(fakeService), + navigationCameraControllerProvider.overrideWith((ref) { + ref.onDispose(cam.dispose); + return cam; + }), + routeControllerProvider.overrideWith(() { + return _SeededRouteController( + origin: const Location( + id: 'o', name: 'o', label: 'o', lng: 13.4, lat: 52.5), + destination: const Location( + id: 'd', name: 'd', label: 'd', lng: 13.5, lat: 52.55), + ); + }), + ], + child: const MaterialApp(home: NavigationScreen()), + ), + ); + await tester.pump(); + addTearDown(navStream.close); + return (tester, navStream, cam); +} + +void main() { + testWidgets('recenter FAB hidden initially', (tester) async { + await _pump(tester); + expect(find.byType(RecenterFab), findsNothing); + }); + + testWidgets('recenter FAB visible when camera enters free mode', + (tester) async { + final (_, __, cam) = await _pump(tester); + cam.onFirstFix(); + cam.onTrackingDismissed(); + await tester.pumpAndSettle(); + expect(find.byType(RecenterFab), findsOneWidget); + }); + + testWidgets('rerouting toast appears when isOffRoute flips true', + (tester) async { + final (_, stream, __) = await _pump(tester); + stream.add(_baseState(isOffRoute: true)); + await tester.pumpAndSettle(); + expect(find.byType(ReroutingToast), findsOneWidget); + + stream.add(_baseState(isOffRoute: false)); + await tester.pumpAndSettle(); + expect(find.byType(ReroutingToast), findsNothing); + }); + + testWidgets('arrived sheet replaces ETA sheet on TripStatus.complete', + (tester) async { + final (_, stream, __) = await _pump(tester); + stream.add(_baseState(status: TripStatus.complete)); + await tester.pumpAndSettle(); + expect(find.byType(ArrivedSheet), findsOneWidget); + }); +} + +class _SeededRouteController extends RouteController { + _SeededRouteController({required this.origin, required this.destination}); + final Location origin; + final Location destination; + @override + build() => super.build().copyWith(origin: origin, destination: destination); +} +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `cd mobile && flutter test test/screens/navigation_screen_lifecycle_test.dart` +Expected: fails on import / missing route controller override (we need to confirm the `RouteController` constructor pattern matches). + +- [ ] **Step 3: If `RouteController` has no default constructor signature matching `overrideWith(() => _SeededRouteController(...))`, switch to seeding via a post-pump `setOrigin` / `setDestination` call** + +If Step 2 fails due to `overrideWith` signature, replace the `routeControllerProvider.overrideWith(...)` block with: + +```dart +// (no override — seed via notifier after pump) +``` + +and after the `pumpWidget`: + +```dart +final container = ProviderScope.containerOf( + tester.element(find.byType(NavigationScreen))); +container.read(routeControllerProvider.notifier).setOrigin( + const Location(id: 'o', name: 'o', label: 'o', lng: 13.4, lat: 52.5), + ); +container.read(routeControllerProvider.notifier).setDestination( + const Location(id: 'd', name: 'd', label: 'd', lng: 13.5, lat: 52.55), + ); +``` + +Note: `setOrigin`/`setDestination` call `_maybeLoadPreview` which hits the API. Since `dioProvider` is not overridden here, this may fail. In that case, also override the loader with a stub that throws (the screen tolerates a null preview): + +```dart +routePreviewLoaderProvider.overrideWithValue( + ({required Location origin, required Location destination}) async { + throw Exception('test: loader disabled'); + }, +), +``` + +Prefer the direct `overrideWith` approach; use this fallback only if needed. + +- [ ] **Step 4: Run the test; iterate until it passes** + +Run: `cd mobile && flutter test test/screens/navigation_screen_lifecycle_test.dart` +Expected: PASS, all 4 tests. + +- [ ] **Step 5: Run the full suite** + +Run: `cd mobile && flutter test` +Expected: all tests green. + +- [ ] **Step 6: Commit** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +git add mobile/test/screens/navigation_screen_lifecycle_test.dart +git commit -m "test(mobile): NavigationScreen lifecycle — FAB, toast, arrived sheet" +``` + +--- + +### Task 9: End-to-end verification on iOS simulator + +**Files:** none (manual). + +- [ ] **Step 1: Start docker dev stack (pick a free port)** + +```bash +cd /Users/pv/code/beebeebike +cp -R data .claude/worktrees/silly-roentgen-26bbf9/data +cd .claude/worktrees/silly-roentgen-26bbf9 +VITE_DEV_PORT=5273 docker compose -f compose.yml -f compose.dev.yml up -d +``` + +Expected: backend, db, graphhopper, tiles all healthy (`docker ps` shows 4 containers up). + +- [ ] **Step 2: Run the mobile app on iPhone 17 Pro simulator** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9/mobile +flutter run -d 8BFDF915-79EA-43B2-B5D6-E2E81976A84B +``` + +Expected: app launches, map shows Berlin. + +- [ ] **Step 3: Set simulator location to Berlin** + +In Simulator menu: Features → Location → Custom Location → `52.5200, 13.4050`. + +- [ ] **Step 4: Walk through the full flow and check each assertion** + +| Action | Expected | +|---|---| +| Tap a destination on map | Route polyline appears, bottom card shows minutes/km | +| Tap Start | Navigation screen opens; map initially at origin, zoom 17, north-up | +| Wait 1–2s | Map snaps to user location, heading-up tracking engaged, `trackingCompass` puck visible | +| Pinch zoom out to ~14 | Recenter FAB appears bottom-right | +| Pan map | FAB still visible | +| Tap FAB | Camera animates to user at zoom 14 (your pinched zoom preserved); FAB disappears | +| Simulator → Features → Location → City Run | User puck moves, map heading rotates | +| Simulator → Features → Location → Custom Location → set far from route (e.g. `52.6, 13.5`) | "Rerouting…" toast appears; after ~1–2s new polyline replaces old; toast disappears | +| Set Custom Location near the destination to trigger arrival | Arrived sheet replaces ETA sheet; map zooms to destination at zoom 17, north-up | +| Tap Done | Returns to map screen | + +- [ ] **Step 5: Stop the stack** + +```bash +cd /Users/pv/code/beebeebike/.claude/worktrees/silly-roentgen-26bbf9 +docker compose -f compose.yml -f compose.dev.yml down +``` + +- [ ] **Step 6: Final test run** + +```bash +cd mobile && flutter test +``` + +Expected: all tests green. + +--- + +## Out of Scope (from spec) + +- 3D tilt / pitched perspective +- Speed-adaptive zoom +- Auto-recenter timeout +- Cancel-confirmation dialog +- Trip-summary screen post-arrival +- GPS-course-based heading (vs device compass) +- TTS mute wiring to ferrostar +- Off-route visual beyond the toast diff --git a/docs/superpowers/specs/2026-04-18-navigation-camera-lifecycle-design.md b/docs/superpowers/specs/2026-04-18-navigation-camera-lifecycle-design.md new file mode 100644 index 0000000..765ee85 --- /dev/null +++ b/docs/superpowers/specs/2026-04-18-navigation-camera-lifecycle-design.md @@ -0,0 +1,199 @@ +# Navigation Camera Lifecycle — Design + +## Goal + +Make the map on `NavigationScreen` behave like a real turn-by-turn navigation view: fly to the rider on Start, follow heading while moving, yield to user pan/pinch/rotate without fighting them, offer a recenter button to re-engage follow, and react sensibly to off-route, reroute, and arrival. + +## Problem + +Current `NavigationScreen` ([mobile/lib/screens/navigation_screen.dart](../../../mobile/lib/screens/navigation_screen.dart)): + +- Sets `myLocationTrackingMode: MyLocationTrackingMode.trackingCompass` once and never re-engages it. +- Loads with `initialCameraPosition: LatLng(52.5200, 13.4050), zoom: 15` — Berlin centroid, not the route. +- Never reacts to `onCameraTrackingDismissed` (the maplibre callback that fires when the user pans). +- No recenter UI. +- No special handling of `NavigationState.status == complete` (arrival) or `isOffRoute` (reroute). +- The existing `NavigationCameraController` ([mobile/lib/navigation/camera_controller.dart](../../../mobile/lib/navigation/camera_controller.dart)) is a 3-method stub with a `followMode` bool, not wired to anything. + +Effect: on Start the map sits over Berlin centroid until first GPS fix triggers tracking; user pan permanently breaks tracking with no way to recover; on arrival nothing visually changes. + +## Design Decisions (from brainstorming) + +| Q | Choice | Rationale | +|---|---|---| +| Q1 — follow style | **2D heading-up** (`MyLocationTrackingMode.trackingCompass`) | Matches platform default; no per-tick `animateCamera` cost; standard cyclist-nav view | +| Q2 — zoom | **Fixed default 17, preserved across recenter** | If user pinches to 14 then pans, recenter restores 14 | +| Q3 — recenter button | **Hidden when following, shown when broken; no auto-timeout** | No surprise auto-jumps mid-glance | +| Q4 — arrival | **Stop following, zoom to destination at z17, show Arrived sheet** | Destination is what matters at moment of arrival | +| Q5 — reroute | **"Rerouting…" toast during fetch, silent polyline swap, camera unchanged** | Feedback without yanking camera | +| Q6 — cancel (X) | **No confirm, just `Navigator.pop`** | Current behavior; user accepts accidental-tap risk for v1 | +| Q7 — pre-first-fix | **Static at origin pin, zoom 17, north-up; snap to follow on first fix** | Predictable starting view | + +## State Machine + +Five states for the navigation map camera. Implemented in `NavigationCameraController`. + +| State | Entry trigger | Camera behavior | Recenter FAB | +|---|---|---|---| +| `awaitingFirstFix` | Screen `initState` | Static at origin, zoom 17, bearing 0, pitch 0 | hidden | +| `following` | First non-null `navState.snappedLocation` OR recenter tapped | `MyLocationTrackingMode.trackingCompass` at `_followZoom` | hidden | +| `free` | maplibre fires `onCameraTrackingDismissed` | User-controlled (no tracking) | **shown** | +| `arrived` | `NavigationState.status == complete` | Static at destination, zoom 17, bearing 0 | hidden | + +`rerouting` is **not** a state — it's a cross-cutting overlay (`navState.isOffRoute == true`) that shows a toast without changing camera state. + +### Transitions + +``` +awaitingFirstFix --first snappedLocation--> following +following --user pan/pinch--> free +free --tap recenter--> following +any --status==complete--> arrived +arrived --(no exit; user taps Done → pop screen) +``` + +**Idempotency:** +- `onFirstFix` called twice: only first triggers transition; second is a no-op. +- `onArrived` from `arrived`: no-op. +- `onTrackingDismissed` while in `awaitingFirstFix` or `arrived`: no-op (no tracking was active). +- `onRecenterTapped` while in `following`: no-op. + +## Zoom Preservation + +`NavigationCameraController.followZoom` defaults to **17.0**. Updated in `free` state via `onZoomChanged(double z)`, which `NavigationScreen` calls from the `MapLibreMap.onCameraIdle` callback (passing `cameraPosition.zoom`). On recenter, `NavigationScreen` calls `mapController.animateCamera(CameraUpdate.newLatLngZoom(user, cam.followZoom))` then `updateMyLocationTrackingMode(trackingCompass)`. + +`onZoomChanged` is gated to only mutate `followZoom` when `mode == free`. This avoids capturing the bearing/zoom drift that maplibre may report during `trackingCompass`-mode location updates. + +## Event Handler Table + +| Event | Source | What `NavigationScreen` does | +|---|---|---| +| First fix (`navState.snappedLocation` first non-null) | `navigationStateProvider` (`ref.listen`) | If `cam.mode == awaitingFirstFix`: `cam.onFirstFix()`; `mapController.animateCamera(CameraUpdate.newLatLngZoom(snapped, cam.followZoom))`; `mapController.updateMyLocationTrackingMode(trackingCompass)` | +| `onCameraTrackingDismissed` | maplibre callback | `cam.onTrackingDismissed()`; `setState` (FAB visibility) | +| `onCameraIdle` | maplibre callback | `cam.onZoomChanged(_mapController.cameraPosition?.zoom)` | +| Recenter FAB tap | UI | If user location known: `cam.onRecenterTapped()`; `animateCamera(...)`; `updateMyLocationTrackingMode(trackingCompass)`; `setState` | +| `navState.isOffRoute → true` | `navigationStateProvider` (`ref.listen`) | `setState(_rerouting = true)` (toast visible). Camera untouched. | +| `navState.isOffRoute → false` | provider | `setState(_rerouting = false)` (toast gone). Polyline already swapped by `RouteOverlay.replace`. | +| `navState.status → complete` | provider | `cam.onArrived()`; `mapController.updateMyLocationTrackingMode(none)`; `animateCamera(destination, 17)`; `setState` (arrived sheet replaces ETA sheet) | +| Cancel (X) tap | UI | `Navigator.pop(context)` (no confirm; v1) | +| Route polyline replaced | `replaceRoute` from `NavigationService.deviationStream` handler | `RouteOverlay.replace(newPreview)` redraws line; camera untouched | + +## Component Breakdown + +### Modified: `mobile/lib/navigation/camera_controller.dart` + +Replace stub with state machine. Pure Dart, no Flutter import → fast unit tests. + +```dart +enum CameraMode { awaitingFirstFix, following, free, arrived } + +class NavigationCameraController { + CameraMode _mode = CameraMode.awaitingFirstFix; + double _followZoom = 17.0; + + CameraMode get mode => _mode; + double get followZoom => _followZoom; + + void onFirstFix() { + if (_mode == CameraMode.awaitingFirstFix) _mode = CameraMode.following; + } + + void onTrackingDismissed() { + if (_mode == CameraMode.following) _mode = CameraMode.free; + } + + void onZoomChanged(double z) { + if (_mode == CameraMode.free) _followZoom = z; + } + + void onRecenterTapped() { + if (_mode == CameraMode.free) _mode = CameraMode.following; + } + + void onArrived() { + if (_mode != CameraMode.arrived) _mode = CameraMode.arrived; + } +} +``` + +### Modified: `mobile/lib/screens/navigation_screen.dart` + +Owns `MapLibreMapController`, `NavigationCameraController`, navigation-state listener for first-fix / reroute / arrival. Wires: + +- `MapLibreMap.initialCameraPosition`: origin from `routeControllerProvider.origin`, zoom 17, bearing 0 +- `MapLibreMap.myLocationTrackingMode`: starts as `none`; flipped to `trackingCompass` after first fix +- `onMapCreated`: store controller, draw route via `RouteOverlay.draw` +- `onCameraTrackingDismissed`: `_cam.onTrackingDismissed(); setState(() {})` +- `onCameraIdle`: `_cam.onZoomChanged(_mapController!.cameraPosition?.zoom ?? _cam.followZoom)` +- `ref.listen(navigationStateProvider, (prev, next) {...})` handles first-fix (`prev.snappedLocation == null && next.snappedLocation != null`), `isOffRoute` toggle, and `status == complete` +- Recenter FAB shown iff `_cam.mode == CameraMode.free`, positioned bottom-right above bottom sheet + +### New: `mobile/lib/widgets/recenter_fab.dart` + +Small stateless widget: circular icon button with `Icons.my_location`, calls `onTap`. Positioned by parent. + +### New: `mobile/lib/widgets/rerouting_toast.dart` + +Small stateless widget: pill shown below `TurnBanner`, semi-transparent background, "Rerouting…" text + small spinner. Positioned by parent. + +### New: `mobile/lib/widgets/arrived_sheet.dart` + +Replaces ETA bottom sheet content when `_cam.mode == arrived`. Layout: "Arrived" headline, optional address (skip in v1), `Done` button → `Navigator.pop(context)`. + +## Tests + +### Unit (`mobile/test/navigation/camera_controller_test.dart`) + +Pure Dart, no maplibre. Covers: +- `onFirstFix` flips `awaitingFirstFix → following`; second call is a no-op (stays `following`) +- `onTrackingDismissed` only flips `following → free`; from `awaitingFirstFix` or `arrived`: no-op +- `onZoomChanged` mutates `followZoom` iff `mode == free`; in `following`/`awaitingFirstFix`/`arrived`: ignored +- `onRecenterTapped` flips `free → following`; from any other state: no-op +- `onArrived` flips any state → `arrived`; second call: no-op +- Default `followZoom == 17.0` + +### Widget (`mobile/test/screens/navigation_screen_lifecycle_test.dart`) + +Riverpod overrides: fake `navigationServiceProvider` exposing a controllable `StreamController`; `mapStyleProvider` returns `'{}'`. `MapLibreMap` is a no-op platform view in widget tests, so we cannot assert real camera moves. Asserts: + +- Recenter FAB hidden initially (`awaitingFirstFix`) +- After firing the camera controller's `onTrackingDismissed` directly via a test seam (an `@visibleForTesting` getter on the screen state that exposes the controller), FAB visible +- Tap FAB → FAB hidden +- Pump fake `NavigationState(status: complete, ...)` into the stream → Arrived sheet visible, ETA hidden +- Tap Done → `Navigator.pop` invoked (verify with a route observer) +- Pump fake `NavigationState(isOffRoute: true, ...)` → "Rerouting…" toast visible +- Pump fake `NavigationState(isOffRoute: false, ...)` → toast gone + +### Integration (manual, on iOS sim) + +End-to-end walkthrough below, executed against the docker dev stack. + +## Verification + +After implementation: + +1. Start docker stack: `cd /Users/pv/code/beebeebike && cp -R data .claude/worktrees/silly-roentgen-26bbf9/data && cd .claude/worktrees/silly-roentgen-26bbf9 && VITE_DEV_PORT=5273 docker compose -f compose.yml -f compose.dev.yml up -d` +2. `cd mobile && flutter run -d 8BFDF915-79EA-43B2-B5D6-E2E81976A84B` (iPhone 17 Pro sim) +3. iOS Simulator → Features → Location → Custom Location → set to Berlin (e.g. 52.52, 13.405) +4. In-app: + - Tap a destination on map → preview appears → tap Start + - Navigation screen opens; map shows origin at zoom 17 briefly, then snaps to user location with heading-up tracking once ferrostar emits first `snappedLocation` (within ~1s on sim) + - Pinch to zoom out → recenter FAB appears + - Drag map → still in `free`, FAB still visible + - Tap FAB → camera animates back to user, follow re-engaged at the zoom you pinched to (e.g. if pinched to 14, recenter restores 14) + - In Simulator → Features → Location → Freeway Drive (or City Run) → user puck moves and map heading rotates + - Take user off-route (Custom Location away from route) → "Rerouting…" toast appears; after ~1-2s new polyline replaces old; toast disappears + - Use a short route and let user reach destination → Arrived sheet replaces ETA sheet; map zooms to destination at z17; tap Done → pops back to map screen +5. `cd mobile && flutter test` → all green (existing 29 + new unit + new widget tests) + +## Out of Scope (Followups) + +- 3D tilt / pitched perspective camera +- Speed-adaptive zoom +- Auto-recenter timeout +- Cancel-confirmation dialog +- Trip-summary screen post-arrival (full-route fit) +- GPS course (`UserLocation.courseDeg`) as bearing source instead of device compass — handlebar-mount problem; revisit on real bike +- TTS mute wiring to ferrostar (still TODO from prior plan) +- Off-route visual treatment beyond the toast (e.g. dim old route) +- Pre-fetch reroute (current code reroutes on `deviationStream` event from ferrostar; latency = network) diff --git a/mobile/.gitignore b/mobile/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/mobile/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/mobile/.metadata b/mobile/.metadata new file mode 100644 index 0000000..ad0e577 --- /dev/null +++ b/mobile/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "db50e20168db8fee486b9abf32fc912de3bc5b6a" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a + base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a + - platform: ios + create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a + base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/mobile/README.md b/mobile/README.md new file mode 100644 index 0000000..dd7e57d --- /dev/null +++ b/mobile/README.md @@ -0,0 +1,18 @@ +# BeeBeeBike mobile + +> **Platform support:** iOS only (v0.1). Android support will be added once `ferrostar_flutter` gains Android bindings. + +Run locally on iOS simulator: + +```bash +flutter pub get +flutter run -d ios \ + --dart-define=BEEBEEBIKE_API_BASE_URL=http://127.0.0.1:3000 \ + --dart-define=BEEBEEBIKE_TILE_STYLE_URL=http://127.0.0.1:8080/tiles/assets/styles/colorful/style.json +``` + +Run tests: + +```bash +flutter test +``` diff --git a/mobile/analysis_options.yaml b/mobile/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/mobile/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/mobile/assets/styles/beebeebike-style.json b/mobile/assets/styles/beebeebike-style.json new file mode 100644 index 0000000..9d7acc7 --- /dev/null +++ b/mobile/assets/styles/beebeebike-style.json @@ -0,0 +1,17656 @@ +{ + "version": 8, + "name": "beebeebike-bicycle-planning", + "metadata": { + "license": "https://creativecommons.org/publicdomain/zero/1.0/" + }, + "glyphs": "{{TILE_BASE}}/assets/glyphs/{fontstack}/{range}.pbf", + "sprite": [ + { + "id": "basics", + "url": "{{TILE_BASE}}/assets/sprites/basics/sprites" + } + ], + "sources": { + "versatiles-shortbread": { + "attribution": "© OpenStreetMap contributors", + "tiles": [ + "{{TILE_BASE}}/tiles/osm/{z}/{x}/{y}" + ], + "type": "vector", + "scheme": "xyz", + "bounds": [ + -180, + -85.0511287798066, + 180, + 85.0511287798066 + ], + "minzoom": 0, + "maxzoom": 14 + } + }, + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "rgb(248,244,236)" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-ocean", + "type": "fill", + "source-layer": "ocean", + "paint": { + "fill-color": "rgb(184,220,239)" + } + }, + { + "source": "versatiles-shortbread", + "id": "land-glacier", + "type": "fill", + "source-layer": "water_polygons", + "filter": [ + "all", + [ + "==", + "kind", + "glacier" + ] + ], + "paint": { + "fill-color": "rgb(255,255,255)" + } + }, + { + "source": "versatiles-shortbread", + "id": "land-commercial", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "commercial", + "retail" + ] + ], + "paint": { + "fill-color": "rgba(247,222,237,0.251)", + "fill-opacity": { + "stops": [ + [ + 10, + 0 + ], + [ + 11, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-industrial", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "industrial", + "quarry", + "railway" + ] + ], + "paint": { + "fill-color": "rgba(255,244,194,0.333)", + "fill-opacity": { + "stops": [ + [ + 10, + 0 + ], + [ + 11, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-residential", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "garages", + "residential" + ] + ], + "paint": { + "fill-color": "rgba(234,230,225,0.2)", + "fill-opacity": { + "stops": [ + [ + 10, + 0 + ], + [ + 11, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-agriculture", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "brownfield", + "farmland", + "farmyard", + "greenfield", + "greenhouse_horticulture", + "orchard", + "plant_nursery", + "vineyard" + ] + ], + "paint": { + "fill-color": "rgb(240,231,209)", + "fill-opacity": { + "stops": [ + [ + 10, + 0 + ], + [ + 11, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-waste", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "landfill" + ] + ], + "paint": { + "fill-color": "rgb(219,214,189)", + "fill-opacity": { + "stops": [ + [ + 10, + 0 + ], + [ + 11, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-park", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "park", + "village_green", + "recreation_ground" + ] + ], + "paint": { + "fill-color": "rgb(207,231,188)", + "fill-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-garden", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "allotments", + "garden" + ] + ], + "paint": { + "fill-color": "rgb(207,231,188)", + "fill-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-burial", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "cemetery", + "grave_yard" + ] + ], + "paint": { + "fill-color": "rgb(221,219,202)", + "fill-opacity": { + "stops": [ + [ + 13, + 0 + ], + [ + 14, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-leisure", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "miniature_golf", + "playground", + "golf_course" + ] + ], + "paint": { + "fill-color": "rgb(207,231,188)" + } + }, + { + "source": "versatiles-shortbread", + "id": "land-rock", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "bare_rock", + "scree", + "shingle" + ] + ], + "paint": { + "fill-color": "rgb(224,228,229)" + } + }, + { + "source": "versatiles-shortbread", + "id": "land-forest", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "forest" + ] + ], + "paint": { + "fill-color": "rgb(159,198,134)", + "fill-opacity": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 0.1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-grass", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "grass", + "grassland", + "meadow", + "wet_meadow" + ] + ], + "paint": { + "fill-color": "rgb(220,236,204)", + "fill-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-vegetation", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "heath", + "scrub" + ] + ], + "paint": { + "fill-color": "rgb(207,231,188)", + "fill-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "land-sand", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "beach", + "sand" + ] + ], + "paint": { + "fill-color": "rgb(250,250,237)" + } + }, + { + "source": "versatiles-shortbread", + "id": "land-wetland", + "type": "fill", + "source-layer": "land", + "filter": [ + "all", + [ + "in", + "kind", + "bog", + "marsh", + "string_bog", + "swamp" + ] + ], + "paint": { + "fill-color": "rgb(211,230,219)" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-river", + "type": "line", + "source-layer": "water_lines", + "filter": [ + "all", + [ + "in", + "kind", + "river" + ], + [ + "!=", + "tunnel", + true + ], + [ + "!=", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(184,220,239)", + "line-width": { + "stops": [ + [ + 9, + 0 + ], + [ + 10, + 3 + ], + [ + 15, + 5 + ], + [ + 17, + 9 + ], + [ + 18, + 20 + ], + [ + 20, + 60 + ] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-canal", + "type": "line", + "source-layer": "water_lines", + "filter": [ + "all", + [ + "in", + "kind", + "canal" + ], + [ + "!=", + "tunnel", + true + ], + [ + "!=", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(184,220,239)", + "line-width": { + "stops": [ + [ + 9, + 0 + ], + [ + 10, + 2 + ], + [ + 15, + 4 + ], + [ + 17, + 8 + ], + [ + 18, + 17 + ], + [ + 20, + 50 + ] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-stream", + "type": "line", + "source-layer": "water_lines", + "filter": [ + "all", + [ + "in", + "kind", + "stream" + ], + [ + "!=", + "tunnel", + true + ], + [ + "!=", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(184,220,239)", + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 14, + 1 + ], + [ + 15, + 2 + ], + [ + 17, + 6 + ], + [ + 18, + 12 + ], + [ + 20, + 30 + ] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-ditch", + "type": "line", + "source-layer": "water_lines", + "filter": [ + "all", + [ + "in", + "kind", + "ditch" + ], + [ + "!=", + "tunnel", + true + ], + [ + "!=", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(184,220,239)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 17, + 4 + ], + [ + 18, + 8 + ], + [ + 20, + 20 + ] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-area", + "type": "fill", + "source-layer": "water_polygons", + "filter": [ + "==", + "kind", + "water" + ], + "paint": { + "fill-color": "rgb(184,220,239)", + "fill-opacity": { + "stops": [ + [ + 4, + 0 + ], + [ + 6, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "water-area-river", + "type": "fill", + "source-layer": "water_polygons", + "filter": [ + "==", + "kind", + "river" + ], + "paint": { + "fill-color": "rgb(184,220,239)", + "fill-opacity": { + "stops": [ + [ + 4, + 0 + ], + [ + 6, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "water-area-small", + "type": "fill", + "source-layer": "water_polygons", + "filter": [ + "in", + "kind", + "reservoir", + "basin", + "dock" + ], + "paint": { + "fill-color": "rgb(184,220,239)", + "fill-opacity": { + "stops": [ + [ + 4, + 0 + ], + [ + 6, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "water-dam-area", + "type": "fill", + "source-layer": "dam_polygons", + "filter": [ + "==", + "kind", + "dam" + ], + "paint": { + "fill-color": "rgb(248,244,236)", + "fill-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "water-dam", + "type": "line", + "source-layer": "dam_lines", + "filter": [ + "==", + "kind", + "dam" + ], + "paint": { + "line-color": "rgb(184,220,239)" + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "water-pier-area", + "type": "fill", + "source-layer": "pier_polygons", + "filter": [ + "in", + "kind", + "pier", + "breakwater", + "groyne" + ], + "paint": { + "fill-color": "rgb(248,244,236)", + "fill-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "water-pier", + "type": "line", + "source-layer": "pier_lines", + "filter": [ + "in", + "kind", + "pier", + "breakwater", + "groyne" + ], + "paint": { + "line-color": "rgb(248,244,236)" + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "site-dangerarea", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "danger_area" + ], + "paint": { + "fill-color": "rgb(255,0,0)", + "fill-outline-color": "rgb(255,0,0)", + "fill-opacity": 0.3, + "fill-pattern": "basics:pattern-warning" + } + }, + { + "source": "versatiles-shortbread", + "id": "site-university", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "university" + ], + "paint": { + "fill-color": "rgb(255,255,128)", + "fill-opacity": 0.1 + } + }, + { + "source": "versatiles-shortbread", + "id": "site-college", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "college" + ], + "paint": { + "fill-color": "rgb(255,255,128)", + "fill-opacity": 0.1 + } + }, + { + "source": "versatiles-shortbread", + "id": "site-school", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "school" + ], + "paint": { + "fill-color": "rgb(255,255,128)", + "fill-opacity": 0.1 + } + }, + { + "source": "versatiles-shortbread", + "id": "site-hospital", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "hospital" + ], + "paint": { + "fill-color": "rgb(255,102,102)", + "fill-opacity": 0.1 + } + }, + { + "source": "versatiles-shortbread", + "id": "site-prison", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "prison" + ], + "paint": { + "fill-color": "rgb(253,242,252)", + "fill-pattern": "basics:pattern-striped", + "fill-opacity": 0.1 + } + }, + { + "source": "versatiles-shortbread", + "id": "site-parking", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "parking" + ], + "paint": { + "fill-color": "rgb(235,232,230)" + } + }, + { + "source": "versatiles-shortbread", + "id": "site-bicycleparking", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "bicycle_parking" + ], + "paint": { + "fill-color": "#c9f4e8" + } + }, + { + "source": "versatiles-shortbread", + "id": "site-construction", + "type": "fill", + "source-layer": "sites", + "filter": [ + "in", + "kind", + "construction" + ], + "paint": { + "fill-color": "rgb(169,169,169)", + "fill-pattern": "basics:pattern-hatched_thin", + "fill-opacity": 0.1 + } + }, + { + "source": "versatiles-shortbread", + "id": "airport-area", + "type": "fill", + "source-layer": "street_polygons", + "filter": [ + "in", + "kind", + "runway", + "taxiway" + ], + "paint": { + "fill-color": "rgb(255,253,248)", + "fill-opacity": 0.5 + } + }, + { + "source": "versatiles-shortbread", + "id": "airport-taxiway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "==", + "kind", + "taxiway" + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 14, + 2 + ], + [ + 15, + 10 + ], + [ + 16, + 14 + ], + [ + 18, + 20 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "airport-runway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "==", + "kind", + "runway" + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 6 + ], + [ + 13, + 9 + ], + [ + 14, + 16 + ], + [ + 15, + 24 + ], + [ + 16, + 40 + ], + [ + 17, + 100 + ], + [ + 18, + 160 + ], + [ + 20, + 300 + ] + ] + } + }, + "layout": { + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "airport-taxiway", + "type": "line", + "source-layer": "streets", + "filter": [ + "==", + "kind", + "taxiway" + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 14, + 1 + ], + [ + 15, + 8 + ], + [ + 16, + 12 + ], + [ + 18, + 18 + ], + [ + 20, + 36 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 13, + 0 + ], + [ + 14, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "airport-runway", + "type": "line", + "source-layer": "streets", + "filter": [ + "==", + "kind", + "runway" + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 5 + ], + [ + 13, + 8 + ], + [ + 14, + 14 + ], + [ + 15, + 22 + ], + [ + 16, + 38 + ], + [ + 17, + 98 + ], + [ + 18, + 158 + ], + [ + 20, + 298 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "building:outline", + "type": "fill", + "source-layer": "buildings", + "paint": { + "fill-color": "rgb(216,208,199)", + "fill-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "building", + "type": "fill", + "source-layer": "buildings", + "paint": { + "fill-color": "rgb(238,229,220)", + "fill-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + }, + "fill-translate": [ + -1, + -1 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-pedestrian-zone", + "type": "fill", + "source-layer": "street_polygons", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "==", + "kind", + "pedestrian" + ] + ], + "paint": { + "fill-color": "rgb(247,245,241)", + "fill-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-footway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "hsl(288,13%,86%)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-steps:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "#b8795d", + "line-opacity": 0.7, + "line-dasharray": [ + 0.6, + 0.6 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-path:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "hsl(288,13%,86%)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-cycleway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "hsl(203,11%,87%)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-track:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 14, + 2 + ], + [ + 16, + 4 + ], + [ + 18, + 18 + ], + [ + 19, + 48 + ], + [ + 20, + 96 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-pedestrian:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(228,226,221)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 3 + ], + [ + 18, + 12 + ], + [ + 19, + 32 + ], + [ + 20, + 48 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-livingstreet:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-residential:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-unclassified:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-tertiary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-secondary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-primary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-trunk-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-motorway-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-tertiary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(222,220,216)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-secondary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 11, + 2 + ], + [ + 14, + 5 + ], + [ + 16, + 8 + ], + [ + 18, + 30 + ], + [ + 19, + 68 + ], + [ + 20, + 138 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-primary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ], + [ + 10, + 4 + ], + [ + 14, + 6 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 74 + ], + [ + 20, + 144 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-trunk:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 2 + ], + [ + 10, + 4 + ], + [ + 14, + 6 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 74 + ], + [ + 20, + 144 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-motorway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(210,170,143)", + "line-dasharray": [ + 1, + 0.3 + ], + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 2 + ], + [ + 10, + 5 + ], + [ + 14, + 5 + ], + [ + 16, + 14 + ], + [ + 18, + 38 + ], + [ + 19, + 84 + ], + [ + 20, + 168 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-footway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "hsl(288,33%,94%)", + "line-dasharray": [ + 1, + 0.2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-steps", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "#b8795d", + "line-dasharray": [ + 0.6, + 0.6 + ], + "line-opacity": 0.7 + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-path", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "hsl(288,33%,94%)", + "line-dasharray": [ + 1, + 0.2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-way-cycleway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "hsl(203,30%,95%)", + "line-dasharray": [ + 1, + 0.2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-track", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 3 + ], + [ + 18, + 16 + ], + [ + 19, + 44 + ], + [ + 20, + 88 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-pedestrian", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 2 + ], + [ + 18, + 10 + ], + [ + 19, + 28 + ], + [ + 20, + 40 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-livingstreet", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-residential", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-unclassified", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-track-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)" + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-pedestrian-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-service-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)" + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-livingstreet-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-residential-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-unclassified-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-tertiary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-secondary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-primary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-trunk-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-motorway-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-tertiary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-secondary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 11, + 1 + ], + [ + 14, + 4 + ], + [ + 16, + 6 + ], + [ + 18, + 28 + ], + [ + 19, + 64 + ], + [ + 20, + 130 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-primary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 2 + ], + [ + 10, + 3 + ], + [ + 14, + 5 + ], + [ + 16, + 10 + ], + [ + 18, + 34 + ], + [ + 19, + 70 + ], + [ + 20, + 140 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-trunk", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ], + [ + 10, + 3 + ], + [ + 14, + 5 + ], + [ + 16, + 10 + ], + [ + 18, + 34 + ], + [ + 19, + 70 + ], + [ + 20, + 140 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-street-motorway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,243,225)", + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 1 + ], + [ + 10, + 4 + ], + [ + 14, + 4 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 80 + ], + [ + 20, + 160 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-tram:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "tram" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-narrowgauge:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "narrow_gauge" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-subway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "subway" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(166,184,199)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ], + [ + 15, + 3 + ], + [ + 16, + 3 + ], + [ + 18, + 6 + ], + [ + 19, + 8 + ], + [ + 20, + 10 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 0.5 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-lightrail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 8, + 1 + ], + [ + 13, + 1 + ], + [ + 15, + 1 + ], + [ + 20, + 14 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 0.5 + ] + ] + } + }, + "minzoom": 8 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-lightrail-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 16, + 1 + ], + [ + 20, + 14 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-rail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 8, + 1 + ], + [ + 13, + 1 + ], + [ + 15, + 1 + ], + [ + 20, + 14 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 0.3 + ] + ] + } + }, + "minzoom": 8 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-rail-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 16, + 1 + ], + [ + 20, + 14 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-monorail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "monorail" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-funicular:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "funicular" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-tram", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "tram" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-narrowgauge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "narrow_gauge" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-subway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "subway" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(188,202,213)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ], + [ + 15, + 2 + ], + [ + 16, + 2 + ], + [ + 18, + 5 + ], + [ + 19, + 6 + ], + [ + 20, + 8 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-lightrail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-lightrail-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-rail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 0.3 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-rail-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "has", + "service" + ], + [ + "==", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-monorail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "monorail" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "tunnel-transport-funicular", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "funicular" + ], + [ + "==", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge", + "type": "fill", + "source-layer": "bridges", + "paint": { + "fill-color": "rgb(243,239,231)", + "fill-antialias": true, + "fill-opacity": 0.8 + } + }, + { + "source": "versatiles-shortbread", + "id": "street-pedestrian-zone", + "type": "fill", + "source-layer": "street_polygons", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "==", + "kind", + "pedestrian" + ] + ], + "paint": { + "fill-color": "rgba(251,235,255,0.25)", + "fill-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ], + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "way-footway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "rgb(226,212,230)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "way-steps:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "#b8795d", + "line-opacity": 0.7, + "line-dasharray": [ + 0.6, + 0.6 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "way-path:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "rgb(226,212,230)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "way-cycleway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "rgb(215,224,230)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "street-track:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 14, + 2 + ], + [ + 16, + 4 + ], + [ + 18, + 18 + ], + [ + 19, + 48 + ], + [ + 20, + 96 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-pedestrian:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(228,226,221)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 3 + ], + [ + 18, + 12 + ], + [ + 19, + 32 + ], + [ + 20, + 48 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-livingstreet:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-residential:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-unclassified:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-tertiary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-secondary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "street-primary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "street-trunk-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "street-motorway-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "street-tertiary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(217,214,206)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-secondary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 11, + 2 + ], + [ + 14, + 5 + ], + [ + 16, + 8 + ], + [ + 18, + 30 + ], + [ + 19, + 68 + ], + [ + 20, + 138 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-primary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ], + [ + 10, + 4 + ], + [ + 14, + 6 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 74 + ], + [ + 20, + 144 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-trunk:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 2 + ], + [ + 10, + 4 + ], + [ + 14, + 6 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 74 + ], + [ + 20, + 144 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-motorway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 2 + ], + [ + 10, + 5 + ], + [ + 14, + 5 + ], + [ + 16, + 14 + ], + [ + 18, + 38 + ], + [ + 19, + 84 + ], + [ + 20, + 168 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "way-footway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "rgb(251,235,255)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "way-steps", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "#b8795d", + "line-opacity": 0.7, + "line-dasharray": [ + 0.6, + 0.6 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "way-path", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "rgb(251,235,255)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "way-cycleway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "round" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "rgb(239,249,255)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "street-track", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 3 + ], + [ + 18, + 16 + ], + [ + 19, + 44 + ], + [ + 20, + 88 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-pedestrian", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(251,235,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 0 + ], + [ + 14, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 2 + ], + [ + 18, + 10 + ], + [ + 19, + 28 + ], + [ + 20, + 40 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-livingstreet", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-residential", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-unclassified", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-track-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)" + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-pedestrian-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-service-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)" + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-livingstreet-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-residential-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-unclassified-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-tertiary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-secondary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "street-primary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "street-trunk-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "street-motorway-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "street-tertiary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-secondary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 11, + 1 + ], + [ + 14, + 4 + ], + [ + 16, + 6 + ], + [ + 18, + 28 + ], + [ + 19, + 64 + ], + [ + 20, + 130 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-primary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 2 + ], + [ + 10, + 3 + ], + [ + 14, + 5 + ], + [ + 16, + 10 + ], + [ + 18, + 34 + ], + [ + 19, + 70 + ], + [ + 20, + 140 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-trunk", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ], + [ + 10, + 3 + ], + [ + 14, + 5 + ], + [ + 16, + 10 + ], + [ + 18, + 34 + ], + [ + 19, + 70 + ], + [ + 20, + 140 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "street-motorway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 1 + ], + [ + 10, + 4 + ], + [ + 14, + 4 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 80 + ], + [ + 20, + 160 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-tram:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "tram" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-narrowgauge:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "narrow_gauge" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-subway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "subway" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(166,184,199)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ], + [ + 15, + 3 + ], + [ + 16, + 3 + ], + [ + 18, + 6 + ], + [ + 19, + 8 + ], + [ + 20, + 10 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-lightrail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 8, + 1 + ], + [ + 13, + 1 + ], + [ + 15, + 1 + ], + [ + 20, + 14 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "minzoom": 8 + }, + { + "source": "versatiles-shortbread", + "id": "transport-lightrail-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 16, + 1 + ], + [ + 20, + 14 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "transport-rail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 8, + 1 + ], + [ + 13, + 1 + ], + [ + 15, + 1 + ], + [ + 20, + 14 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ] + ] + } + }, + "minzoom": 8 + }, + { + "source": "versatiles-shortbread", + "id": "transport-rail-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 16, + 1 + ], + [ + 20, + 14 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "transport-monorail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "monorail" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-funicular:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "funicular" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-tram", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "tram" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-narrowgauge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "narrow_gauge" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-subway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "subway" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(188,202,213)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ], + [ + 15, + 2 + ], + [ + 16, + 2 + ], + [ + 18, + 5 + ], + [ + 19, + 6 + ], + [ + 20, + 8 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-lightrail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "transport-lightrail-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "transport-rail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "!has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "transport-rail-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "has", + "service" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "transport-monorail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "monorail" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-funicular", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "funicular" + ], + [ + "!=", + "bridge", + true + ], + [ + "!=", + "tunnel", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "transport-ferry", + "type": "line", + "source-layer": "ferries", + "minzoom": 10, + "paint": { + "line-color": "rgb(166,198,215)", + "line-width": { + "stops": [ + [ + 10, + 1 + ], + [ + 13, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 4 + ], + [ + 17, + 6 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 10, + 0 + ], + [ + 11, + 1 + ] + ] + }, + "line-dasharray": [ + 1, + 1 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-footway:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 7 + ], + [ + 18, + 10 + ], + [ + 19, + 17 + ], + [ + 20, + 31 + ] + ] + } + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-steps:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "#b8795d", + "line-opacity": 0.7, + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 7 + ], + [ + 18, + 10 + ], + [ + 19, + 17 + ], + [ + 20, + 31 + ] + ] + }, + "line-dasharray": [ + 0.6, + 0.6 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-path:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 7 + ], + [ + 18, + 10 + ], + [ + 19, + 17 + ], + [ + 20, + 31 + ] + ] + } + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-cycleway:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 7 + ], + [ + 18, + 10 + ], + [ + 19, + 17 + ], + [ + 20, + 31 + ] + ] + } + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-track:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "bridge", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 25 + ], + [ + 19, + 67 + ], + [ + 20, + 134 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-pedestrian:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "bridge", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 8 + ], + [ + 18, + 36 + ], + [ + 19, + 90 + ], + [ + 20, + 179 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-service:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 25 + ], + [ + 19, + 67 + ], + [ + 20, + 134 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-livingstreet:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "bridge", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 8 + ], + [ + 18, + 36 + ], + [ + 19, + 90 + ], + [ + 20, + 179 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-residential:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "bridge", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 8 + ], + [ + 18, + 36 + ], + [ + 19, + 90 + ], + [ + 20, + 179 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-unclassified:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "bridge", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 8 + ], + [ + 18, + 36 + ], + [ + 19, + 90 + ], + [ + 20, + 179 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-tertiary-link:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 8 + ], + [ + 18, + 36 + ], + [ + 19, + 90 + ], + [ + 20, + 179 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-secondary-link:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 10 + ], + [ + 18, + 20 + ], + [ + 20, + 56 + ] + ] + } + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-primary-link:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 10 + ], + [ + 18, + 20 + ], + [ + 20, + 56 + ] + ] + } + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-trunk-link:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 10 + ], + [ + 18, + 20 + ], + [ + 20, + 56 + ] + ] + } + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-motorway-link:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 10 + ], + [ + 18, + 20 + ], + [ + 20, + 56 + ] + ] + } + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-tertiary:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 12, + 3 + ], + [ + 14, + 4 + ], + [ + 16, + 8 + ], + [ + 18, + 36 + ], + [ + 19, + 90 + ], + [ + 20, + 179 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-secondary:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + }, + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 14, + 7 + ], + [ + 16, + 11 + ], + [ + 18, + 42 + ], + [ + 19, + 95 + ], + [ + 20, + 193 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-primary:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ], + [ + 10, + 6 + ], + [ + 14, + 8 + ], + [ + 16, + 17 + ], + [ + 18, + 50 + ], + [ + 19, + 104 + ], + [ + 20, + 202 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-trunk:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 3 + ], + [ + 10, + 6 + ], + [ + 14, + 8 + ], + [ + 16, + 17 + ], + [ + 18, + 50 + ], + [ + 19, + 104 + ], + [ + 20, + 202 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-motorway:bridge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "rgb(243,239,231)", + "line-opacity": 0.5, + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 3 + ], + [ + 10, + 7 + ], + [ + 14, + 7 + ], + [ + 16, + 20 + ], + [ + 18, + 53 + ], + [ + 19, + 118 + ], + [ + 20, + 235 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-pedestrian-zone", + "type": "fill", + "source-layer": "street_polygons", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "==", + "kind", + "pedestrian" + ] + ], + "paint": { + "fill-color": "rgb(255,253,248)", + "fill-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-footway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "rgb(226,212,230)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-steps:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "#b8795d", + "line-opacity": 0.7, + "line-dasharray": [ + 0.6, + 0.6 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-path:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "rgb(226,212,230)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-cycleway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 19, + 12 + ], + [ + 20, + 22 + ] + ] + }, + "line-color": "rgb(215,224,230)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-track:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 14, + 2 + ], + [ + 16, + 4 + ], + [ + 18, + 18 + ], + [ + 19, + 48 + ], + [ + 20, + 96 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-pedestrian:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(228,226,221)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 3 + ], + [ + 18, + 12 + ], + [ + 19, + 32 + ], + [ + 20, + 48 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-livingstreet:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-residential:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-unclassified:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-tertiary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-secondary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-primary-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-trunk-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-motorway-link:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 7 + ], + [ + 18, + 14 + ], + [ + 20, + 40 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-tertiary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(217,215,211)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 14, + 3 + ], + [ + 16, + 6 + ], + [ + 18, + 26 + ], + [ + 19, + 64 + ], + [ + 20, + 128 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-secondary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 11, + 2 + ], + [ + 14, + 5 + ], + [ + 16, + 8 + ], + [ + 18, + 30 + ], + [ + 19, + 68 + ], + [ + 20, + 138 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-primary:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ], + [ + 10, + 4 + ], + [ + 14, + 6 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 74 + ], + [ + 20, + 144 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-trunk:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 2 + ], + [ + 10, + 4 + ], + [ + 14, + 6 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 74 + ], + [ + 20, + 144 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-motorway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(208,165,137)", + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 2 + ], + [ + 10, + 5 + ], + [ + 14, + 5 + ], + [ + 16, + 14 + ], + [ + 18, + 38 + ], + [ + 19, + 84 + ], + [ + 20, + 168 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-footway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "footway" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "rgb(251,235,255)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-steps", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "steps" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "#b8795d", + "line-opacity": 0.7, + "line-dasharray": [ + 0.6, + 0.6 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-path", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "path" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "rgb(251,235,255)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-way-cycleway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "cycleway" + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 4 + ], + [ + 18, + 6 + ], + [ + 19, + 10 + ], + [ + 20, + 20 + ] + ] + }, + "line-color": "rgb(239,249,255)" + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-track", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 3 + ], + [ + 18, + 16 + ], + [ + 19, + 44 + ], + [ + 20, + 88 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-pedestrian", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(247,245,241)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 16, + 2 + ], + [ + 18, + 10 + ], + [ + 19, + 28 + ], + [ + 20, + 40 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-livingstreet", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-residential", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-unclassified", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-track-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "track" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)" + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-pedestrian-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "pedestrian" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-service-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "service" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)" + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-livingstreet-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "living_street" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-residential-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "residential" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-unclassified-bicycle", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "kind", + "unclassified" + ], + [ + "==", + "bicycle", + "designated" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(239,249,255)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-tertiary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-secondary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-primary-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-trunk-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-motorway-link", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "==", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 12 + ], + [ + 20, + 38 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-tertiary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "tertiary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,253,248)", + "line-width": { + "stops": [ + [ + 12, + 1 + ], + [ + 14, + 2 + ], + [ + 16, + 5 + ], + [ + 18, + 24 + ], + [ + 19, + 60 + ], + [ + 20, + 120 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0 + ], + [ + 13, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-secondary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "secondary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 11, + 1 + ], + [ + 14, + 4 + ], + [ + 16, + 6 + ], + [ + 18, + 28 + ], + [ + 19, + 64 + ], + [ + 20, + 130 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-primary", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "primary" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 2 + ], + [ + 10, + 3 + ], + [ + 14, + 5 + ], + [ + 16, + 10 + ], + [ + 18, + 34 + ], + [ + 19, + 70 + ], + [ + 20, + 140 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-trunk", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "trunk" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ], + [ + 10, + 3 + ], + [ + 14, + 5 + ], + [ + 16, + 10 + ], + [ + 18, + 34 + ], + [ + 19, + 70 + ], + [ + 20, + 140 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-street-motorway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bridge", + true + ], + [ + "in", + "kind", + "motorway" + ], + [ + "!=", + "link", + true + ] + ], + "paint": { + "line-color": "rgb(255,242,222)", + "line-width": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 1 + ], + [ + 10, + 4 + ], + [ + 14, + 4 + ], + [ + 16, + 12 + ], + [ + 18, + 36 + ], + [ + 19, + 80 + ], + [ + 20, + 160 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 5, + 0 + ], + [ + 6, + 1 + ] + ] + } + }, + "layout": { + "line-join": "round", + "line-cap": "butt" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-tram:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "tram" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-narrowgauge:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "narrow_gauge" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-subway:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "subway" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(166,184,199)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ], + [ + 15, + 3 + ], + [ + 16, + 3 + ], + [ + 18, + 6 + ], + [ + 19, + 8 + ], + [ + 20, + 10 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-lightrail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 8, + 1 + ], + [ + 13, + 1 + ], + [ + 15, + 1 + ], + [ + 20, + 14 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ] + ] + } + }, + "minzoom": 8 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-lightrail-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 16, + 1 + ], + [ + 20, + 14 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-rail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 8, + 1 + ], + [ + 13, + 1 + ], + [ + 15, + 1 + ], + [ + 20, + 14 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 8, + 0 + ], + [ + 9, + 1 + ] + ] + } + }, + "minzoom": 8 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-rail-service:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 16, + 1 + ], + [ + 20, + 14 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-monorail:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "monorail" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-funicular:outline", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "funicular" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 15, + "paint": { + "line-color": "rgb(177,187,196)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 5 + ], + [ + 18, + 7 + ], + [ + 20, + 20 + ] + ] + }, + "line-dasharray": [ + 0.1, + 0.5 + ] + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-tram", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "tram" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-narrowgauge", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "narrow_gauge" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-subway", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "subway" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(188,202,213)", + "line-width": { + "stops": [ + [ + 11, + 0 + ], + [ + 12, + 1 + ], + [ + 15, + 2 + ], + [ + 16, + 2 + ], + [ + 18, + 5 + ], + [ + 19, + 6 + ], + [ + 20, + 8 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-lightrail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-lightrail-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "light_rail" + ], + [ + "has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-rail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "!has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ], + "line-opacity": { + "stops": [ + [ + 14, + 0 + ], + [ + 15, + 1 + ] + ] + } + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-rail-service", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "rail" + ], + [ + "has", + "service" + ], + [ + "==", + "bridge", + true + ] + ], + "paint": { + "line-color": "rgb(197,204,211)", + "line-width": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 1 + ], + [ + 20, + 10 + ] + ] + }, + "line-dasharray": [ + 2, + 2 + ] + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-monorail", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "monorail" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "bridge-transport-funicular", + "type": "line", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "funicular" + ], + [ + "==", + "bridge", + true + ] + ], + "minzoom": 13, + "paint": { + "line-width": { + "stops": [ + [ + 13, + 0 + ], + [ + 16, + 1 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ], + [ + 20, + 5 + ] + ] + }, + "line-color": "rgb(177,187,196)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-amenity", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "amenity" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "amenity" + ], + "arts_centre", + "basics:icon-art_gallery", + "atm", + "basics:icon-atm", + "bank", + "basics:icon-bank", + "bar", + "basics:icon-bar", + "bench", + "basics:icon-bench", + "bicycle_rental", + "basics:icon-bicycle_share", + "biergarten", + "basics:icon-beergarden", + "cafe", + "basics:icon-cafe", + "car_rental", + "basics:icon-car_rental", + "car_sharing", + "basics:icon-car_rental", + "car_wash", + "basics:icon-car_wash", + "cinema", + "basics:icon-cinema", + "college", + "basics:icon-college", + "community_centre", + "basics:icon-community", + "dentist", + "basics:icon-dentist", + "doctors", + "basics:icon-doctor", + "dog_park", + "basics:icon-dog_park", + "drinking_water", + "basics:icon-drinking_water", + "embassy", + "basics:icon-embassy", + "fast_food", + "basics:icon-fast_food", + "fire_station", + "basics:icon-fire_station", + "fountain", + "basics:icon-fountain", + "grave_yard", + "basics:icon-cemetery", + "hospital", + "basics:icon-hospital", + "hunting_stand", + "basics:icon-huntingstand", + "library", + "basics:icon-library", + "marketplace", + "basics:icon-marketplace", + "nightclub", + "basics:icon-nightclub", + "nursing_home", + "basics:icon-nursinghome", + "pharmacy", + "basics:icon-pharmacy", + "place_of_worship", + "basics:icon-place_of_worship", + "playground", + "basics:icon-playground", + "police", + "basics:icon-police", + "post_box", + "basics:icon-postbox", + "post_office", + "basics:icon-post", + "prison", + "basics:icon-prison", + "pub", + "basics:icon-beer", + "recycling", + "basics:icon-recycling", + "restaurant", + "basics:icon-restaurant", + "school", + "basics:icon-school", + "shelter", + "basics:icon-shelter", + "telephone", + "basics:icon-telephone", + "theatre", + "basics:icon-theatre", + "toilets", + "basics:icon-toilet", + "townhall", + "basics:icon-town_hall", + "vending_machine", + "basics:icon-vendingmachine", + "veterinary", + "basics:icon-veterinary", + "waste_basket", + "basics:icon-waste_basket", + "" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-leisure", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "leisure" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "leisure" + ], + "golf_course", + "basics:icon-golf", + "ice_rink", + "basics:icon-icerink", + "pitch", + "basics:icon-pitch", + "stadium", + "basics:icon-stadium", + "swimming_pool", + "basics:icon-swimming", + "water_park", + "basics:icon-waterpark", + "basics:icon-sports" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-tourism", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "tourism" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "tourism" + ], + "chalet", + "basics:icon-chalet", + "information", + "basics:transport-information", + "picnic_site", + "basics:icon-picnic_site", + "viewpoint", + "basics:icon-viewpoint", + "zoo", + "basics:icon-zoo", + "" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-shop", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "shop" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "shop" + ], + "alcohol", + "basics:icon-alcohol_shop", + "bakery", + "basics:icon-bakery", + "beauty", + "basics:icon-beauty", + "beverages", + "basics:icon-beverages", + "books", + "basics:icon-books", + "butcher", + "basics:icon-butcher", + "chemist", + "basics:icon-chemist", + "clothes", + "basics:icon-clothes", + "doityourself", + "basics:icon-doityourself", + "dry_cleaning", + "basics:icon-drycleaning", + "florist", + "basics:icon-florist", + "furniture", + "basics:icon-furniture", + "garden_centre", + "basics:icon-garden_centre", + "general", + "basics:icon-shop", + "gift", + "basics:icon-gift", + "greengrocer", + "basics:icon-greengrocer", + "hairdresser", + "basics:icon-hairdresser", + "hardware", + "basics:icon-hardware", + "jewelry", + "basics:icon-jewelry_store", + "kiosk", + "basics:icon-kiosk", + "laundry", + "basics:icon-laundry", + "newsagent", + "basics:icon-newsagent", + "optican", + "basics:icon-optician", + "outdoor", + "basics:icon-outdoor", + "shoes", + "basics:icon-shoes", + "sports", + "basics:icon-sports", + "stationery", + "basics:icon-stationery", + "toys", + "basics:icon-toys", + "travel_agency", + "basics:icon-travel_agent", + "video", + "basics:icon-video", + "basics:icon-shop" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-man_made", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "man_made" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "man_made" + ], + "lighthouse", + "basics:icon-lighthouse", + "surveillance", + "basics:icon-surveillance", + "tower", + "basics:icon-observation_tower", + "watermill", + "basics:icon-watermill", + "windmill", + "basics:icon-windmill", + "" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-historic", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "historic" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "historic" + ], + "artwork", + "basics:icon-artwork", + "castle", + "basics:icon-castle", + "monument", + "basics:icon-monument", + "wayside_shrine", + "basics:icon-shrine", + "basics:icon-historic" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-emergency", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "emergency" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ], + "icon-image": [ + "match", + [ + "get", + "emergency" + ], + "defibrillator", + "basics:icon-defibrillator", + "fire_hydrant", + "basics:icon-hydrant", + "phone", + "basics:icon-emergency_phone", + "" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-highway", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "highway" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "poi-office", + "type": "symbol", + "source-layer": "pois", + "filter": [ + "to-boolean", + [ + "get", + "office" + ] + ], + "minzoom": 16, + "layout": { + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 19, + 0.5 + ], + [ + 20, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-optional": true, + "text-font": [ + "noto_sans_regular" + ] + }, + "paint": { + "icon-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ] + ] + }, + "icon-color": "rgb(85,85,85)", + "text-color": "rgb(85,85,85)" + } + }, + { + "source": "versatiles-shortbread", + "id": "boundary-country:outline", + "type": "line", + "source-layer": "boundaries", + "filter": [ + "all", + [ + "==", + "admin_level", + 2 + ], + [ + "!=", + "maritime", + true + ], + [ + "!=", + "disputed", + true + ], + [ + "!=", + "coastline", + true + ] + ], + "paint": { + "line-color": "rgb(248,245,237)", + "line-blur": 1, + "line-width": { + "stops": [ + [ + 2, + 0 + ], + [ + 3, + 2 + ], + [ + 10, + 8 + ] + ] + }, + "line-opacity": 0.75 + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "boundary-country-disputed:outline", + "type": "line", + "source-layer": "boundaries", + "filter": [ + "all", + [ + "==", + "admin_level", + 2 + ], + [ + "==", + "disputed", + true + ], + [ + "!=", + "maritime", + true + ], + [ + "!=", + "coastline", + true + ] + ], + "paint": { + "line-width": { + "stops": [ + [ + 2, + 0 + ], + [ + 3, + 2 + ], + [ + 10, + 8 + ] + ] + }, + "line-opacity": 0.75, + "line-color": "rgb(248,245,237)" + } + }, + { + "source": "versatiles-shortbread", + "id": "boundary-state:outline", + "type": "line", + "source-layer": "boundaries", + "filter": [ + "all", + [ + "==", + "admin_level", + 4 + ], + [ + "!=", + "maritime", + true + ], + [ + "!=", + "disputed", + true + ], + [ + "!=", + "coastline", + true + ] + ], + "paint": { + "line-color": "rgb(249,245,238)", + "line-blur": 1, + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 2 + ], + [ + 10, + 4 + ] + ] + }, + "line-opacity": 0.75 + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "boundary-country", + "type": "line", + "source-layer": "boundaries", + "filter": [ + "all", + [ + "==", + "admin_level", + 2 + ], + [ + "!=", + "maritime", + true + ], + [ + "!=", + "disputed", + true + ], + [ + "!=", + "coastline", + true + ] + ], + "paint": { + "line-color": "rgb(166,166,200)", + "line-width": { + "stops": [ + [ + 2, + 0 + ], + [ + 3, + 1 + ], + [ + 10, + 4 + ] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "source": "versatiles-shortbread", + "id": "boundary-country-disputed", + "type": "line", + "source-layer": "boundaries", + "filter": [ + "all", + [ + "==", + "admin_level", + 2 + ], + [ + "==", + "disputed", + true + ], + [ + "!=", + "maritime", + true + ], + [ + "!=", + "coastline", + true + ] + ], + "paint": { + "line-width": { + "stops": [ + [ + 2, + 0 + ], + [ + 3, + 1 + ], + [ + 10, + 4 + ] + ] + }, + "line-color": "rgb(190,188,207)", + "line-dasharray": [ + 2, + 1 + ] + }, + "layout": { + "line-cap": "square" + } + }, + { + "source": "versatiles-shortbread", + "id": "boundary-state", + "type": "line", + "source-layer": "boundaries", + "filter": [ + "all", + [ + "==", + "admin_level", + 4 + ], + [ + "!=", + "maritime", + true + ], + [ + "!=", + "disputed", + true + ], + [ + "!=", + "coastline", + true + ] + ], + "paint": { + "line-color": "rgb(166,166,200)", + "line-width": { + "stops": [ + [ + 7, + 0 + ], + [ + 8, + 1 + ], + [ + 10, + 2 + ] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round" + } + }, + { + "id": "bike-cycleway-casing", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "in", + "kind", + "cycleway" + ], + "minzoom": 10, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#edf4ef", + "line-width": { + "stops": [ + [ + 10, + 1 + ], + [ + 13, + 2.5 + ], + [ + 16, + 5 + ], + [ + 19, + 9 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 10, + 0.25 + ], + [ + 13, + 0.42 + ], + [ + 16, + 0.52 + ] + ] + } + } + }, + { + "id": "bike-cycleway", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "in", + "kind", + "cycleway" + ], + "minzoom": 10, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#4f9f91", + "line-width": { + "stops": [ + [ + 10, + 0.5 + ], + [ + 13, + 1.2 + ], + [ + 16, + 2.2 + ], + [ + 19, + 4.5 + ] + ] + }, + "line-opacity": 0.68 + } + }, + { + "id": "bike-designated-casing", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bicycle", + "designated" + ], + [ + "in", + "kind", + "track", + "path", + "pedestrian", + "service" + ] + ], + "minzoom": 12, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#edf4ef", + "line-width": { + "stops": [ + [ + 12, + 0.8 + ], + [ + 15, + 2.2 + ], + [ + 18, + 5 + ], + [ + 20, + 9 + ] + ] + }, + "line-opacity": 0.42 + } + }, + { + "id": "bike-designated", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "bicycle", + "designated" + ], + [ + "in", + "kind", + "track", + "path", + "pedestrian", + "service" + ] + ], + "minzoom": 12, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#6ca77f", + "line-width": { + "stops": [ + [ + 12, + 0.4 + ], + [ + 15, + 1 + ], + [ + 18, + 2 + ], + [ + 20, + 4 + ] + ] + }, + "line-dasharray": [ + 1, + 1.4 + ], + "line-opacity": 0.58 + } + }, + { + "id": "bike-street-corridor-casing", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "living_street", + "residential", + "unclassified", + "tertiary", + "secondary", + "primary" + ], + [ + "in", + "bicycle", + "designated", + "yes", + "permissive", + "optional_sidepath", + "use_sidepath" + ] + ], + "minzoom": 12, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#edf4ef", + "line-width": { + "stops": [ + [ + 12, + 0.8 + ], + [ + 15, + 2.2 + ], + [ + 18, + 5 + ], + [ + 20, + 9 + ] + ] + }, + "line-opacity": { + "stops": [ + [ + 12, + 0.12 + ], + [ + 14, + 0.34 + ] + ] + } + } + }, + { + "id": "bike-street-corridor", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "living_street", + "residential", + "unclassified", + "tertiary", + "secondary", + "primary" + ], + [ + "in", + "bicycle", + "designated", + "yes", + "permissive", + "optional_sidepath", + "use_sidepath" + ] + ], + "minzoom": 12, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#5d9b95", + "line-width": { + "stops": [ + [ + 12, + 0.35 + ], + [ + 15, + 0.9 + ], + [ + 18, + 1.8 + ], + [ + 20, + 3.6 + ] + ] + }, + "line-dasharray": [ + 2.6, + 1.6 + ], + "line-opacity": { + "stops": [ + [ + 12, + 0.22 + ], + [ + 14, + 0.5 + ] + ] + } + } + }, + { + "id": "bike-path-options", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "all", + [ + "in", + "kind", + "path", + "track", + "footway", + "pedestrian" + ], + [ + "in", + "bicycle", + "yes", + "permissive", + "destination" + ] + ], + "minzoom": 14, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#7fa26c", + "line-width": { + "stops": [ + [ + 14, + 0.3 + ], + [ + 16, + 0.7 + ], + [ + 19, + 1.5 + ] + ] + }, + "line-dasharray": [ + 0.6, + 1 + ], + "line-opacity": 0.34 + } + }, + { + "id": "bike-arterial-caution", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "in", + "kind", + "motorway", + "trunk", + "primary" + ], + "minzoom": 12, + "layout": { + "line-cap": "round", + "line-join": "round" + }, + "paint": { + "line-color": "#b8795d", + "line-width": { + "stops": [ + [ + 12, + 0.3 + ], + [ + 15, + 0.7 + ], + [ + 18, + 1.6 + ] + ] + }, + "line-opacity": 0.18 + } + }, + { + "id": "bike-steps-caution", + "type": "line", + "source": "versatiles-shortbread", + "source-layer": "streets", + "filter": [ + "in", + "kind", + "steps" + ], + "minzoom": 15, + "layout": { + "line-cap": "butt", + "line-join": "round" + }, + "paint": { + "line-color": "#b8795d", + "line-width": { + "stops": [ + [ + 15, + 0.9 + ], + [ + 18, + 1.8 + ], + [ + 20, + 3.6 + ] + ] + }, + "line-dasharray": [ + 0.35, + 0.55 + ], + "line-opacity": 0.55 + } + }, + { + "source": "versatiles-shortbread", + "id": "label-address-housenumber", + "type": "symbol", + "source-layer": "addresses", + "filter": [ + "has", + "housenumber" + ], + "layout": { + "text-field": "{housenumber}", + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "point", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 17, + 9.2 + ], + [ + 19, + 11.5 + ] + ] + } + }, + "paint": { + "text-halo-color": "rgb(239,230,222)", + "text-halo-width": 2, + "text-halo-blur": 1, + "icon-color": "rgb(167,160,154)", + "text-color": "rgb(167,160,154)" + }, + "minzoom": 17 + }, + { + "source": "versatiles-shortbread", + "id": "label-motorway-shield", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "motorway" + ], + "layout": { + "text-field": "{ref}", + "text-font": [ + "noto_sans_bold" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 14, + 11.5 + ], + [ + 18, + 13.8 + ], + [ + 20, + 18.4 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(255,255,255)", + "text-color": "rgb(255,255,255)", + "text-halo-color": "rgb(255,242,222)", + "text-halo-width": 0.1, + "text-halo-blur": 1 + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-pedestrian", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "pedestrian" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-livingstreet", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "living_street" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-residential", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "residential" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-unclassified", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "unclassified" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-tertiary", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "tertiary" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-secondary", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "secondary" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-primary", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "primary" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-street-trunk", + "type": "symbol", + "source-layer": "street_labels", + "filter": [ + "==", + "kind", + "trunk" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "symbol-placement": "line", + "text-anchor": "center", + "text-size": { + "stops": [ + [ + 12, + 11.5 + ], + [ + 15, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-neighbourhood", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "neighbourhood" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 14, + 13.8 + ] + ] + }, + "text-transform": "uppercase" + }, + "paint": { + "icon-color": "rgb(40,67,73)", + "text-color": "rgb(40,67,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-quarter", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "quarter" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 13, + 15 + ] + ] + }, + "text-transform": "uppercase" + }, + "paint": { + "icon-color": "rgb(40,62,73)", + "text-color": "rgb(40,62,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-suburb", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "suburb" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 11, + 12.6 + ], + [ + 13, + 16.1 + ] + ] + }, + "text-transform": "uppercase" + }, + "paint": { + "icon-color": "rgb(40,57,73)", + "text-color": "rgb(40,57,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 11 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-hamlet", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "hamlet" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 10, + 12.6 + ], + [ + 12, + 16.1 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(40,48,73)", + "text-color": "rgb(40,48,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-village", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "village" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 9, + 12.6 + ], + [ + 12, + 16.1 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(40,48,73)", + "text-color": "rgb(40,48,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 11 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-town", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "town" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 8, + 12.6 + ], + [ + 12, + 16.1 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(40,48,73)", + "text-color": "rgb(40,48,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 9 + }, + { + "source": "versatiles-shortbread", + "id": "label-boundary-state", + "type": "symbol", + "source-layer": "boundary_labels", + "filter": [ + "in", + "admin_level", + 4, + "4" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-transform": "uppercase", + "text-anchor": "top", + "text-offset": [ + 0, + 0.2 + ], + "text-padding": 0, + "text-optional": true, + "text-size": { + "stops": [ + [ + 5, + 9.2 + ], + [ + 8, + 13.8 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(61,61,77)", + "text-color": "rgb(61,61,77)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 5 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-city", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "city" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 7, + 12.6 + ], + [ + 10, + 16.1 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(40,48,73)", + "text-color": "rgb(40,48,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 7 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-statecapital", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "state_capital" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 6, + 12.6 + ], + [ + 10, + 17.3 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(40,48,73)", + "text-color": "rgb(40,48,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 6 + }, + { + "source": "versatiles-shortbread", + "id": "label-place-capital", + "type": "symbol", + "source-layer": "place_labels", + "filter": [ + "==", + "kind", + "capital" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-size": { + "stops": [ + [ + 5, + 13.8 + ], + [ + 10, + 18.4 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(40,48,73)", + "text-color": "rgb(40,48,73)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 5 + }, + { + "source": "versatiles-shortbread", + "id": "label-boundary-country-small", + "type": "symbol", + "source-layer": "boundary_labels", + "filter": [ + "all", + [ + "in", + "admin_level", + 2, + "2" + ], + [ + "<=", + "way_area", + 10000000 + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-transform": "uppercase", + "text-anchor": "top", + "text-offset": [ + 0, + 0.2 + ], + "text-padding": 0, + "text-optional": true, + "text-size": { + "stops": [ + [ + 4, + 9.2 + ], + [ + 5, + 12.6 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 4 + }, + { + "source": "versatiles-shortbread", + "id": "label-boundary-country-medium", + "type": "symbol", + "source-layer": "boundary_labels", + "filter": [ + "all", + [ + "in", + "admin_level", + 2, + "2" + ], + [ + "<", + "way_area", + 90000000 + ], + [ + ">", + "way_area", + 10000000 + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-transform": "uppercase", + "text-anchor": "top", + "text-offset": [ + 0, + 0.2 + ], + "text-padding": 0, + "text-optional": true, + "text-size": { + "stops": [ + [ + 3, + 9.2 + ], + [ + 5, + 13.8 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 3 + }, + { + "source": "versatiles-shortbread", + "id": "label-boundary-country-large", + "type": "symbol", + "source-layer": "boundary_labels", + "filter": [ + "all", + [ + "in", + "admin_level", + 2, + "2" + ], + [ + ">=", + "way_area", + 90000000 + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "text-font": [ + "noto_sans_regular" + ], + "text-transform": "uppercase", + "text-anchor": "top", + "text-offset": [ + 0, + 0.2 + ], + "text-padding": 0, + "text-optional": true, + "text-size": { + "stops": [ + [ + 2, + 9.2 + ], + [ + 5, + 15 + ] + ] + } + }, + "paint": { + "icon-color": "rgb(51,51,68)", + "text-color": "rgb(51,51,68)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 2 + }, + { + "source": "versatiles-shortbread", + "id": "marking-oneway", + "type": "symbol", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "oneway", + true + ], + [ + "in", + "kind", + "trunk", + "primary", + "secondary", + "tertiary", + "unclassified", + "residential", + "living_street" + ] + ], + "layout": { + "symbol-placement": "line", + "symbol-spacing": 175, + "icon-rotate": 90, + "icon-rotation-alignment": "map", + "icon-padding": 5, + "symbol-avoid-edges": true, + "icon-image": "basics:marking-arrow", + "text-font": [ + "noto_sans_regular" + ] + }, + "minzoom": 16, + "paint": { + "icon-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 0.55 + ], + [ + 20, + 0.55 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ], + [ + 20, + 0.4 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "marking-oneway-reverse", + "type": "symbol", + "source-layer": "streets", + "filter": [ + "all", + [ + "==", + "oneway_reverse", + true + ], + [ + "in", + "kind", + "trunk", + "primary", + "secondary", + "tertiary", + "unclassified", + "residential", + "living_street" + ] + ], + "layout": { + "symbol-placement": "line", + "symbol-spacing": 75, + "icon-rotate": -90, + "icon-rotation-alignment": "map", + "icon-padding": 5, + "symbol-avoid-edges": true, + "icon-image": "basics:marking-arrow", + "text-font": [ + "noto_sans_regular" + ] + }, + "minzoom": 16, + "paint": { + "icon-opacity": { + "stops": [ + [ + 15, + 0 + ], + [ + 16, + 0.55 + ], + [ + 20, + 0.55 + ] + ] + }, + "text-opacity": { + "stops": [ + [ + 16, + 0 + ], + [ + 17, + 0.4 + ], + [ + 20, + 0.4 + ] + ] + } + } + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-bus", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "==", + "kind", + "bus_stop" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 16, + 0.5 + ], + [ + 18, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:icon-bus" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 16 + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-tram", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "==", + "kind", + "tram_stop" + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 15, + 0.5 + ], + [ + 17, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:transport-tram" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 15 + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-subway", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "all", + [ + "in", + "kind", + "station", + "halt" + ], + [ + "==", + "station", + "subway" + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 14, + 0.5 + ], + [ + 16, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:icon-rail_metro" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-lightrail", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "all", + [ + "in", + "kind", + "station", + "halt" + ], + [ + "==", + "station", + "light_rail" + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 14, + 0.5 + ], + [ + 16, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:icon-rail_light" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 14 + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-station", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "all", + [ + "in", + "kind", + "station", + "halt" + ], + [ + "!in", + "station", + "light_rail", + "subway" + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 13, + 0.5 + ], + [ + 15, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:icon-rail" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-airfield", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "all", + [ + "==", + "kind", + "aerodrome" + ], + [ + "!has", + "iata" + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 13, + 0.5 + ], + [ + 15, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:icon-airfield" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 13 + }, + { + "source": "versatiles-shortbread", + "id": "symbol-transit-airport", + "type": "symbol", + "source-layer": "public_transport", + "filter": [ + "all", + [ + "==", + "kind", + "aerodrome" + ], + [ + "has", + "iata" + ] + ], + "layout": { + "text-field": [ + "get", + "name" + ], + "icon-size": { + "stops": [ + [ + 12, + 0.5 + ], + [ + 14, + 1 + ] + ] + }, + "symbol-placement": "point", + "icon-keep-upright": true, + "text-font": [ + "noto_sans_regular" + ], + "text-size": 11.5, + "icon-anchor": "bottom", + "text-anchor": "top", + "icon-image": "basics:icon-airport" + }, + "paint": { + "icon-opacity": 0.7, + "icon-color": "rgb(102,98,106)", + "text-color": "rgb(102,98,106)", + "text-halo-color": "rgba(248,244,236,0.9)", + "text-halo-width": 2, + "text-halo-blur": 1 + }, + "minzoom": 12 + } + ] +} diff --git a/mobile/devtools_options.yaml b/mobile/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/mobile/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/mobile/integration_test/navigation_smoke_test.dart b/mobile/integration_test/navigation_smoke_test.dart new file mode 100644 index 0000000..bcf679c --- /dev/null +++ b/mobile/integration_test/navigation_smoke_test.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:beebeebike/main.dart' as app; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + testWidgets('app launches and renders the map screen', (tester) async { + app.main(); + await tester.pumpAndSettle(const Duration(seconds: 5)); + expect(find.byType(Scaffold), findsWidgets); + }); +} diff --git a/mobile/ios/.gitignore b/mobile/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/mobile/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/mobile/ios/Flutter/AppFrameworkInfo.plist b/mobile/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..391a902 --- /dev/null +++ b/mobile/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/mobile/ios/Flutter/Debug.xcconfig b/mobile/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..c05cdec --- /dev/null +++ b/mobile/ios/Flutter/Debug.xcconfig @@ -0,0 +1,3 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" +IPHONEOS_DEPLOYMENT_TARGET = 16.0 diff --git a/mobile/ios/Flutter/Release.xcconfig b/mobile/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..6549205 --- /dev/null +++ b/mobile/ios/Flutter/Release.xcconfig @@ -0,0 +1,3 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" +IPHONEOS_DEPLOYMENT_TARGET = 16.0 diff --git a/mobile/ios/Podfile b/mobile/ios/Podfile new file mode 100644 index 0000000..fad4db7 --- /dev/null +++ b/mobile/ios/Podfile @@ -0,0 +1,43 @@ +# Uncomment this line to define a global platform for your project +platform :ios, '16.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/mobile/ios/Podfile.lock b/mobile/ios/Podfile.lock new file mode 100644 index 0000000..d41f112 --- /dev/null +++ b/mobile/ios/Podfile.lock @@ -0,0 +1,41 @@ +PODS: + - Flutter (1.0.0) + - flutter_compass (0.0.1): + - Flutter + - flutter_tts (0.0.1): + - Flutter + - MapLibre (6.5.0) + - maplibre_gl (0.0.1): + - Flutter + - MapLibre (= 6.5.0) + +DEPENDENCIES: + - Flutter (from `Flutter`) + - flutter_compass (from `.symlinks/plugins/flutter_compass/ios`) + - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) + - maplibre_gl (from `.symlinks/plugins/maplibre_gl/ios`) + +SPEC REPOS: + trunk: + - MapLibre + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + flutter_compass: + :path: ".symlinks/plugins/flutter_compass/ios" + flutter_tts: + :path: ".symlinks/plugins/flutter_tts/ios" + maplibre_gl: + :path: ".symlinks/plugins/maplibre_gl/ios" + +SPEC CHECKSUMS: + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + flutter_compass: b236ab69b61545cce89fd58527f401a7587d5cc1 + flutter_tts: 35ac3c7d42412733e795ea96ad2d7e05d0a75113 + MapLibre: 0ebfa9329d313cec8bf0a5ba5a336a1dc903785e + maplibre_gl: 7fc8dd5a5f356891c38f227fe1647d33b9af0400 + +PODFILE CHECKSUM: 1857a7cdb7dfafe45f2b0e9a9af44644190f7506 + +COCOAPODS: 1.16.2 diff --git a/mobile/ios/Runner.xcodeproj/project.pbxproj b/mobile/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..cfa42e3 --- /dev/null +++ b/mobile/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,756 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1365634C50D61C31B7BB269D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E3FCCCE288AA206551917432 /* Pods_Runner.framework */; }; + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3F9CB9696122894E0F5131D8 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36124E9C16D3F6B3368E624F /* Pods_RunnerTests.framework */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0139EA31B3B1A9DAB0556C15 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 36124E9C16D3F6B3368E624F /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 53C9043C278BCD9D700D01F5 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7E546997EF087A369C14E38E /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 86ECE60EA7B754F64F4E286D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CE4BD5A3BD42B36D2EEA4180 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + DDC3E047892E49E48C2E2CE5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + E3FCCCE288AA206551917432 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 909B8A53E8D244C93B304E5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3F9CB9696122894E0F5131D8 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, + 1365634C50D61C31B7BB269D /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + AE54F4EFA223AD0FAE7B665E /* Pods */, + D9A6D7561B5AC4273DDB7910 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + AE54F4EFA223AD0FAE7B665E /* Pods */ = { + isa = PBXGroup; + children = ( + 86ECE60EA7B754F64F4E286D /* Pods-Runner.debug.xcconfig */, + DDC3E047892E49E48C2E2CE5 /* Pods-Runner.release.xcconfig */, + CE4BD5A3BD42B36D2EEA4180 /* Pods-Runner.profile.xcconfig */, + 7E546997EF087A369C14E38E /* Pods-RunnerTests.debug.xcconfig */, + 53C9043C278BCD9D700D01F5 /* Pods-RunnerTests.release.xcconfig */, + 0139EA31B3B1A9DAB0556C15 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D9A6D7561B5AC4273DDB7910 /* Frameworks */ = { + isa = PBXGroup; + children = ( + E3FCCCE288AA206551917432 /* Pods_Runner.framework */, + 36124E9C16D3F6B3368E624F /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + E9B596CC76F95CDC9E36F308 /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 909B8A53E8D244C93B304E5E /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + B31BAF8B635EA0525CC57D34 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 046FC92247F286D551060B2B /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 046FC92247F286D551060B2B /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + B31BAF8B635EA0525CC57D34 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + E9B596CC76F95CDC9E36F308 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = land.001.beebeebike; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7E546997EF087A369C14E38E /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = land.001.beebeebike.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 53C9043C278BCD9D700D01F5 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = land.001.beebeebike.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0139EA31B3B1A9DAB0556C15 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = land.001.beebeebike.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = land.001.beebeebike; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = land.001.beebeebike; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/mobile/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/mobile/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/mobile/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..5c20d2e --- /dev/null +++ b/mobile/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,41 @@ +{ + "pins" : [ + { + "identity" : "ferrostar", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stadiamaps/ferrostar", + "state" : { + "revision" : "e6772768d7ff180e1f7ce6e59f8e03518067f14e", + "version" : "0.49.0" + } + }, + { + "identity" : "maplibre-gl-native-distribution", + "kind" : "remoteSourceControl", + "location" : "https://github.com/maplibre/maplibre-gl-native-distribution.git", + "state" : { + "revision" : "e0ee2c11a2859e22d3f0dd29705c18169bdafa7b", + "version" : "6.25.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-syntax.git", + "state" : { + "revision" : "4799286537280063c85a32f09884cfbca301b1a1", + "version" : "602.0.0" + } + }, + { + "identity" : "swiftui-dsl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/maplibre/swiftui-dsl", + "state" : { + "revision" : "139e83d1487f29b42a4f5db2458594170f0ff7e3", + "version" : "0.25.0" + } + } + ], + "version" : 2 +} diff --git a/mobile/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/mobile/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..c3fedb2 --- /dev/null +++ b/mobile/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile/ios/Runner.xcworkspace/contents.xcworkspacedata b/mobile/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/mobile/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/mobile/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mobile/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/mobile/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/mobile/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/mobile/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/mobile/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/mobile/ios/Runner/AppDelegate.swift b/mobile/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..c30b367 --- /dev/null +++ b/mobile/ios/Runner/AppDelegate.swift @@ -0,0 +1,16 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } +} diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/mobile/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/mobile/ios/Runner/Base.lproj/LaunchScreen.storyboard b/mobile/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/mobile/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile/ios/Runner/Base.lproj/Main.storyboard b/mobile/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/mobile/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile/ios/Runner/Info.plist b/mobile/ios/Runner/Info.plist new file mode 100644 index 0000000..13859a4 --- /dev/null +++ b/mobile/ios/Runner/Info.plist @@ -0,0 +1,85 @@ + + + + + CADisableMinimumFrameDurationOnPhone + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsLocalNetworking + + + NSLocationWhenInUseUsageDescription + BeeBeeBike needs your location to navigate your bike route. + NSLocationAlwaysAndWhenInUseUsageDescription + BeeBeeBike needs your location to navigate your bike route, including when the screen is locked. + UIBackgroundModes + + location + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Beebeebike + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + beebeebike + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneConfigurationName + flutter + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/mobile/ios/Runner/Runner-Bridging-Header.h b/mobile/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/mobile/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/mobile/ios/Runner/SceneDelegate.swift b/mobile/ios/Runner/SceneDelegate.swift new file mode 100644 index 0000000..b9ce8ea --- /dev/null +++ b/mobile/ios/Runner/SceneDelegate.swift @@ -0,0 +1,6 @@ +import Flutter +import UIKit + +class SceneDelegate: FlutterSceneDelegate { + +} diff --git a/mobile/ios/RunnerTests/RunnerTests.swift b/mobile/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/mobile/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/mobile/lib/api/auth_api.dart b/mobile/lib/api/auth_api.dart new file mode 100644 index 0000000..7e3c803 --- /dev/null +++ b/mobile/lib/api/auth_api.dart @@ -0,0 +1,37 @@ +import 'package:dio/dio.dart'; + +import '../models/user.dart'; + +class AuthApi { + AuthApi(this._dio); + + final Dio _dio; + + Future anonymous() async => + User.fromJson((await _dio.post('/api/auth/anonymous')).data as Map); + + Future me() async => + User.fromJson((await _dio.get('/api/auth/me')).data as Map); + + Future login(String email, String password) async => User.fromJson( + (await _dio.post('/api/auth/login', data: { + 'email': email, + 'password': password, + })) + .data as Map, + ); + + Future register(String email, String password, String? displayName) async => + User.fromJson( + (await _dio.post('/api/auth/register', data: { + 'email': email, + 'password': password, + 'display_name': displayName, + })) + .data as Map, + ); + + Future logout() async { + await _dio.post('/api/auth/logout'); + } +} diff --git a/mobile/lib/api/client.dart b/mobile/lib/api/client.dart new file mode 100644 index 0000000..41f0456 --- /dev/null +++ b/mobile/lib/api/client.dart @@ -0,0 +1,18 @@ +import 'package:cookie_jar/cookie_jar.dart'; +import 'package:dio/dio.dart'; +import 'package:dio_cookie_manager/dio_cookie_manager.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../app.dart'; + +final dioProvider = Provider((ref) { + final config = ref.watch(appConfigProvider); + final dio = Dio( + BaseOptions( + baseUrl: config.apiBaseUrl, + headers: const {'Content-Type': 'application/json'}, + ), + ); + dio.interceptors.add(CookieManager(CookieJar())); + return dio; +}); diff --git a/mobile/lib/api/geocode_api.dart b/mobile/lib/api/geocode_api.dart new file mode 100644 index 0000000..69b58d6 --- /dev/null +++ b/mobile/lib/api/geocode_api.dart @@ -0,0 +1,35 @@ +import 'package:dio/dio.dart'; + +import '../models/geocode_result.dart'; + +class GeocodeApi { + GeocodeApi(this._dio); + + final Dio _dio; + + Future> search(String query) async { + final response = await _dio.get('/api/geocode', queryParameters: {'q': query}); + final features = (response.data['features'] as List).cast>(); + return features.map((f) { + final props = f['properties'] as Map; + final coords = (f['geometry']?['coordinates'] as List?) ?? [0.0, 0.0]; + final name = (props['name'] as String?) ?? ''; + final parts = [ + if (props['district'] != null) props['district'] as String + else if (props['city'] != null) props['city'] as String, + if (props['osm_value'] != null && + props['osm_value'] != 'yes' && + props['osm_value'] != 'primary' && + props['osm_value'] != 'residential') + (props['osm_value'] as String).replaceAll('_', ' '), + ]; + return GeocodeResult( + id: '${props['osm_type'] ?? 'U'}:${props['osm_id'] ?? '0'}', + name: name, + label: parts.isEmpty ? name : parts.join(' · '), + lng: (coords[0] as num).toDouble(), + lat: (coords[1] as num).toDouble(), + ); + }).toList(); + } +} diff --git a/mobile/lib/api/locations_api.dart b/mobile/lib/api/locations_api.dart new file mode 100644 index 0000000..91468ad --- /dev/null +++ b/mobile/lib/api/locations_api.dart @@ -0,0 +1,34 @@ +import 'package:dio/dio.dart'; + +import '../models/location.dart'; + +class LocationsApi { + LocationsApi(this._dio); + + final Dio _dio; + + Future getHome() async { + try { + final response = await _dio.get('/api/locations/home'); + final data = response.data; + if (data == null) return null; + return Location.fromJson(Map.from(data as Map)); + } on DioException catch (e) { + if (e.response?.statusCode == 404) return null; + rethrow; + } + } + + Future setHome(Location location) async { + final response = await _dio.put('/api/locations/home', data: { + 'label': location.label, + 'lng': location.lng, + 'lat': location.lat, + }); + return Location.fromJson(Map.from(response.data as Map)); + } + + Future deleteHome() async { + await _dio.delete('/api/locations/home'); + } +} diff --git a/mobile/lib/api/ratings_api.dart b/mobile/lib/api/ratings_api.dart new file mode 100644 index 0000000..10ad058 --- /dev/null +++ b/mobile/lib/api/ratings_api.dart @@ -0,0 +1,12 @@ +import 'package:dio/dio.dart'; + +class RatingsApi { + RatingsApi(this._dio); + + final Dio _dio; + + Future> getOverlay(String bbox) async { + final response = await _dio.get('/api/ratings', queryParameters: {'bbox': bbox}); + return Map.from(response.data as Map); + } +} diff --git a/mobile/lib/api/routing_api.dart b/mobile/lib/api/routing_api.dart new file mode 100644 index 0000000..749aed1 --- /dev/null +++ b/mobile/lib/api/routing_api.dart @@ -0,0 +1,39 @@ +import 'package:dio/dio.dart'; + +import '../models/route_preview.dart'; + +class RoutingApi { + RoutingApi(this._dio); + + final Dio _dio; + + Future computeRoute( + List origin, + List destination, { + double? ratingWeight, + double? distanceInfluence, + }) async { + final response = await _dio.post('/api/route', data: { + 'origin': origin, + 'destination': destination, + if (ratingWeight != null) 'rating_weight': ratingWeight, + if (distanceInfluence != null) 'distance_influence': distanceInfluence, + }); + return RoutePreview.fromJson(response.data as Map); + } + + Future> computeNavigationRoute( + List origin, + List destination, { + double? ratingWeight, + double? distanceInfluence, + }) async { + final response = await _dio.post('/api/navigate', data: { + 'origin': origin, + 'destination': destination, + if (ratingWeight != null) 'rating_weight': ratingWeight, + if (distanceInfluence != null) 'distance_influence': distanceInfluence, + }); + return Map.from(response.data as Map); + } +} diff --git a/mobile/lib/app.dart b/mobile/lib/app.dart new file mode 100644 index 0000000..eb46446 --- /dev/null +++ b/mobile/lib/app.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import 'config/app_config.dart'; +import 'providers/auth_provider.dart'; +import 'screens/map_screen.dart'; + +final appConfigProvider = Provider((ref) => AppConfig.fromEnvironment()); + +class BeeBeeBikeApp extends ConsumerWidget { + const BeeBeeBikeApp({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + // Start auth eagerly on the first frame. The anonymous session completes + // in the background; all user-triggered API calls (route, geocode) happen + // after human interaction, giving the session time to settle. + ref.watch(authControllerProvider); + + return MaterialApp( + title: 'BeeBeeBike', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed( + seedColor: const Color(0xFF2E6F66), + brightness: Brightness.light, + ), + scaffoldBackgroundColor: const Color(0xFFF7F3EC), + useMaterial3: true, + ), + home: const MapScreen(), + ); + } +} diff --git a/mobile/lib/config/app_config.dart b/mobile/lib/config/app_config.dart new file mode 100644 index 0000000..45398b7 --- /dev/null +++ b/mobile/lib/config/app_config.dart @@ -0,0 +1,32 @@ +class AppConfig { + const AppConfig({ + required this.apiBaseUrl, + required this.tileServerBaseUrl, + required this.tileStyleUrl, + }); + + final String apiBaseUrl; + final String tileServerBaseUrl; + + /// Test-only: a remote style URL passed straight to `MapLibreMap.styleString`. + /// Production uses `mapStyleProvider`, which loads the bundled style and + /// substitutes [tileServerBaseUrl]. + final String tileStyleUrl; + + factory AppConfig.fromEnvironment() { + return const AppConfig( + apiBaseUrl: String.fromEnvironment( + 'BEEBEEBIKE_API_BASE_URL', + defaultValue: 'http://127.0.0.1:3000', + ), + tileServerBaseUrl: String.fromEnvironment( + 'BEEBEEBIKE_TILE_SERVER_BASE_URL', + defaultValue: 'http://127.0.0.1:8080', + ), + tileStyleUrl: String.fromEnvironment( + 'BEEBEEBIKE_TILE_STYLE_URL', + defaultValue: 'http://127.0.0.1:8080/assets/styles/colorful/style.json', + ), + ); + } +} diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart new file mode 100644 index 0000000..6924d61 --- /dev/null +++ b/mobile/lib/main.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'app.dart'; +import 'config/app_config.dart'; +import 'providers/search_history_provider.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + final prefs = await SharedPreferences.getInstance(); + runApp( + ProviderScope( + overrides: [ + appConfigProvider.overrideWithValue(AppConfig.fromEnvironment()), + sharedPreferencesProvider.overrideWithValue(prefs), + ], + child: const BeeBeeBikeApp(), + ), + ); +} diff --git a/mobile/lib/models/geocode_result.dart b/mobile/lib/models/geocode_result.dart new file mode 100644 index 0000000..41afe39 --- /dev/null +++ b/mobile/lib/models/geocode_result.dart @@ -0,0 +1,18 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'geocode_result.freezed.dart'; +part 'geocode_result.g.dart'; + +@freezed +class GeocodeResult with _$GeocodeResult { + const factory GeocodeResult({ + required String id, + required String name, + required String label, + required double lng, + required double lat, + }) = _GeocodeResult; + + factory GeocodeResult.fromJson(Map json) => + _$GeocodeResultFromJson(json); +} diff --git a/mobile/lib/models/geocode_result.freezed.dart b/mobile/lib/models/geocode_result.freezed.dart new file mode 100644 index 0000000..b17865a --- /dev/null +++ b/mobile/lib/models/geocode_result.freezed.dart @@ -0,0 +1,238 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'geocode_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +GeocodeResult _$GeocodeResultFromJson(Map json) { + return _GeocodeResult.fromJson(json); +} + +/// @nodoc +mixin _$GeocodeResult { + String get id => throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + String get label => throw _privateConstructorUsedError; + double get lng => throw _privateConstructorUsedError; + double get lat => throw _privateConstructorUsedError; + + /// Serializes this GeocodeResult to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of GeocodeResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $GeocodeResultCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GeocodeResultCopyWith<$Res> { + factory $GeocodeResultCopyWith( + GeocodeResult value, $Res Function(GeocodeResult) then) = + _$GeocodeResultCopyWithImpl<$Res, GeocodeResult>; + @useResult + $Res call({String id, String name, String label, double lng, double lat}); +} + +/// @nodoc +class _$GeocodeResultCopyWithImpl<$Res, $Val extends GeocodeResult> + implements $GeocodeResultCopyWith<$Res> { + _$GeocodeResultCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of GeocodeResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? label = null, + Object? lng = null, + Object? lat = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + lng: null == lng + ? _value.lng + : lng // ignore: cast_nullable_to_non_nullable + as double, + lat: null == lat + ? _value.lat + : lat // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GeocodeResultImplCopyWith<$Res> + implements $GeocodeResultCopyWith<$Res> { + factory _$$GeocodeResultImplCopyWith( + _$GeocodeResultImpl value, $Res Function(_$GeocodeResultImpl) then) = + __$$GeocodeResultImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String id, String name, String label, double lng, double lat}); +} + +/// @nodoc +class __$$GeocodeResultImplCopyWithImpl<$Res> + extends _$GeocodeResultCopyWithImpl<$Res, _$GeocodeResultImpl> + implements _$$GeocodeResultImplCopyWith<$Res> { + __$$GeocodeResultImplCopyWithImpl( + _$GeocodeResultImpl _value, $Res Function(_$GeocodeResultImpl) _then) + : super(_value, _then); + + /// Create a copy of GeocodeResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? label = null, + Object? lng = null, + Object? lat = null, + }) { + return _then(_$GeocodeResultImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + lng: null == lng + ? _value.lng + : lng // ignore: cast_nullable_to_non_nullable + as double, + lat: null == lat + ? _value.lat + : lat // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GeocodeResultImpl implements _GeocodeResult { + const _$GeocodeResultImpl( + {required this.id, + required this.name, + required this.label, + required this.lng, + required this.lat}); + + factory _$GeocodeResultImpl.fromJson(Map json) => + _$$GeocodeResultImplFromJson(json); + + @override + final String id; + @override + final String name; + @override + final String label; + @override + final double lng; + @override + final double lat; + + @override + String toString() { + return 'GeocodeResult(id: $id, name: $name, label: $label, lng: $lng, lat: $lat)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GeocodeResultImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.label, label) || other.label == label) && + (identical(other.lng, lng) || other.lng == lng) && + (identical(other.lat, lat) || other.lat == lat)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, label, lng, lat); + + /// Create a copy of GeocodeResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$GeocodeResultImplCopyWith<_$GeocodeResultImpl> get copyWith => + __$$GeocodeResultImplCopyWithImpl<_$GeocodeResultImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GeocodeResultImplToJson( + this, + ); + } +} + +abstract class _GeocodeResult implements GeocodeResult { + const factory _GeocodeResult( + {required final String id, + required final String name, + required final String label, + required final double lng, + required final double lat}) = _$GeocodeResultImpl; + + factory _GeocodeResult.fromJson(Map json) = + _$GeocodeResultImpl.fromJson; + + @override + String get id; + @override + String get name; + @override + String get label; + @override + double get lng; + @override + double get lat; + + /// Create a copy of GeocodeResult + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$GeocodeResultImplCopyWith<_$GeocodeResultImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/mobile/lib/models/geocode_result.g.dart b/mobile/lib/models/geocode_result.g.dart new file mode 100644 index 0000000..ee668ff --- /dev/null +++ b/mobile/lib/models/geocode_result.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'geocode_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GeocodeResultImpl _$$GeocodeResultImplFromJson(Map json) => + _$GeocodeResultImpl( + id: json['id'] as String, + name: json['name'] as String, + label: json['label'] as String, + lng: (json['lng'] as num).toDouble(), + lat: (json['lat'] as num).toDouble(), + ); + +Map _$$GeocodeResultImplToJson(_$GeocodeResultImpl instance) => + { + 'id': instance.id, + 'name': instance.name, + 'label': instance.label, + 'lng': instance.lng, + 'lat': instance.lat, + }; diff --git a/mobile/lib/models/location.dart b/mobile/lib/models/location.dart new file mode 100644 index 0000000..f86fecf --- /dev/null +++ b/mobile/lib/models/location.dart @@ -0,0 +1,17 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'location.freezed.dart'; +part 'location.g.dart'; + +@freezed +class Location with _$Location { + const factory Location({ + required String id, + required String name, + required String label, + required double lng, + required double lat, + }) = _Location; + + factory Location.fromJson(Map json) => _$LocationFromJson(json); +} diff --git a/mobile/lib/models/location.freezed.dart b/mobile/lib/models/location.freezed.dart new file mode 100644 index 0000000..d449664 --- /dev/null +++ b/mobile/lib/models/location.freezed.dart @@ -0,0 +1,237 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'location.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +Location _$LocationFromJson(Map json) { + return _Location.fromJson(json); +} + +/// @nodoc +mixin _$Location { + String get id => throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + String get label => throw _privateConstructorUsedError; + double get lng => throw _privateConstructorUsedError; + double get lat => throw _privateConstructorUsedError; + + /// Serializes this Location to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $LocationCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $LocationCopyWith<$Res> { + factory $LocationCopyWith(Location value, $Res Function(Location) then) = + _$LocationCopyWithImpl<$Res, Location>; + @useResult + $Res call({String id, String name, String label, double lng, double lat}); +} + +/// @nodoc +class _$LocationCopyWithImpl<$Res, $Val extends Location> + implements $LocationCopyWith<$Res> { + _$LocationCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? label = null, + Object? lng = null, + Object? lat = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + lng: null == lng + ? _value.lng + : lng // ignore: cast_nullable_to_non_nullable + as double, + lat: null == lat + ? _value.lat + : lat // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$LocationImplCopyWith<$Res> + implements $LocationCopyWith<$Res> { + factory _$$LocationImplCopyWith( + _$LocationImpl value, $Res Function(_$LocationImpl) then) = + __$$LocationImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String id, String name, String label, double lng, double lat}); +} + +/// @nodoc +class __$$LocationImplCopyWithImpl<$Res> + extends _$LocationCopyWithImpl<$Res, _$LocationImpl> + implements _$$LocationImplCopyWith<$Res> { + __$$LocationImplCopyWithImpl( + _$LocationImpl _value, $Res Function(_$LocationImpl) _then) + : super(_value, _then); + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? label = null, + Object? lng = null, + Object? lat = null, + }) { + return _then(_$LocationImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + lng: null == lng + ? _value.lng + : lng // ignore: cast_nullable_to_non_nullable + as double, + lat: null == lat + ? _value.lat + : lat // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$LocationImpl implements _Location { + const _$LocationImpl( + {required this.id, + required this.name, + required this.label, + required this.lng, + required this.lat}); + + factory _$LocationImpl.fromJson(Map json) => + _$$LocationImplFromJson(json); + + @override + final String id; + @override + final String name; + @override + final String label; + @override + final double lng; + @override + final double lat; + + @override + String toString() { + return 'Location(id: $id, name: $name, label: $label, lng: $lng, lat: $lat)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$LocationImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.label, label) || other.label == label) && + (identical(other.lng, lng) || other.lng == lng) && + (identical(other.lat, lat) || other.lat == lat)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, label, lng, lat); + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$LocationImplCopyWith<_$LocationImpl> get copyWith => + __$$LocationImplCopyWithImpl<_$LocationImpl>(this, _$identity); + + @override + Map toJson() { + return _$$LocationImplToJson( + this, + ); + } +} + +abstract class _Location implements Location { + const factory _Location( + {required final String id, + required final String name, + required final String label, + required final double lng, + required final double lat}) = _$LocationImpl; + + factory _Location.fromJson(Map json) = + _$LocationImpl.fromJson; + + @override + String get id; + @override + String get name; + @override + String get label; + @override + double get lng; + @override + double get lat; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$LocationImplCopyWith<_$LocationImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/mobile/lib/models/location.g.dart b/mobile/lib/models/location.g.dart new file mode 100644 index 0000000..c766bfc --- /dev/null +++ b/mobile/lib/models/location.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'location.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$LocationImpl _$$LocationImplFromJson(Map json) => + _$LocationImpl( + id: json['id'] as String, + name: json['name'] as String, + label: json['label'] as String, + lng: (json['lng'] as num).toDouble(), + lat: (json['lat'] as num).toDouble(), + ); + +Map _$$LocationImplToJson(_$LocationImpl instance) => + { + 'id': instance.id, + 'name': instance.name, + 'label': instance.label, + 'lng': instance.lng, + 'lat': instance.lat, + }; diff --git a/mobile/lib/models/route_preview.dart b/mobile/lib/models/route_preview.dart new file mode 100644 index 0000000..4e6365d --- /dev/null +++ b/mobile/lib/models/route_preview.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'route_preview.freezed.dart'; +part 'route_preview.g.dart'; + +@freezed +class RoutePreview with _$RoutePreview { + const factory RoutePreview({ + required Map geometry, + required double distance, + required double time, + }) = _RoutePreview; + + factory RoutePreview.fromJson(Map json) => + _$RoutePreviewFromJson(json); +} diff --git a/mobile/lib/models/route_preview.freezed.dart b/mobile/lib/models/route_preview.freezed.dart new file mode 100644 index 0000000..3c7209a --- /dev/null +++ b/mobile/lib/models/route_preview.freezed.dart @@ -0,0 +1,211 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'route_preview.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +RoutePreview _$RoutePreviewFromJson(Map json) { + return _RoutePreview.fromJson(json); +} + +/// @nodoc +mixin _$RoutePreview { + Map get geometry => throw _privateConstructorUsedError; + double get distance => throw _privateConstructorUsedError; + double get time => throw _privateConstructorUsedError; + + /// Serializes this RoutePreview to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RoutePreview + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RoutePreviewCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RoutePreviewCopyWith<$Res> { + factory $RoutePreviewCopyWith( + RoutePreview value, $Res Function(RoutePreview) then) = + _$RoutePreviewCopyWithImpl<$Res, RoutePreview>; + @useResult + $Res call({Map geometry, double distance, double time}); +} + +/// @nodoc +class _$RoutePreviewCopyWithImpl<$Res, $Val extends RoutePreview> + implements $RoutePreviewCopyWith<$Res> { + _$RoutePreviewCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RoutePreview + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? geometry = null, + Object? distance = null, + Object? time = null, + }) { + return _then(_value.copyWith( + geometry: null == geometry + ? _value.geometry + : geometry // ignore: cast_nullable_to_non_nullable + as Map, + distance: null == distance + ? _value.distance + : distance // ignore: cast_nullable_to_non_nullable + as double, + time: null == time + ? _value.time + : time // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RoutePreviewImplCopyWith<$Res> + implements $RoutePreviewCopyWith<$Res> { + factory _$$RoutePreviewImplCopyWith( + _$RoutePreviewImpl value, $Res Function(_$RoutePreviewImpl) then) = + __$$RoutePreviewImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({Map geometry, double distance, double time}); +} + +/// @nodoc +class __$$RoutePreviewImplCopyWithImpl<$Res> + extends _$RoutePreviewCopyWithImpl<$Res, _$RoutePreviewImpl> + implements _$$RoutePreviewImplCopyWith<$Res> { + __$$RoutePreviewImplCopyWithImpl( + _$RoutePreviewImpl _value, $Res Function(_$RoutePreviewImpl) _then) + : super(_value, _then); + + /// Create a copy of RoutePreview + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? geometry = null, + Object? distance = null, + Object? time = null, + }) { + return _then(_$RoutePreviewImpl( + geometry: null == geometry + ? _value._geometry + : geometry // ignore: cast_nullable_to_non_nullable + as Map, + distance: null == distance + ? _value.distance + : distance // ignore: cast_nullable_to_non_nullable + as double, + time: null == time + ? _value.time + : time // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RoutePreviewImpl implements _RoutePreview { + const _$RoutePreviewImpl( + {required final Map geometry, + required this.distance, + required this.time}) + : _geometry = geometry; + + factory _$RoutePreviewImpl.fromJson(Map json) => + _$$RoutePreviewImplFromJson(json); + + final Map _geometry; + @override + Map get geometry { + if (_geometry is EqualUnmodifiableMapView) return _geometry; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_geometry); + } + + @override + final double distance; + @override + final double time; + + @override + String toString() { + return 'RoutePreview(geometry: $geometry, distance: $distance, time: $time)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RoutePreviewImpl && + const DeepCollectionEquality().equals(other._geometry, _geometry) && + (identical(other.distance, distance) || + other.distance == distance) && + (identical(other.time, time) || other.time == time)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_geometry), distance, time); + + /// Create a copy of RoutePreview + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RoutePreviewImplCopyWith<_$RoutePreviewImpl> get copyWith => + __$$RoutePreviewImplCopyWithImpl<_$RoutePreviewImpl>(this, _$identity); + + @override + Map toJson() { + return _$$RoutePreviewImplToJson( + this, + ); + } +} + +abstract class _RoutePreview implements RoutePreview { + const factory _RoutePreview( + {required final Map geometry, + required final double distance, + required final double time}) = _$RoutePreviewImpl; + + factory _RoutePreview.fromJson(Map json) = + _$RoutePreviewImpl.fromJson; + + @override + Map get geometry; + @override + double get distance; + @override + double get time; + + /// Create a copy of RoutePreview + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RoutePreviewImplCopyWith<_$RoutePreviewImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/mobile/lib/models/route_preview.g.dart b/mobile/lib/models/route_preview.g.dart new file mode 100644 index 0000000..3c40196 --- /dev/null +++ b/mobile/lib/models/route_preview.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'route_preview.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$RoutePreviewImpl _$$RoutePreviewImplFromJson(Map json) => + _$RoutePreviewImpl( + geometry: json['geometry'] as Map, + distance: (json['distance'] as num).toDouble(), + time: (json['time'] as num).toDouble(), + ); + +Map _$$RoutePreviewImplToJson(_$RoutePreviewImpl instance) => + { + 'geometry': instance.geometry, + 'distance': instance.distance, + 'time': instance.time, + }; diff --git a/mobile/lib/models/route_state.dart b/mobile/lib/models/route_state.dart new file mode 100644 index 0000000..41df446 --- /dev/null +++ b/mobile/lib/models/route_state.dart @@ -0,0 +1,17 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'location.dart'; +import 'route_preview.dart'; + +part 'route_state.freezed.dart'; + +@freezed +class RouteState with _$RouteState { + const factory RouteState({ + Location? origin, + Location? destination, + RoutePreview? preview, + @Default(false) bool isLoading, + String? error, + }) = _RouteState; +} diff --git a/mobile/lib/models/route_state.freezed.dart b/mobile/lib/models/route_state.freezed.dart new file mode 100644 index 0000000..539f620 --- /dev/null +++ b/mobile/lib/models/route_state.freezed.dart @@ -0,0 +1,284 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'route_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +/// @nodoc +mixin _$RouteState { + Location? get origin => throw _privateConstructorUsedError; + Location? get destination => throw _privateConstructorUsedError; + RoutePreview? get preview => throw _privateConstructorUsedError; + bool get isLoading => throw _privateConstructorUsedError; + String? get error => throw _privateConstructorUsedError; + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RouteStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RouteStateCopyWith<$Res> { + factory $RouteStateCopyWith( + RouteState value, $Res Function(RouteState) then) = + _$RouteStateCopyWithImpl<$Res, RouteState>; + @useResult + $Res call( + {Location? origin, + Location? destination, + RoutePreview? preview, + bool isLoading, + String? error}); + + $LocationCopyWith<$Res>? get origin; + $LocationCopyWith<$Res>? get destination; + $RoutePreviewCopyWith<$Res>? get preview; +} + +/// @nodoc +class _$RouteStateCopyWithImpl<$Res, $Val extends RouteState> + implements $RouteStateCopyWith<$Res> { + _$RouteStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? origin = freezed, + Object? destination = freezed, + Object? preview = freezed, + Object? isLoading = null, + Object? error = freezed, + }) { + return _then(_value.copyWith( + origin: freezed == origin + ? _value.origin + : origin // ignore: cast_nullable_to_non_nullable + as Location?, + destination: freezed == destination + ? _value.destination + : destination // ignore: cast_nullable_to_non_nullable + as Location?, + preview: freezed == preview + ? _value.preview + : preview // ignore: cast_nullable_to_non_nullable + as RoutePreview?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $LocationCopyWith<$Res>? get origin { + if (_value.origin == null) { + return null; + } + + return $LocationCopyWith<$Res>(_value.origin!, (value) { + return _then(_value.copyWith(origin: value) as $Val); + }); + } + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $LocationCopyWith<$Res>? get destination { + if (_value.destination == null) { + return null; + } + + return $LocationCopyWith<$Res>(_value.destination!, (value) { + return _then(_value.copyWith(destination: value) as $Val); + }); + } + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $RoutePreviewCopyWith<$Res>? get preview { + if (_value.preview == null) { + return null; + } + + return $RoutePreviewCopyWith<$Res>(_value.preview!, (value) { + return _then(_value.copyWith(preview: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$RouteStateImplCopyWith<$Res> + implements $RouteStateCopyWith<$Res> { + factory _$$RouteStateImplCopyWith( + _$RouteStateImpl value, $Res Function(_$RouteStateImpl) then) = + __$$RouteStateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {Location? origin, + Location? destination, + RoutePreview? preview, + bool isLoading, + String? error}); + + @override + $LocationCopyWith<$Res>? get origin; + @override + $LocationCopyWith<$Res>? get destination; + @override + $RoutePreviewCopyWith<$Res>? get preview; +} + +/// @nodoc +class __$$RouteStateImplCopyWithImpl<$Res> + extends _$RouteStateCopyWithImpl<$Res, _$RouteStateImpl> + implements _$$RouteStateImplCopyWith<$Res> { + __$$RouteStateImplCopyWithImpl( + _$RouteStateImpl _value, $Res Function(_$RouteStateImpl) _then) + : super(_value, _then); + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? origin = freezed, + Object? destination = freezed, + Object? preview = freezed, + Object? isLoading = null, + Object? error = freezed, + }) { + return _then(_$RouteStateImpl( + origin: freezed == origin + ? _value.origin + : origin // ignore: cast_nullable_to_non_nullable + as Location?, + destination: freezed == destination + ? _value.destination + : destination // ignore: cast_nullable_to_non_nullable + as Location?, + preview: freezed == preview + ? _value.preview + : preview // ignore: cast_nullable_to_non_nullable + as RoutePreview?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +class _$RouteStateImpl implements _RouteState { + const _$RouteStateImpl( + {this.origin, + this.destination, + this.preview, + this.isLoading = false, + this.error}); + + @override + final Location? origin; + @override + final Location? destination; + @override + final RoutePreview? preview; + @override + @JsonKey() + final bool isLoading; + @override + final String? error; + + @override + String toString() { + return 'RouteState(origin: $origin, destination: $destination, preview: $preview, isLoading: $isLoading, error: $error)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RouteStateImpl && + (identical(other.origin, origin) || other.origin == origin) && + (identical(other.destination, destination) || + other.destination == destination) && + (identical(other.preview, preview) || other.preview == preview) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading) && + (identical(other.error, error) || other.error == error)); + } + + @override + int get hashCode => + Object.hash(runtimeType, origin, destination, preview, isLoading, error); + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RouteStateImplCopyWith<_$RouteStateImpl> get copyWith => + __$$RouteStateImplCopyWithImpl<_$RouteStateImpl>(this, _$identity); +} + +abstract class _RouteState implements RouteState { + const factory _RouteState( + {final Location? origin, + final Location? destination, + final RoutePreview? preview, + final bool isLoading, + final String? error}) = _$RouteStateImpl; + + @override + Location? get origin; + @override + Location? get destination; + @override + RoutePreview? get preview; + @override + bool get isLoading; + @override + String? get error; + + /// Create a copy of RouteState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RouteStateImplCopyWith<_$RouteStateImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/mobile/lib/models/user.dart b/mobile/lib/models/user.dart new file mode 100644 index 0000000..3f2dd30 --- /dev/null +++ b/mobile/lib/models/user.dart @@ -0,0 +1,17 @@ +// ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'user.freezed.dart'; +part 'user.g.dart'; + +@freezed +class User with _$User { + const factory User({ + required String id, + String? email, + @Default('') @JsonKey(name: 'display_name') String displayName, + @JsonKey(name: 'account_type') required String accountType, + }) = _User; + + factory User.fromJson(Map json) => _$UserFromJson(json); +} diff --git a/mobile/lib/models/user.freezed.dart b/mobile/lib/models/user.freezed.dart new file mode 100644 index 0000000..b4c7e9f --- /dev/null +++ b/mobile/lib/models/user.freezed.dart @@ -0,0 +1,233 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +User _$UserFromJson(Map json) { + return _User.fromJson(json); +} + +/// @nodoc +mixin _$User { + String get id => throw _privateConstructorUsedError; + String? get email => throw _privateConstructorUsedError; + @JsonKey(name: 'display_name') + String get displayName => throw _privateConstructorUsedError; + @JsonKey(name: 'account_type') + String get accountType => throw _privateConstructorUsedError; + + /// Serializes this User to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $UserCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $UserCopyWith<$Res> { + factory $UserCopyWith(User value, $Res Function(User) then) = + _$UserCopyWithImpl<$Res, User>; + @useResult + $Res call( + {String id, + String? email, + @JsonKey(name: 'display_name') String displayName, + @JsonKey(name: 'account_type') String accountType}); +} + +/// @nodoc +class _$UserCopyWithImpl<$Res, $Val extends User> + implements $UserCopyWith<$Res> { + _$UserCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? email = freezed, + Object? displayName = null, + Object? accountType = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + email: freezed == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String?, + displayName: null == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable + as String, + accountType: null == accountType + ? _value.accountType + : accountType // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> { + factory _$$UserImplCopyWith( + _$UserImpl value, $Res Function(_$UserImpl) then) = + __$$UserImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + String? email, + @JsonKey(name: 'display_name') String displayName, + @JsonKey(name: 'account_type') String accountType}); +} + +/// @nodoc +class __$$UserImplCopyWithImpl<$Res> + extends _$UserCopyWithImpl<$Res, _$UserImpl> + implements _$$UserImplCopyWith<$Res> { + __$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then) + : super(_value, _then); + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? email = freezed, + Object? displayName = null, + Object? accountType = null, + }) { + return _then(_$UserImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + email: freezed == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String?, + displayName: null == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable + as String, + accountType: null == accountType + ? _value.accountType + : accountType // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$UserImpl implements _User { + const _$UserImpl( + {required this.id, + this.email, + @JsonKey(name: 'display_name') this.displayName = '', + @JsonKey(name: 'account_type') required this.accountType}); + + factory _$UserImpl.fromJson(Map json) => + _$$UserImplFromJson(json); + + @override + final String id; + @override + final String? email; + @override + @JsonKey(name: 'display_name') + final String displayName; + @override + @JsonKey(name: 'account_type') + final String accountType; + + @override + String toString() { + return 'User(id: $id, email: $email, displayName: $displayName, accountType: $accountType)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$UserImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.email, email) || other.email == email) && + (identical(other.displayName, displayName) || + other.displayName == displayName) && + (identical(other.accountType, accountType) || + other.accountType == accountType)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, id, email, displayName, accountType); + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$UserImplCopyWith<_$UserImpl> get copyWith => + __$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity); + + @override + Map toJson() { + return _$$UserImplToJson( + this, + ); + } +} + +abstract class _User implements User { + const factory _User( + {required final String id, + final String? email, + @JsonKey(name: 'display_name') final String displayName, + @JsonKey(name: 'account_type') required final String accountType}) = + _$UserImpl; + + factory _User.fromJson(Map json) = _$UserImpl.fromJson; + + @override + String get id; + @override + String? get email; + @override + @JsonKey(name: 'display_name') + String get displayName; + @override + @JsonKey(name: 'account_type') + String get accountType; + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$UserImplCopyWith<_$UserImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/mobile/lib/models/user.g.dart b/mobile/lib/models/user.g.dart new file mode 100644 index 0000000..9919663 --- /dev/null +++ b/mobile/lib/models/user.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$UserImpl _$$UserImplFromJson(Map json) => _$UserImpl( + id: json['id'] as String, + email: json['email'] as String?, + displayName: json['display_name'] as String? ?? '', + accountType: json['account_type'] as String, + ); + +Map _$$UserImplToJson(_$UserImpl instance) => + { + 'id': instance.id, + 'email': instance.email, + 'display_name': instance.displayName, + 'account_type': instance.accountType, + }; diff --git a/mobile/lib/navigation/camera_controller.dart b/mobile/lib/navigation/camera_controller.dart new file mode 100644 index 0000000..0a45fbe --- /dev/null +++ b/mobile/lib/navigation/camera_controller.dart @@ -0,0 +1,41 @@ +import 'package:flutter/foundation.dart'; + +enum CameraMode { awaitingFirstFix, following, free, arrived } + +class NavigationCameraController extends ChangeNotifier { + CameraMode _mode = CameraMode.awaitingFirstFix; + double _followZoom = 17.0; + + CameraMode get mode => _mode; + double get followZoom => _followZoom; + + void onFirstFix() { + if (_mode != CameraMode.awaitingFirstFix) return; + _mode = CameraMode.following; + notifyListeners(); + } + + void onTrackingDismissed() { + if (_mode != CameraMode.following) return; + _mode = CameraMode.free; + notifyListeners(); + } + + void onZoomChanged(double zoom) { + if (_mode != CameraMode.free) return; + _followZoom = zoom; + notifyListeners(); + } + + void onRecenterTapped() { + if (_mode != CameraMode.free) return; + _mode = CameraMode.following; + notifyListeners(); + } + + void onArrived() { + if (_mode == CameraMode.arrived) return; + _mode = CameraMode.arrived; + notifyListeners(); + } +} diff --git a/mobile/lib/navigation/location_converter.dart b/mobile/lib/navigation/location_converter.dart new file mode 100644 index 0000000..e1709d6 --- /dev/null +++ b/mobile/lib/navigation/location_converter.dart @@ -0,0 +1,11 @@ +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:geolocator/geolocator.dart'; + +UserLocation positionToUserLocation(Position p) => UserLocation( + lat: p.latitude, + lng: p.longitude, + horizontalAccuracyM: p.accuracy >= 0 ? p.accuracy : 0, + courseDeg: p.heading >= 0 ? p.heading : null, + speedMps: p.speed >= 0 ? p.speed : null, + timestampMs: p.timestamp.millisecondsSinceEpoch, + ); diff --git a/mobile/lib/navigation/maneuver_icons.dart b/mobile/lib/navigation/maneuver_icons.dart new file mode 100644 index 0000000..aba0b87 --- /dev/null +++ b/mobile/lib/navigation/maneuver_icons.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; + +/// Maps a ferrostar maneuver (type + modifier) to a Material icon. +IconData iconForManeuver(String type, String? modifier) { + final mod = modifier?.replaceAll('_', ' '); + if (type == 'turn') { + if (mod == 'left') return Icons.turn_left; + if (mod == 'right') return Icons.turn_right; + if (mod == 'sharp left') return Icons.turn_sharp_left; + if (mod == 'sharp right') return Icons.turn_sharp_right; + if (mod == 'slight left') return Icons.turn_slight_left; + if (mod == 'slight right') return Icons.turn_slight_right; + } + if (type == 'arrive') return Icons.flag; + return Icons.straight; +} + +/// Formats a distance in meters as a human-readable string ("150 m", "1.2 km"). +String formatDistance(double meters) { + if (meters >= 1000) return '${(meters / 1000).toStringAsFixed(1)} km'; + return '${meters.round()} m'; +} + +/// Formats an arrival time + minutes remaining ("14:32 arrival · 12 min"). +String formatEta(int durationRemainingMs) { + final eta = DateTime.now().add(Duration(milliseconds: durationRemainingMs)); + final h = eta.hour.toString().padLeft(2, '0'); + final m = eta.minute.toString().padLeft(2, '0'); + final minRemaining = (durationRemainingMs / 60000).round(); + return '$h:$m arrival · $minRemaining min'; +} diff --git a/mobile/lib/navigation/nav_constants.dart b/mobile/lib/navigation/nav_constants.dart new file mode 100644 index 0000000..3be4507 --- /dev/null +++ b/mobile/lib/navigation/nav_constants.dart @@ -0,0 +1,12 @@ +/// Tuning constants shared between the navigation overlay widgets and +/// the map-screen state machine. Kept in one place so a future sheet / +/// layout change doesn't silently overlap the recenter FAB. +library; + +/// Approximate rendered height of the ETA bottom sheet. Used to offset the +/// RecenterFab so it never overlaps the sheet. +const double kEtaSheetHeight = 140.0; + +/// Zoom used when flying the camera to the destination on arrival. Matches +/// the nav-camera design spec (Q4). +const double kArrivalZoom = 17.0; diff --git a/mobile/lib/navigation/navigation_service.dart b/mobile/lib/navigation/navigation_service.dart new file mode 100644 index 0000000..1e233c5 --- /dev/null +++ b/mobile/lib/navigation/navigation_service.dart @@ -0,0 +1,115 @@ +import 'dart:async'; + +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/foundation.dart'; + +typedef CreateController = Future Function( + Map osrmJson, + List waypoints, +); +typedef LoadNavigationRoute = Future> Function({ + required List origin, + required List destination, +}); +typedef SpeakInstruction = Future Function(String text); +typedef LocationStreamFactory = Stream Function(); + +class NavigationService { + NavigationService({ + required this.createController, + required this.loadNavigationRoute, + required this.locationStreamFactory, + required this.speakInstruction, + }); + + final CreateController createController; + final LoadNavigationRoute loadNavigationRoute; + final LocationStreamFactory locationStreamFactory; + final SpeakInstruction speakInstruction; + + FerrostarController? _controller; + StreamSubscription? _locationSub; + StreamSubscription? _spokenSub; + StreamSubscription? _deviationSub; + StreamSubscription? _stateSub; + WaypointInput? _destination; + bool _rerouteInProgress = false; + + final _stateController = StreamController.broadcast(); + final _rerouteController = StreamController.broadcast(); + + Stream get stateStream => _stateController.stream; + + /// Emits `true` when a reroute starts and `false` when it finishes + /// (success or failure). Consumers should hide UI "rerouting" affordances + /// the moment this flips back to `false`, without waiting on a fresh + /// [NavigationState] (which only arrives on the next GPS update). + Stream get rerouteInProgressStream => _rerouteController.stream; + + Future start({ + required WaypointInput origin, + required WaypointInput destination, + }) async { + await dispose(); + _destination = destination; + final routeJson = await loadNavigationRoute( + origin: [origin.lng, origin.lat], + destination: [destination.lng, destination.lat], + ); + final waypoints = [origin, destination]; + _controller = await createController(routeJson, waypoints); + + _stateSub = _controller!.stateStream.listen( + _stateController.add, + onError: _stateController.addError, + ); + + _spokenSub = _controller!.spokenInstructionStream.listen( + (instruction) { + speakInstruction(instruction.text); + }, + ); + + _deviationSub = _controller!.deviationStream.listen((deviation) async { + if (_rerouteInProgress) return; + _rerouteInProgress = true; + _rerouteController.add(true); + debugPrint( + 'nav: deviation ${deviation.deviationM.toStringAsFixed(0)}m, rerouting'); + try { + final dest = _destination; + final controller = _controller; + if (dest == null || controller == null) return; + final rerouteJson = await loadNavigationRoute( + origin: [deviation.userLocation.lng, deviation.userLocation.lat], + destination: [dest.lng, dest.lat], + ); + if (_controller == null) return; + await controller.replaceRoute(rerouteJson); + } catch (e, st) { + debugPrint('nav: reroute error: $e\n$st'); + } finally { + _rerouteInProgress = false; + _rerouteController.add(false); + } + }); + + _locationSub = locationStreamFactory().listen( + (location) => _controller?.updateLocation(location), + ); + } + + Future dispose() async { + await _locationSub?.cancel(); + await _spokenSub?.cancel(); + await _deviationSub?.cancel(); + await _stateSub?.cancel(); + await _controller?.dispose(); + _locationSub = null; + _spokenSub = null; + _deviationSub = null; + _stateSub = null; + _controller = null; + _rerouteInProgress = false; + } +} diff --git a/mobile/lib/providers/auth_provider.dart b/mobile/lib/providers/auth_provider.dart new file mode 100644 index 0000000..52f7676 --- /dev/null +++ b/mobile/lib/providers/auth_provider.dart @@ -0,0 +1,43 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../api/auth_api.dart'; +import '../api/client.dart'; +import '../models/user.dart'; + +final authApiProvider = Provider((ref) => AuthApi(ref.watch(dioProvider))); + +final authControllerProvider = + AsyncNotifierProvider(AuthController.new); + +class AuthController extends AsyncNotifier { + @override + Future build() async { + final api = ref.read(authApiProvider); + try { + return await api.me(); + } on DioException catch (error) { + if (error.response?.statusCode == 401) { + return api.anonymous(); + } + rethrow; + } + } + + Future login(String email, String password) async { + state = const AsyncLoading(); + state = await AsyncValue.guard(() => ref.read(authApiProvider).login(email, password)); + } + + Future register(String email, String password, String? displayName) async { + state = const AsyncLoading(); + state = await AsyncValue.guard( + () => ref.read(authApiProvider).register(email, password, displayName), + ); + } + + Future logout() async { + await ref.read(authApiProvider).logout(); + state = await AsyncValue.guard(() => ref.read(authApiProvider).anonymous()); + } +} diff --git a/mobile/lib/providers/location_provider.dart b/mobile/lib/providers/location_provider.dart new file mode 100644 index 0000000..349f53a --- /dev/null +++ b/mobile/lib/providers/location_provider.dart @@ -0,0 +1,30 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../api/client.dart'; +import '../api/locations_api.dart'; +import '../models/location.dart'; + +final locationsApiProvider = Provider( + (ref) => LocationsApi(ref.watch(dioProvider)), +); + +final homeLocationProvider = + AsyncNotifierProvider(HomeLocationController.new); + +class HomeLocationController extends AsyncNotifier { + @override + Future build() => ref.read(locationsApiProvider).getHome(); + + Future save(Location location) async { + state = const AsyncLoading(); + state = await AsyncValue.guard(() => ref.read(locationsApiProvider).setHome(location)); + } + + Future clear() async { + state = const AsyncLoading(); + state = await AsyncValue.guard(() async { + await ref.read(locationsApiProvider).deleteHome(); + return null; + }); + } +} diff --git a/mobile/lib/providers/navigation_camera_provider.dart b/mobile/lib/providers/navigation_camera_provider.dart new file mode 100644 index 0000000..51f73bd --- /dev/null +++ b/mobile/lib/providers/navigation_camera_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../navigation/camera_controller.dart'; + +final navigationCameraControllerProvider = + ChangeNotifierProvider.autoDispose((ref) { + final controller = NavigationCameraController(); + return controller; +}); diff --git a/mobile/lib/providers/navigation_provider.dart b/mobile/lib/providers/navigation_provider.dart new file mode 100644 index 0000000..c7b4391 --- /dev/null +++ b/mobile/lib/providers/navigation_provider.dart @@ -0,0 +1,66 @@ +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_tts/flutter_tts.dart'; +import 'package:geolocator/geolocator.dart'; + +import '../api/client.dart'; +import '../api/routing_api.dart'; +import '../navigation/location_converter.dart'; +import '../navigation/navigation_service.dart'; + +Stream _buildLocationStream() async* { + var permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + } + if (permission == LocationPermission.deniedForever || + permission == LocationPermission.denied) { + debugPrint('nav: location permission denied'); + return; + } + yield* Geolocator.getPositionStream( + locationSettings: const LocationSettings( + accuracy: LocationAccuracy.bestForNavigation, + distanceFilter: 0, + ), + ).map(positionToUserLocation); +} + +final flutterTtsProvider = Provider((ref) { + final tts = FlutterTts(); + // Berlin-only v0.1: instruction text is German. + tts.setLanguage('de-DE'); + return tts; +}); + +final navigationServiceProvider = Provider((ref) { + final dio = ref.watch(dioProvider); + final routingApi = RoutingApi(dio); + final tts = ref.watch(flutterTtsProvider); + return NavigationService( + createController: (osrmJson, waypoints) => + FerrostarFlutter.instance.createController( + osrmJson: osrmJson, + waypoints: waypoints, + ), + loadNavigationRoute: ({required origin, required destination}) => + routingApi.computeNavigationRoute(origin, destination), + locationStreamFactory: _buildLocationStream, + speakInstruction: (text) async { + try { + await tts.speak(text); + } catch (e) { + debugPrint('nav: tts error: $e'); + } + }, + ); +}); + +final navigationStateProvider = StreamProvider.autoDispose((ref) { + return ref.watch(navigationServiceProvider).stateStream; +}); + +final rerouteInProgressProvider = StreamProvider.autoDispose((ref) { + return ref.watch(navigationServiceProvider).rerouteInProgressStream; +}); diff --git a/mobile/lib/providers/navigation_session_provider.dart b/mobile/lib/providers/navigation_session_provider.dart new file mode 100644 index 0000000..47745f8 --- /dev/null +++ b/mobile/lib/providers/navigation_session_provider.dart @@ -0,0 +1,7 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +/// Whether the user is currently in an active navigation session. +/// +/// Flipping this flag (instead of pushing a new screen) keeps the single +/// MapLibreMap instance alive across browse ↔ navigate transitions. +final navigationSessionProvider = StateProvider((ref) => false); diff --git a/mobile/lib/providers/route_provider.dart b/mobile/lib/providers/route_provider.dart new file mode 100644 index 0000000..a68c272 --- /dev/null +++ b/mobile/lib/providers/route_provider.dart @@ -0,0 +1,68 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../api/client.dart'; +import '../api/routing_api.dart'; +import '../models/location.dart'; +import '../models/route_preview.dart'; +import '../models/route_state.dart'; + +typedef RoutePreviewLoader = Future Function({ + required Location origin, + required Location destination, +}); + +final routePreviewLoaderProvider = Provider((ref) { + final api = RoutingApi(ref.watch(dioProvider)); + return ({required origin, required destination}) { + return api.computeRoute( + [origin.lng, origin.lat], + [destination.lng, destination.lat], + ratingWeight: 0.5, + distanceInfluence: 70, + ); + }; +}); + +final routeControllerProvider = + NotifierProvider(RouteController.new); + +class RouteController extends Notifier { + @override + RouteState build() => const RouteState(); + + Future setOrigin(Location origin) async { + state = state.copyWith(origin: origin, error: null); + await _maybeLoadPreview(); + } + + Future setDestination(Location destination) async { + state = state.copyWith(destination: destination, error: null); + await _maybeLoadPreview(); + } + + int _loadGeneration = 0; + + Future _maybeLoadPreview() async { + final origin = state.origin; + final destination = state.destination; + if (origin == null || destination == null) return; + + final generation = ++_loadGeneration; + state = state.copyWith(isLoading: true, error: null, preview: null); + try { + final preview = await ref.read(routePreviewLoaderProvider)( + origin: origin, + destination: destination, + ); + if (generation != _loadGeneration) return; + state = state.copyWith(preview: preview, isLoading: false); + } catch (error) { + if (generation != _loadGeneration) return; + state = state.copyWith(isLoading: false, error: error.toString()); + } + } + + void clear() { + state = const RouteState(); + } +} diff --git a/mobile/lib/providers/search_history_provider.dart b/mobile/lib/providers/search_history_provider.dart new file mode 100644 index 0000000..4460261 --- /dev/null +++ b/mobile/lib/providers/search_history_provider.dart @@ -0,0 +1,40 @@ +import 'dart:convert'; + +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../models/location.dart'; + +const _recentSearchesKey = 'beebeebike.recentSearches'; + +final sharedPreferencesProvider = Provider((_) { + throw UnimplementedError('override in main/test'); +}); + +final searchHistoryProvider = + NotifierProvider>(SearchHistoryController.new); + +class SearchHistoryController extends Notifier> { + @override + List build() { + final prefs = ref.read(sharedPreferencesProvider); + final raw = prefs.getStringList(_recentSearchesKey) ?? const []; + return raw + .map((entry) => Location.fromJson(jsonDecode(entry) as Map)) + .toList(); + } + + Future remember(Location location) async { + final next = [ + location, + ...state.where((entry) => entry.id != location.id), + ].take(10).toList(); + state = next; + + final prefs = ref.read(sharedPreferencesProvider); + await prefs.setStringList( + _recentSearchesKey, + next.map((entry) => jsonEncode(entry.toJson())).toList(), + ); + } +} diff --git a/mobile/lib/screens/login_screen.dart b/mobile/lib/screens/login_screen.dart new file mode 100644 index 0000000..58c09b4 --- /dev/null +++ b/mobile/lib/screens/login_screen.dart @@ -0,0 +1,107 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../providers/auth_provider.dart'; + +class LoginScreen extends ConsumerStatefulWidget { + const LoginScreen({super.key}); + + @override + ConsumerState createState() => _LoginScreenState(); +} + +class _LoginScreenState extends ConsumerState { + final _formKey = GlobalKey(); + final _emailController = TextEditingController(); + final _passwordController = TextEditingController(); + bool _loading = false; + String? _error; + + @override + void dispose() { + _emailController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + Future _submit() async { + if (!(_formKey.currentState?.validate() ?? false)) return; + setState(() { + _loading = true; + _error = null; + }); + + await ref.read(authControllerProvider.notifier).login( + _emailController.text.trim(), + _passwordController.text, + ); + + if (!mounted) return; + + final result = ref.read(authControllerProvider); + if (result is AsyncError) { + setState(() { + _error = 'Invalid email or password'; + _loading = false; + }); + } else { + Navigator.of(context).pop(); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Log in')), + body: Padding( + padding: const EdgeInsets.all(24), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + TextFormField( + key: const Key('login_email'), + controller: _emailController, + keyboardType: TextInputType.emailAddress, + decoration: const InputDecoration(labelText: 'Email'), + validator: (v) => + (v == null || v.trim().isEmpty) ? 'Enter your email' : null, + ), + const SizedBox(height: 16), + TextFormField( + key: const Key('login_password'), + controller: _passwordController, + obscureText: true, + decoration: const InputDecoration(labelText: 'Password'), + validator: (v) => + (v == null || v.isEmpty) ? 'Enter your password' : null, + ), + const SizedBox(height: 8), + if (_error != null) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + _error!, + style: TextStyle( + color: Theme.of(context).colorScheme.error), + ), + ), + const SizedBox(height: 16), + FilledButton( + onPressed: _loading ? null : _submit, + child: _loading + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Text('Log in'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/mobile/lib/screens/map_screen.dart b/mobile/lib/screens/map_screen.dart new file mode 100644 index 0000000..ec3ad09 --- /dev/null +++ b/mobile/lib/screens/map_screen.dart @@ -0,0 +1,579 @@ +import 'dart:math' as math; + +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:maplibre_gl/maplibre_gl.dart' hide UserLocation; + +import '../models/geocode_result.dart'; +import '../models/location.dart'; +import '../models/route_preview.dart'; +import '../models/route_state.dart'; +import '../navigation/camera_controller.dart'; +import '../navigation/maneuver_icons.dart'; +import '../navigation/nav_constants.dart'; +import '../providers/navigation_camera_provider.dart'; +import '../providers/navigation_provider.dart'; +import '../providers/navigation_session_provider.dart'; +import '../providers/route_provider.dart'; +import '../screens/search_screen.dart'; +import '../screens/settings_screen.dart'; +import '../services/map_style_loader.dart'; +import '../services/route_drawing.dart'; +import '../widgets/arrived_sheet.dart'; +import '../widgets/eta_sheet.dart'; +import '../widgets/recenter_fab.dart'; +import '../widgets/rerouting_toast.dart'; +import '../widgets/route_summary.dart'; +import '../widgets/search_bar.dart'; +import '../widgets/turn_banner.dart'; + +final _berlinBounds = LatLngBounds( + southwest: const LatLng(52.3, 13.0), + northeast: const LatLng(52.7, 13.8), +); + +class MapScreen extends ConsumerStatefulWidget { + const MapScreen({super.key}); + + @override + ConsumerState createState() => _MapScreenState(); +} + +class _MapScreenState extends ConsumerState { + MapLibreMapController? _mapController; + RouteOverlay? _routeOverlay; + bool _ttsEnabled = true; + bool _rerouting = false; + + Future _handleMapTap(math.Point point, LatLng coords) async { + if (ref.read(navigationSessionProvider)) return; + if (!mounted) return; + final notifier = ref.read(routeControllerProvider.notifier); + if (ref.read(routeControllerProvider).origin == null) { + Position? pos; + try { + pos = await Geolocator.getLastKnownPosition() ?? + await Geolocator.getCurrentPosition(); + } catch (_) {} + if (!mounted) return; + notifier.setOrigin( + Location( + id: 'gps', + name: 'Current location', + label: 'Current location', + lng: pos?.longitude ?? 13.4533, + lat: pos?.latitude ?? 52.5065, + ), + ); + } + notifier.setDestination( + Location( + id: 'geo:${coords.latitude},${coords.longitude}', + name: + '${coords.latitude.toStringAsFixed(4)}, ${coords.longitude.toStringAsFixed(4)}', + label: 'Dropped pin', + lng: coords.longitude, + lat: coords.latitude, + ), + ); + } + + Future _onRouteStateChanged( + RouteState? previous, RouteState next) async { + final controller = _mapController; + if (controller == null) return; + if (previous?.preview == next.preview) return; + + final existing = _routeOverlay; + if (existing != null) { + await existing.remove(controller); + _routeOverlay = null; + } + final preview = next.preview; + if (preview != null) { + final fit = !ref.read(navigationSessionProvider); + _routeOverlay = + await RouteOverlay.draw(controller, preview, fitCamera: fit); + } + } + + Future _flyToCurrentLocation() async { + final controller = _mapController; + if (controller == null) return; + try { + final pos = await Geolocator.getLastKnownPosition() ?? + await Geolocator.getCurrentPosition(); + await controller.animateCamera( + CameraUpdate.newLatLngZoom(LatLng(pos.latitude, pos.longitude), 16), + ); + } catch (e) { + if (!mounted) return; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Could not get current location: $e')), + ); + } + } + + Future _startNavigationSession() async { + final routeState = ref.read(routeControllerProvider); + final origin = routeState.origin; + final destination = routeState.destination; + if (origin == null || destination == null) { + debugPrint('nav: start aborted (no origin/destination)'); + return; + } + debugPrint('nav: start ${origin.name} -> ${destination.name}'); + final service = ref.read(navigationServiceProvider); + try { + await service.start( + origin: WaypointInput(lat: origin.lat, lng: origin.lng), + destination: + WaypointInput(lat: destination.lat, lng: destination.lng), + ); + } catch (e, st) { + debugPrint('nav: start failed: $e\n$st'); + } + } + + Future _endNavigationSession({bool clearRoute = false}) async { + debugPrint('nav: end (clearRoute=$clearRoute)'); + final service = ref.read(navigationServiceProvider); + await service.dispose(); + final controller = _mapController; + if (controller != null) { + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.none); + } + if (!mounted) return; + setState(() => _rerouting = false); + ref.read(navigationSessionProvider.notifier).state = false; + if (clearRoute) { + ref.read(routeControllerProvider.notifier).clear(); + } + } + + Future _handleFirstFix(UserLocation loc) async { + debugPrint('nav: first fix'); + final cam = ref.read(navigationCameraControllerProvider); + cam.onFirstFix(); + final controller = _mapController; + if (controller == null) return; + await controller.animateCamera(CameraUpdate.newLatLngZoom( + LatLng(loc.lat, loc.lng), cam.followZoom)); + if (!mounted) return; + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.trackingCompass); + } + + Future _handleArrival() async { + debugPrint('nav: arrived'); + final cam = ref.read(navigationCameraControllerProvider); + cam.onArrived(); + if (mounted) setState(() => _rerouting = false); + final controller = _mapController; + if (controller == null) return; + final destination = ref.read(routeControllerProvider).destination; + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.none); + if (!mounted) return; + if (destination != null) { + await controller.animateCamera(CameraUpdate.newLatLngZoom( + LatLng(destination.lat, destination.lng), kArrivalZoom)); + } + } + + Future _handleRecenterTap() async { + final controller = _mapController; + if (controller == null) return; + final snapped = ref.read(navigationStateProvider).value?.snappedLocation; + if (snapped == null) return; + final cam = ref.read(navigationCameraControllerProvider); + cam.onRecenterTapped(); + await controller.animateCamera(CameraUpdate.newLatLngZoom( + LatLng(snapped.lat, snapped.lng), cam.followZoom)); + if (!mounted) return; + await controller + .updateMyLocationTrackingMode(MyLocationTrackingMode.trackingCompass); + } + + void _onNavStateChange( + AsyncValue? prev, AsyncValue next) { + if (!mounted) return; + if (!ref.read(navigationSessionProvider)) return; + final prevState = prev?.value; + final nextState = next.value; + if (nextState == null) return; + + if (prevState?.snappedLocation == null && + nextState.snappedLocation != null) { + _handleFirstFix(nextState.snappedLocation!); + } + + if (prevState?.status != TripStatus.complete && + nextState.status == TripStatus.complete) { + _handleArrival(); + } + } + + void _onRerouteInProgressChange( + AsyncValue? prev, AsyncValue next) { + if (!mounted) return; + final prevInProgress = prev?.value ?? false; + final inProgress = next.value ?? false; + if (_rerouting != inProgress) { + debugPrint('nav: reroute ${inProgress ? "start" : "done"}'); + setState(() => _rerouting = inProgress); + } + // On reroute completion, refetch the preview polyline so the map + // shows the new route. `/api/navigate` used during reroute returns + // an encoded polyline (not GeoJSON), so the RoutePreview geometry + // isn't updated by ferrostar's replaceRoute. Re-hitting `/api/route` + // with current GPS as origin produces a fresh GeoJSON preview. + if (prevInProgress && !inProgress) { + _refreshPreviewFromGps(); + } + } + + Future _refreshPreviewFromGps() async { + Position? pos; + try { + pos = await Geolocator.getLastKnownPosition() ?? + await Geolocator.getCurrentPosition(); + } catch (e) { + debugPrint('nav: refresh-preview GPS error: $e'); + } + if (!mounted || pos == null) return; + ref.read(routeControllerProvider.notifier).setOrigin( + Location( + id: 'gps', + name: 'Current location', + label: 'Current location', + lat: pos.latitude, + lng: pos.longitude, + ), + ); + } + + @override + Widget build(BuildContext context) { + final routeState = ref.watch(routeControllerProvider); + final preview = routeState.preview; + final styleAsync = ref.watch(mapStyleProvider); + final navActive = ref.watch(navigationSessionProvider); + + ref.listen(routeControllerProvider, _onRouteStateChanged); + ref.listen>( + navigationStateProvider, _onNavStateChange); + ref.listen>( + rerouteInProgressProvider, _onRerouteInProgressChange); + ref.listen(navigationSessionProvider, (prev, next) { + if (prev == next) return; + if (next) { + _startNavigationSession(); + } else if (prev == true) { + _endNavigationSession(); + } + }); + + return Scaffold( + body: Stack( + children: [ + styleAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (e, _) => Center(child: Text('Failed to load map: $e')), + data: (style) => MapLibreMap( + styleString: style, + initialCameraPosition: const CameraPosition( + target: LatLng(52.5200, 13.4050), + zoom: 13, + ), + cameraTargetBounds: CameraTargetBounds(_berlinBounds), + minMaxZoomPreference: const MinMaxZoomPreference(10, 18), + myLocationEnabled: true, + myLocationTrackingMode: MyLocationTrackingMode.none, + trackCameraPosition: true, + // EagerGestureRecognizer: map claims all pointer events so pinch, + // rotate and pan work when wrapped in a Scaffold/MaterialApp + // that otherwise wins the gesture arena on iOS. + gestureRecognizers: >{ + Factory( + () => EagerGestureRecognizer(), + ), + }, + onMapCreated: (controller) { + _mapController = controller; + }, + onMapClick: _handleMapTap, + onCameraTrackingDismissed: () { + ref + .read(navigationCameraControllerProvider) + .onTrackingDismissed(); + }, + onCameraIdle: () { + final c = _mapController; + if (c == null) return; + final zoom = c.cameraPosition?.zoom; + if (zoom != null) { + ref + .read(navigationCameraControllerProvider) + .onZoomChanged(zoom); + } + }, + ), + ), + if (navActive) + _NavigationOverlay( + ttsEnabled: _ttsEnabled, + rerouting: _rerouting, + onToggleTts: () => + setState(() => _ttsEnabled = !_ttsEnabled), + onRecenter: _handleRecenterTap, + onClose: () => + ref.read(navigationSessionProvider.notifier).state = false, + ) + else + _BrowseOverlay( + routeState: routeState, + preview: preview, + onFlyToMyLocation: _flyToCurrentLocation, + onStart: () { + ref.read(navigationSessionProvider.notifier).state = true; + }, + ), + ], + ), + ); + } +} + +class _BrowseOverlay extends ConsumerWidget { + const _BrowseOverlay({ + required this.routeState, + required this.preview, + required this.onFlyToMyLocation, + required this.onStart, + }); + + final RouteState routeState; + final RoutePreview? preview; + final VoidCallback onFlyToMyLocation; + final VoidCallback onStart; + + @override + Widget build(BuildContext context, WidgetRef ref) { + return Stack( + children: [ + BeeBeeBikeSearchBar( + onTap: () async { + final result = await Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const SearchScreen()), + ); + if (result == null || !context.mounted) return; + + Position? pos; + try { + pos = await Geolocator.getLastKnownPosition() ?? + await Geolocator.getCurrentPosition(); + } catch (_) {} + if (!context.mounted) return; + ref.read(routeControllerProvider.notifier).setOrigin( + Location( + id: 'gps', + name: 'Current location', + label: 'Current location', + lng: pos?.longitude ?? 13.4533, + lat: pos?.latitude ?? 52.5065, + ), + ); + if (!context.mounted) return; + ref.read(routeControllerProvider.notifier).setDestination( + Location( + id: result.id, + name: result.name, + label: result.label, + lng: result.lng, + lat: result.lat, + ), + ); + }, + onAvatarTap: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const SettingsScreen()), + ); + }, + ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + FloatingActionButton( + heroTag: 'browse-my-location-fab', + onPressed: onFlyToMyLocation, + child: const Icon(Icons.my_location), + ), + const SizedBox(height: 8), + Container( + width: double.infinity, + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24), + ), + child: routeState.isLoading + ? const Padding( + padding: EdgeInsets.symmetric(vertical: 8), + child: Center(child: CircularProgressIndicator()), + ) + : routeState.error != null + ? Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.error_outline, + color: Colors.red), + const SizedBox(height: 8), + Text( + 'Could not load route', + style: Theme.of(context) + .textTheme + .bodyMedium, + ), + ], + ) + : preview == null + ? const Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Center( + child: SizedBox( + width: 36, + child: Divider(thickness: 4), + ), + ), + SizedBox(height: 12), + Text('Home'), + Text('Saved places'), + ], + ) + : RouteSummary( + // GraphHopper returns time in milliseconds. + durationMinutes: + (preview!.time / 60000).round(), + distanceKm: preview!.distance / 1000, + onStart: onStart, + onClose: () => ref + .read(routeControllerProvider.notifier) + .clear(), + ), + ), + ], + ), + ), + ), + ], + ); + } +} + +class _NavigationOverlay extends ConsumerWidget { + const _NavigationOverlay({ + required this.ttsEnabled, + required this.rerouting, + required this.onToggleTts, + required this.onRecenter, + required this.onClose, + }); + + final bool ttsEnabled; + final bool rerouting; + final VoidCallback onToggleTts; + final VoidCallback onRecenter; + final VoidCallback onClose; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final navState = ref.watch(navigationStateProvider); + final cam = ref.watch(navigationCameraControllerProvider); + + return Stack( + children: [ + Align( + alignment: Alignment.topCenter, + child: SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + navState.when( + loading: () => const TurnBanner( + primaryText: 'Starting navigation...', + distanceText: '', + ), + error: (e, _) => const TurnBanner( + primaryText: 'Navigation error', + distanceText: '', + icon: Icons.error_outline, + ), + data: (state) => TurnBanner( + primaryText: + state.currentVisual?.primaryText ?? 'On route', + distanceText: state.progress != null + ? formatDistance( + state.progress!.distanceToNextManeuverM) + : '', + icon: state.currentVisual != null + ? iconForManeuver( + state.currentVisual!.maneuverType, + state.currentVisual!.maneuverModifier, + ) + : Icons.straight, + ), + ), + if (rerouting) const ReroutingToast(), + ], + ), + ), + ), + if (cam.mode == CameraMode.free) + Align( + alignment: Alignment.bottomRight, + child: SafeArea( + child: Padding( + padding: const EdgeInsets.only( + right: 16, bottom: kEtaSheetHeight), + child: RecenterFab(onTap: onRecenter), + ), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: SafeArea( + top: false, + child: Container( + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical(top: Radius.circular(24)), + ), + child: cam.mode == CameraMode.arrived + ? ArrivedSheet(onDone: onClose) + : EtaSheet( + navState: navState, + ttsEnabled: ttsEnabled, + onToggleTts: onToggleTts, + onClose: onClose, + ), + ), + ), + ), + ], + ); + } +} diff --git a/mobile/lib/screens/search_screen.dart b/mobile/lib/screens/search_screen.dart new file mode 100644 index 0000000..9ccbc2b --- /dev/null +++ b/mobile/lib/screens/search_screen.dart @@ -0,0 +1,92 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../api/client.dart'; +import '../api/geocode_api.dart'; +import '../models/geocode_result.dart'; + +final _geocodeApiProvider = + Provider((ref) => GeocodeApi(ref.watch(dioProvider))); + +class SearchScreen extends ConsumerStatefulWidget { + const SearchScreen({super.key}); + + @override + ConsumerState createState() => _SearchScreenState(); +} + +class _SearchScreenState extends ConsumerState { + final _controller = TextEditingController(); + final List _results = []; + Timer? _debounce; + bool _loading = false; + + @override + void dispose() { + _debounce?.cancel(); + _controller.dispose(); + super.dispose(); + } + + void _onChanged(String value) { + _debounce?.cancel(); + if (value.trim().isEmpty) { + setState(() => _results.clear()); + return; + } + _debounce = Timer( + const Duration(milliseconds: 400), + () => _search(value.trim()), + ); + } + + Future _search(String query) async { + setState(() => _loading = true); + try { + final results = await ref.read(_geocodeApiProvider).search(query); + if (mounted) setState(() => _results..clear()..addAll(results)); + } catch (_) { + if (mounted) setState(() => _results.clear()); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: const BackButton(), + title: TextField( + controller: _controller, + autofocus: true, + decoration: const InputDecoration( + hintText: 'Search here...', + border: InputBorder.none, + ), + onChanged: _onChanged, + onSubmitted: (value) { + _debounce?.cancel(); + if (value.trim().isNotEmpty) _search(value.trim()); + }, + ), + ), + body: _loading + ? const Center(child: CircularProgressIndicator()) + : ListView.builder( + itemCount: _results.length, + itemBuilder: (context, index) { + final r = _results[index]; + return ListTile( + leading: const Icon(Icons.place_outlined), + title: Text(r.name), + subtitle: r.label.isNotEmpty ? Text(r.label) : null, + onTap: () => Navigator.of(context).pop(r), + ); + }, + ), + ); + } +} diff --git a/mobile/lib/screens/settings_screen.dart b/mobile/lib/screens/settings_screen.dart new file mode 100644 index 0000000..cf52cfa --- /dev/null +++ b/mobile/lib/screens/settings_screen.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../providers/auth_provider.dart'; +import '../providers/location_provider.dart'; +import 'login_screen.dart'; + +class SettingsScreen extends ConsumerWidget { + const SettingsScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final user = ref.watch(authControllerProvider).valueOrNull; + final home = ref.watch(homeLocationProvider).valueOrNull; + + return Scaffold( + appBar: AppBar(title: const Text('Settings')), + body: ListView( + children: [ + ListTile( + title: Text(user?.email ?? 'Guest'), + subtitle: Text(user?.accountType ?? 'Loading...'), + ), + if (home != null) + ListTile( + title: const Text('Home'), + subtitle: Text(home.label), + ), + if (user?.email != null) + ListTile( + title: const Text('Log out'), + onTap: () => + ref.read(authControllerProvider.notifier).logout(), + ) + else + ListTile( + title: const Text('Log in'), + onTap: () => Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const LoginScreen()), + ), + ), + ], + ), + ); + } +} diff --git a/mobile/lib/services/map_style_loader.dart b/mobile/lib/services/map_style_loader.dart new file mode 100644 index 0000000..9a18485 --- /dev/null +++ b/mobile/lib/services/map_style_loader.dart @@ -0,0 +1,31 @@ +import 'dart:io'; + +import 'package:flutter/services.dart' show rootBundle; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:path_provider/path_provider.dart'; + +import '../app.dart'; + +const _styleAssetPath = 'assets/styles/beebeebike-style.json'; + +/// Loads the bundled style, substitutes the tile-server base URL, and writes +/// the result to the app's temp directory. Returns the absolute file path. +/// +/// We write to disk because `maplibre_gl` 0.20.0's iOS plugin silently drops +/// inline JSON passed to `styleString` (see `MapLibreMapController.swift`'s +/// `setStyleString`, which logs "JSON style currently not supported" and +/// no-ops). Newer 0.25+ supports it but conflicts with ferrostar_flutter's +/// `maplibre-gl-native-distribution` version range. +Future loadMapStyle(String tileServerBaseUrl) async { + final raw = await rootBundle.loadString(_styleAssetPath); + final resolved = raw.replaceAll('{{TILE_BASE}}', tileServerBaseUrl); + final dir = await getTemporaryDirectory(); + final file = File('${dir.path}/beebeebike-style.json'); + await file.writeAsString(resolved, flush: true); + return file.path; +} + +final mapStyleProvider = FutureProvider((ref) { + final config = ref.watch(appConfigProvider); + return loadMapStyle(config.tileServerBaseUrl); +}); diff --git a/mobile/lib/services/route_drawing.dart b/mobile/lib/services/route_drawing.dart new file mode 100644 index 0000000..c279c1d --- /dev/null +++ b/mobile/lib/services/route_drawing.dart @@ -0,0 +1,85 @@ +import 'package:maplibre_gl/maplibre_gl.dart'; + +import '../models/route_preview.dart'; + +const _routeLineColor = '#2E6F66'; +const _markerFillColor = '#2E6F66'; +const _markerStrokeColor = '#ffffff'; + +List _decodeLineString(Map geometry) { + final coords = geometry['coordinates'] as List; + return coords + .map((c) => LatLng((c as List)[1] as double, c[0] as double)) + .toList(); +} + +LatLngBounds _boundsFor(List points) { + var minLat = points.first.latitude; + var maxLat = points.first.latitude; + var minLng = points.first.longitude; + var maxLng = points.first.longitude; + for (final p in points.skip(1)) { + if (p.latitude < minLat) minLat = p.latitude; + if (p.latitude > maxLat) maxLat = p.latitude; + if (p.longitude < minLng) minLng = p.longitude; + if (p.longitude > maxLng) maxLng = p.longitude; + } + return LatLngBounds( + southwest: LatLng(minLat, minLng), + northeast: LatLng(maxLat, maxLng), + ); +} + +class RouteOverlay { + RouteOverlay._(this._line, this._origin, this._destination); + + final Line _line; + final Circle _origin; + final Circle _destination; + + static Future draw( + MapLibreMapController controller, + RoutePreview preview, { + bool fitCamera = true, + }) async { + final coords = _decodeLineString(preview.geometry); + final line = await controller.addLine(LineOptions( + geometry: coords, + lineColor: _routeLineColor, + lineWidth: 5.0, + lineOpacity: 0.9, + )); + final origin = await controller.addCircle(CircleOptions( + geometry: coords.first, + circleRadius: 8.0, + circleColor: _markerFillColor, + circleStrokeColor: _markerStrokeColor, + circleStrokeWidth: 2.0, + )); + final destination = await controller.addCircle(CircleOptions( + geometry: coords.last, + circleRadius: 8.0, + circleColor: _markerFillColor, + circleStrokeColor: _markerStrokeColor, + circleStrokeWidth: 2.0, + )); + if (fitCamera) { + await controller.animateCamera( + CameraUpdate.newLatLngBounds( + _boundsFor(coords), + left: 40, + top: 100, + right: 40, + bottom: 240, + ), + ); + } + return RouteOverlay._(line, origin, destination); + } + + Future remove(MapLibreMapController controller) async { + await controller.removeLine(_line); + await controller.removeCircle(_origin); + await controller.removeCircle(_destination); + } +} diff --git a/mobile/lib/widgets/arrived_sheet.dart b/mobile/lib/widgets/arrived_sheet.dart new file mode 100644 index 0000000..b8543c6 --- /dev/null +++ b/mobile/lib/widgets/arrived_sheet.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +class ArrivedSheet extends StatelessWidget { + const ArrivedSheet({super.key, required this.onDone}); + + final VoidCallback onDone; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(20), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text('Arrived', style: Theme.of(context).textTheme.headlineSmall), + const SizedBox(height: 16), + FilledButton(onPressed: onDone, child: const Text('Done')), + ], + ), + ); + } +} diff --git a/mobile/lib/widgets/eta_sheet.dart b/mobile/lib/widgets/eta_sheet.dart new file mode 100644 index 0000000..3ce937a --- /dev/null +++ b/mobile/lib/widgets/eta_sheet.dart @@ -0,0 +1,58 @@ +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../navigation/maneuver_icons.dart'; + +/// Bottom sheet shown during active navigation. Displays ETA + remaining +/// minutes, a TTS toggle, and a close button that ends the nav session. +class EtaSheet extends StatelessWidget { + const EtaSheet({ + super.key, + required this.navState, + required this.ttsEnabled, + required this.onToggleTts, + required this.onClose, + }); + + final AsyncValue navState; + final bool ttsEnabled; + final VoidCallback onToggleTts; + final VoidCallback onClose; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + navState.when( + loading: () => const Text('Loading...'), + error: (_, __) => const Text('—'), + data: (state) { + final p = state.progress; + if (p == null) return const Text('—'); + return Text(formatEta(p.durationRemainingMs)); + }, + ), + Row( + children: [ + IconButton( + tooltip: ttsEnabled ? 'Mute voice' : 'Enable voice', + icon: Icon(ttsEnabled ? Icons.volume_up : Icons.volume_off), + onPressed: onToggleTts, + ), + const SizedBox(width: 8), + IconButton( + tooltip: 'End navigation', + icon: const Icon(Icons.close), + onPressed: onClose, + ), + ], + ), + ], + ), + ); + } +} diff --git a/mobile/lib/widgets/rating_overlay.dart b/mobile/lib/widgets/rating_overlay.dart new file mode 100644 index 0000000..084edd9 --- /dev/null +++ b/mobile/lib/widgets/rating_overlay.dart @@ -0,0 +1,19 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../api/client.dart'; + +class RatingOverlayController { + RatingOverlayController(this._dio); + + final Dio _dio; + + Future> fetchOverlay(String bbox) async { + final response = await _dio.get('/api/ratings', queryParameters: {'bbox': bbox}); + return Map.from(response.data as Map); + } +} + +final ratingOverlayControllerProvider = Provider( + (ref) => RatingOverlayController(ref.watch(dioProvider)), +); diff --git a/mobile/lib/widgets/recenter_fab.dart b/mobile/lib/widgets/recenter_fab.dart new file mode 100644 index 0000000..2d93202 --- /dev/null +++ b/mobile/lib/widgets/recenter_fab.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class RecenterFab extends StatelessWidget { + const RecenterFab({super.key, required this.onTap}); + + final VoidCallback onTap; + + @override + Widget build(BuildContext context) { + return FloatingActionButton.small( + heroTag: 'nav-recenter-fab', + onPressed: onTap, + child: const Icon(Icons.my_location), + ); + } +} diff --git a/mobile/lib/widgets/rerouting_toast.dart b/mobile/lib/widgets/rerouting_toast.dart new file mode 100644 index 0000000..d4a3131 --- /dev/null +++ b/mobile/lib/widgets/rerouting_toast.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; + +class ReroutingToast extends StatelessWidget { + const ReroutingToast({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.symmetric(horizontal: 32, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.75), + borderRadius: BorderRadius.circular(24), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: const [ + SizedBox( + width: 16, + height: 16, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: AlwaysStoppedAnimation(Colors.white), + ), + ), + SizedBox(width: 12), + Text('Rerouting…', + style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600)), + ], + ), + ); + } +} diff --git a/mobile/lib/widgets/route_summary.dart b/mobile/lib/widgets/route_summary.dart new file mode 100644 index 0000000..76c7429 --- /dev/null +++ b/mobile/lib/widgets/route_summary.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; + +class RouteSummary extends StatelessWidget { + const RouteSummary({ + super.key, + required this.durationMinutes, + required this.distanceKm, + required this.onStart, + this.onClose, + }); + + final int durationMinutes; + final double distanceKm; + final VoidCallback onStart; + final VoidCallback? onClose; + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + '🚲 $durationMinutes min · ${distanceKm.toStringAsFixed(1)} km', + ), + ), + if (onClose != null) + IconButton( + tooltip: 'Clear route', + icon: const Icon(Icons.close), + onPressed: onClose, + padding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, + constraints: const BoxConstraints(), + ), + ], + ), + const SizedBox(height: 12), + FilledButton( + onPressed: onStart, + child: const Text('Start'), + ), + ], + ); + } +} diff --git a/mobile/lib/widgets/search_bar.dart b/mobile/lib/widgets/search_bar.dart new file mode 100644 index 0000000..22743c5 --- /dev/null +++ b/mobile/lib/widgets/search_bar.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; + +class BeeBeeBikeSearchBar extends StatelessWidget { + const BeeBeeBikeSearchBar({ + super.key, + required this.onTap, + required this.onAvatarTap, + }); + + final VoidCallback onTap; + final VoidCallback onAvatarTap; + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Padding( + padding: const EdgeInsets.all(16), + child: Row( + children: [ + Expanded( + child: Material( + color: Colors.white, + borderRadius: BorderRadius.circular(18), + child: InkWell( + borderRadius: BorderRadius.circular(18), + onTap: onTap, + child: const Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 14), + child: Text('Search here...'), + ), + ), + ), + ), + const SizedBox(width: 12), + CircleAvatar( + child: IconButton( + onPressed: onAvatarTap, + icon: const Icon(Icons.person_outline), + ), + ), + ], + ), + ), + ); + } +} diff --git a/mobile/lib/widgets/turn_banner.dart b/mobile/lib/widgets/turn_banner.dart new file mode 100644 index 0000000..bbc2ce4 --- /dev/null +++ b/mobile/lib/widgets/turn_banner.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; + +class TurnBanner extends StatelessWidget { + const TurnBanner({ + super.key, + required this.primaryText, + required this.distanceText, + this.icon = Icons.straight, + }); + + final String primaryText; + final String distanceText; + final IconData icon; + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.all(16), + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: const Color(0xFF2F8F56), + borderRadius: BorderRadius.circular(20), + ), + child: Row( + children: [ + Icon(icon, color: Colors.white), + const SizedBox(width: 12), + Expanded( + child: Text( + primaryText, + style: const TextStyle( + color: Colors.white, fontWeight: FontWeight.w700), + ), + ), + Text(distanceText, style: const TextStyle(color: Colors.white)), + ], + ), + ); + } +} diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock new file mode 100644 index 0000000..2a0663a --- /dev/null +++ b/mobile/pubspec.lock @@ -0,0 +1,1056 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f + url: "https://pub.dev" + source: hosted + version: "85.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d" + url: "https://pub.dev" + source: hosted + version: "7.7.1" + archive: + dependency: transitive + description: + name: archive + sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff + url: "https://pub.dev" + source: hosted + version: "4.0.9" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: "51dc711996cbf609b90cbe5b335bbce83143875a9d58e4b5c6d3c4f684d3dda7" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 + url: "https://pub.dev" + source: hosted + version: "4.1.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: ee4257b3f20c0c90e72ed2b57ad637f694ccba48839a821e87db762548c22a62 + url: "https://pub.dev" + source: hosted + version: "2.5.4" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "382a4d649addbfb7ba71a3631df0ec6a45d5ab9b098638144faf27f02778eb53" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "85fbbb1036d576d966332a3f5ce83f2ce66a40bea1a94ad2d5fc29a19a0d3792" + url: "https://pub.dev" + source: hosted + version: "9.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "0730c18c770d05636a8f945c32a4d7d81cb6e0f0148c8db4ad12e7748f7e49af" + url: "https://pub.dev" + source: hosted + version: "8.12.5" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: "83ccdaa064c980b5596c35dd64a8d3ecc68620174ab9b90b6343b753aa721687" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "6a6cab2ba4680d6423f34a9b972a4c9a94ebe1b62ecec4e1a1f2cba91fd1319d" + url: "https://pub.dev" + source: hosted + version: "4.11.1" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + cookie_jar: + dependency: "direct main" + description: + name: cookie_jar + sha256: "963da02c1ef64cb5ac20de948c9e5940aa351f1e34a12b1d327c83d85b7e8fff" + url: "https://pub.dev" + source: hosted + version: "4.0.9" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.dev" + source: hosted + version: "5.9.2" + dio_cookie_manager: + dependency: "direct main" + description: + name: dio_cookie_manager + sha256: "0db1a7b997a0455e488ac35744c68eed3f2a4280d3ab531835a65641b0a08744" + url: "https://pub.dev" + source: hosted + version: "3.4.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ferrostar_flutter: + dependency: "direct main" + description: + path: "../packages/ferrostar_flutter" + relative: true + source: path + version: "0.1.0" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_compass: + dependency: "direct main" + description: + name: flutter_compass + sha256: "1b4d7e6c95a675ec8482b5c9c9ccf1ebf0ced3dbec59dce28ad609da953de850" + url: "https://pub.dev" + source: hosted + version: "0.8.1" + flutter_driver: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_riverpod: + dependency: "direct main" + description: + name: flutter_riverpod + sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_tts: + dependency: "direct main" + description: + name: flutter_tts + sha256: ce5eb209b40e95f2f4a1397116c87ab2fcdff32257d04ed7a764e75894c03775 + url: "https://pub.dev" + source: hosted + version: "4.2.5" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + freezed: + dependency: "direct dev" + description: + name: freezed + sha256: "59a584c24b3acdc5250bb856d0d3e9c0b798ed14a4af1ddb7dc1c7b41df91c9c" + url: "https://pub.dev" + source: hosted + version: "2.5.8" + freezed_annotation: + dependency: "direct main" + description: + name: freezed_annotation + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + url: "https://pub.dev" + source: hosted + version: "2.4.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + geolocator: + dependency: "direct main" + description: + name: geolocator + sha256: f62bcd90459e63210bbf9c35deb6a51c521f992a78de19a1fe5c11704f9530e2 + url: "https://pub.dev" + source: hosted + version: "13.0.4" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: fcb1760a50d7500deca37c9a666785c047139b5f9ee15aa5469fae7dbbe3170d + url: "https://pub.dev" + source: hosted + version: "4.6.2" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 + url: "https://pub.dev" + source: hosted + version: "2.3.13" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" + url: "https://pub.dev" + source: hosted + version: "4.2.6" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172 + url: "https://pub.dev" + source: hosted + version: "4.1.3" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" + url: "https://pub.dev" + source: hosted + version: "0.2.5" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + hooks: + dependency: transitive + description: + name: hooks + sha256: e79ed1e8e1929bc6ecb6ec85f0cb519c887aa5b423705ded0d0f2d9226def388 + url: "https://pub.dev" + source: hosted + version: "1.0.2" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_mock_adapter: + dependency: "direct dev" + description: + name: http_mock_adapter + sha256: "46399c78bd4a0af071978edd8c502d7aeeed73b5fb9860bca86b5ed647a63c1b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: f9881ff4998044947ec38d098bc7c8316ae1186fa786eddffdb867b9bc94dfce + url: "https://pub.dev" + source: hosted + version: "4.8.0" + integration_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + js: + dependency: transitive + description: + name: js + sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" + url: "https://pub.dev" + source: hosted + version: "0.7.2" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c + url: "https://pub.dev" + source: hosted + version: "6.9.5" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logger: + dependency: transitive + description: + name: logger + sha256: "25aee487596a6257655a1e091ec2ae66bc30e7af663592cc3a27e6591e05035c" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + maplibre_gl: + dependency: "direct main" + description: + name: maplibre_gl + sha256: ea2fa443e7d5dc18db7f37a0f6f5af40642888c56b81a14441aeddea077adaea + url: "https://pub.dev" + source: hosted + version: "0.20.0" + maplibre_gl_platform_interface: + dependency: transitive + description: + name: maplibre_gl_platform_interface + sha256: "718c3503f36936fbf35c34d6ddf8bf770474c5ba1e6cb1d8caece44efae424af" + url: "https://pub.dev" + source: hosted + version: "0.20.0" + maplibre_gl_web: + dependency: transitive + description: + name: maplibre_gl_web + sha256: e7d71b08f24dca70e9c9cf841b096704a677e6239447d87220ec071355768149 + url: "https://pub.dev" + source: hosted + version: "0.20.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mocktail: + dependency: "direct dev" + description: + name: mocktail + sha256: "5e1bf53cc7baa8062a33b84424deb61513858ea05c601b8509e683815b5914aa" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + native_toolchain_c: + dependency: transitive + description: + name: native_toolchain_c + sha256: "6ba77bb18063eebe9de401f5e6437e95e1438af0a87a3a39084fbd37c90df572" + url: "https://pub.dev" + source: hosted + version: "0.17.6" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "100a1c87616ab6ed41ec263b083c0ef3261ee6cd1dc3b0f35f8ddfa4f996fe52" + url: "https://pub.dev" + source: hosted + version: "9.3.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + posix: + dependency: transitive + description: + name: posix + sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + process: + dependency: transitive + description: + name: process + sha256: c6248e4526673988586e8c00bb22a49210c258dc91df5227d5da9748ecf79744 + url: "https://pub.dev" + source: hosted + version: "5.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + riverpod: + dependency: transitive + description: + name: riverpod + sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf + url: "https://pub.dev" + source: hosted + version: "2.5.5" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: e8d4762b1e2e8578fc4d0fd548cebf24afd24f49719c08974df92834565e2c53 + url: "https://pub.dev" + source: hosted + version: "2.4.23" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: a447acb083d3a5ef17f983dd36201aeea33fedadb3228fa831f2f0c92f0f3aca + url: "https://pub.dev" + source: hosted + version: "1.3.7" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + sync_http: + dependency: transitive + description: + name: sync_http + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" + url: "https://pub.dev" + source: hosted + version: "0.7.10" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: f63cbc48103236abf48e345e07a03ce5757ea86285ed313a6a032596ed9301e2 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + uuid: + dependency: transitive + description: + name: uuid + sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "046d3928e16fa4dc46e8350415661755ab759d9fc97fc21b5ab295f71e4f0499" + url: "https://pub.dev" + source: hosted + version: "15.1.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webdriver: + dependency: transitive + description: + name: webdriver + sha256: "2f3a14ca026957870cfd9c635b83507e0e51d8091568e90129fbf805aba7cade" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.11.0 <4.0.0" + flutter: ">=3.41.0" diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml new file mode 100644 index 0000000..0f9d797 --- /dev/null +++ b/mobile/pubspec.yaml @@ -0,0 +1,44 @@ +name: beebeebike +description: Mobile navigation client for BeeBeeBike. +publish_to: none +version: 0.1.0+1 + +environment: + sdk: ^3.3.0 + flutter: ^3.19.0 + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^1.0.8 + flutter_riverpod: ^2.5.1 + dio: ^5.7.0 + dio_cookie_manager: ^3.1.1 + cookie_jar: ^4.0.8 + maplibre_gl: ^0.20.0 + geolocator: ^13.0.1 + flutter_compass: ^0.8.1 + flutter_tts: ^4.0.2 + shared_preferences: ^2.3.2 + path_provider: ^2.1.5 + freezed_annotation: ^2.4.4 + json_annotation: ^4.9.0 + ferrostar_flutter: + path: ../packages/ferrostar_flutter + +dev_dependencies: + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + flutter_lints: ^5.0.0 + build_runner: ^2.4.13 + freezed: ^2.5.7 + json_serializable: ^6.9.0 + http_mock_adapter: ^0.6.1 + mocktail: ^1.0.4 + +flutter: + uses-material-design: true + assets: + - assets/styles/ diff --git a/mobile/test/api/routing_api_test.dart b/mobile/test/api/routing_api_test.dart new file mode 100644 index 0000000..7a951cc --- /dev/null +++ b/mobile/test/api/routing_api_test.dart @@ -0,0 +1,42 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:beebeebike/api/routing_api.dart'; + +void main() { + test('computeNavigationRoute returns raw JSON from /api/navigate', () async { + final dio = Dio(BaseOptions(baseUrl: 'https://maps.001.land')); + final adapter = DioAdapter(dio: dio); + dio.httpClientAdapter = adapter; + + const response = { + 'routes': [ + { + 'distance': 1234.5, + 'geometry': 'abc123', + } + ], + }; + + adapter.onPost( + '/api/navigate', + (server) => server.reply(200, response), + data: { + 'origin': [13.405, 52.52], + 'destination': [13.45, 52.51], + 'rating_weight': 0.5, + 'distance_influence': 70.0, + }, + ); + + final api = RoutingApi(dio); + final json = await api.computeNavigationRoute( + const [13.405, 52.52], + const [13.45, 52.51], + ratingWeight: 0.5, + distanceInfluence: 70.0, + ); + + expect(json['routes'][0]['distance'], 1234.5); + }); +} diff --git a/mobile/test/app_smoke_test.dart b/mobile/test/app_smoke_test.dart new file mode 100644 index 0000000..82383bc --- /dev/null +++ b/mobile/test/app_smoke_test.dart @@ -0,0 +1,104 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:beebeebike/app.dart'; +import 'package:beebeebike/api/client.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/providers/search_history_provider.dart'; +import 'package:beebeebike/services/map_style_loader.dart'; +import 'package:dio/dio.dart'; + +void main() { + testWidgets('boots to the map screen shell', (tester) async { + SharedPreferences.setMockInitialValues({}); + final prefs = await SharedPreferences.getInstance(); + + final dio = Dio(BaseOptions(baseUrl: 'http://localhost:3000')); + dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + if (options.path == '/api/auth/me') { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401), + )); + } else if (options.path == '/api/auth/anonymous') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: {'id': 'anon-1', 'account_type': 'anonymous', 'display_name': ''}, + )); + } else { + handler.next(options); + } + }, + )); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + appConfigProvider.overrideWithValue( + const AppConfig( + apiBaseUrl: 'http://localhost:3000', + tileServerBaseUrl: 'http://localhost:8080', + tileStyleUrl: 'http://localhost:8080/tiles/assets/styles/colorful/style.json', + ), + ), + mapStyleProvider.overrideWith((ref) => Future.value('{}')), + dioProvider.overrideWithValue(dio), + sharedPreferencesProvider.overrideWithValue(prefs), + ], + child: const BeeBeeBikeApp(), + ), + ); + await tester.pumpAndSettle(); + + expect(find.text('Search here...'), findsOneWidget); + }); + + testWidgets('auth provider begins initialising on startup', (tester) async { + SharedPreferences.setMockInitialValues({}); + final prefs = await SharedPreferences.getInstance(); + + final dio = Dio(BaseOptions(baseUrl: 'http://localhost:3000')); + int authMeCallCount = 0; + dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + if (options.path == '/api/auth/me') { + authMeCallCount++; + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401), + )); + } else if (options.path == '/api/auth/anonymous') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: {'id': 'anon-1', 'account_type': 'anonymous', 'display_name': ''}, + )); + } else { + handler.next(options); + } + }, + )); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + appConfigProvider.overrideWithValue(const AppConfig( + apiBaseUrl: 'http://localhost:3000', + tileServerBaseUrl: 'http://localhost:8080', + tileStyleUrl: 'http://localhost:8080/tiles/style.json', + )), + mapStyleProvider.overrideWith((ref) => Future.value('{}')), + dioProvider.overrideWithValue(dio), + sharedPreferencesProvider.overrideWithValue(prefs), + ], + child: const BeeBeeBikeApp(), + ), + ); + await tester.pumpAndSettle(); + + expect(authMeCallCount, equals(1), + reason: 'authControllerProvider must be initialised on app startup'); + }); +} diff --git a/mobile/test/helpers/test_helpers.dart b/mobile/test/helpers/test_helpers.dart new file mode 100644 index 0000000..7322b0a --- /dev/null +++ b/mobile/test/helpers/test_helpers.dart @@ -0,0 +1,277 @@ +import 'package:beebeebike/api/client.dart'; +import 'package:beebeebike/app.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/models/location.dart'; +import 'package:beebeebike/models/route_preview.dart'; +import 'package:beebeebike/providers/search_history_provider.dart'; +import 'package:beebeebike/services/map_style_loader.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +abstract class TestFixtures { + static const Map anonymousUser = { + 'id': 'anon-1', + 'account_type': 'anonymous', + 'display_name': '', + }; + + static const Map loggedInUser = { + 'id': 'user-1', + 'email': 'test@example.com', + 'display_name': 'Test User', + 'account_type': 'standard', + }; + + static const Map geocodeResponse = { + 'features': [ + { + 'geometry': { + 'coordinates': [13.4050, 52.5200] + }, + 'properties': { + 'osm_type': 'N', + 'osm_id': '42', + 'name': 'Alexanderplatz', + 'district': 'Mitte', + 'osm_value': 'station', + }, + }, + ], + }; + + static const Map routePreviewJson = { + 'geometry': { + 'type': 'LineString', + 'coordinates': [ + [13.4050, 52.5200], + [13.4533, 52.5065], + ], + }, + 'distance': 5000.0, + // GraphHopper returns time in milliseconds. 1200000 ms = 20 min. + 'time': 1200000.0, + }; +} + +RoutePreview fakePreview() => RoutePreview.fromJson( + Map.from(TestFixtures.routePreviewJson)); + +Location fakeOrigin() => const Location( + id: 'gps', name: 'Current location', label: 'Current location', + lng: 13.4533, lat: 52.5065); + +Location fakeDest() => const Location( + id: 'N:42', name: 'Alexanderplatz', label: 'Mitte · station', + lng: 13.4050, lat: 52.5200); + +Dio buildMockDio({ + bool authenticated = false, + bool geocodeReturnsResults = true, + bool routeSucceeds = true, + bool loginSucceeds = true, +}) { + final dio = Dio(BaseOptions(baseUrl: 'http://localhost:3000')); + dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + final path = options.path; + + if (path == '/api/auth/me') { + if (authenticated) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.loggedInUser, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401, + data: {'error': 'unauthorized'}), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/auth/anonymous') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.anonymousUser, + )); + return; + } + + if (path == '/api/auth/login') { + if (loginSucceeds) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.loggedInUser, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 401, + data: {'error': 'unauthorized'}), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/auth/logout') { + handler.resolve(Response(requestOptions: options, statusCode: 200)); + return; + } + + if (path == '/api/auth/register') { + if (loginSucceeds) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.loggedInUser, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 409, + data: {'error': 'email already taken'}), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/geocode') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: geocodeReturnsResults + ? TestFixtures.geocodeResponse + : {'features': []}, + )); + return; + } + + if (path == '/api/route') { + if (routeSucceeds) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.routePreviewJson, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 500), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/navigate') { + if (routeSucceeds) { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: TestFixtures.routePreviewJson, + )); + } else { + handler.reject(DioException( + requestOptions: options, + response: Response(requestOptions: options, statusCode: 500), + type: DioExceptionType.badResponse, + )); + } + return; + } + + if (path == '/api/locations/home') { + if (options.method == 'GET') { + handler.resolve(Response( + requestOptions: options, + statusCode: 404, + )); + } else if (options.method == 'PUT') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + data: { + 'id': 'home', + 'label': options.data?['label'] ?? 'Home', + 'lng': options.data?['lng'] ?? 13.4050, + 'lat': options.data?['lat'] ?? 52.5200, + }, + )); + } else if (options.method == 'DELETE') { + handler.resolve(Response( + requestOptions: options, + statusCode: 200, + )); + } else { + handler.next(options); + } + return; + } + + handler.next(options); + }, + )); + return dio; +} + +List testProviderOverrides({ + required SharedPreferences prefs, + bool authenticated = false, + bool geocodeReturnsResults = true, + bool routeSucceeds = true, + bool loginSucceeds = true, +}) { + return [ + appConfigProvider.overrideWithValue(const AppConfig( + apiBaseUrl: 'http://localhost:3000', + tileServerBaseUrl: 'http://localhost:8080', + tileStyleUrl: 'http://localhost:8080/tiles/assets/styles/colorful/style.json', + )), + mapStyleProvider.overrideWith((ref) => Future.value('{}')), + dioProvider.overrideWithValue(buildMockDio( + authenticated: authenticated, + geocodeReturnsResults: geocodeReturnsResults, + routeSucceeds: routeSucceeds, + loginSucceeds: loginSucceeds, + )), + sharedPreferencesProvider.overrideWithValue(prefs), + ]; +} + +/// Convenience helper for widget tests. +/// +/// Usage: +/// ```dart +/// SharedPreferences.setMockInitialValues({}); +/// final prefs = await SharedPreferences.getInstance(); +/// await tester.pumpWidget(buildTestWidget(MyWidget(), prefs: prefs)); +/// ``` +Widget buildTestWidget( + Widget child, { + required SharedPreferences prefs, + bool authenticated = false, + bool geocodeReturnsResults = true, + bool routeSucceeds = true, + bool loginSucceeds = true, +}) { + return ProviderScope( + overrides: testProviderOverrides( + prefs: prefs, + authenticated: authenticated, + geocodeReturnsResults: geocodeReturnsResults, + routeSucceeds: routeSucceeds, + loginSucceeds: loginSucceeds, + ), + child: MaterialApp(home: child), + ); +} diff --git a/mobile/test/navigation/camera_controller_test.dart b/mobile/test/navigation/camera_controller_test.dart new file mode 100644 index 0000000..51d93d3 --- /dev/null +++ b/mobile/test/navigation/camera_controller_test.dart @@ -0,0 +1,127 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:beebeebike/navigation/camera_controller.dart'; + +void main() { + group('NavigationCameraController', () { + test('starts in awaitingFirstFix with default zoom 17', () { + final c = NavigationCameraController(); + expect(c.mode, CameraMode.awaitingFirstFix); + expect(c.followZoom, 17.0); + }); + + test('onFirstFix transitions awaitingFirstFix -> following', () { + final c = NavigationCameraController(); + c.onFirstFix(); + expect(c.mode, CameraMode.following); + }); + + test('onFirstFix is a no-op if already following', () { + final c = NavigationCameraController()..onFirstFix(); + c.onFirstFix(); + expect(c.mode, CameraMode.following); + }); + + test('onTrackingDismissed transitions following -> free', () { + final c = NavigationCameraController()..onFirstFix(); + c.onTrackingDismissed(); + expect(c.mode, CameraMode.free); + }); + + test('onTrackingDismissed is a no-op in awaitingFirstFix', () { + final c = NavigationCameraController(); + c.onTrackingDismissed(); + expect(c.mode, CameraMode.awaitingFirstFix); + }); + + test('onTrackingDismissed is a no-op in arrived', () { + final c = NavigationCameraController()..onArrived(); + c.onTrackingDismissed(); + expect(c.mode, CameraMode.arrived); + }); + + test('onZoomChanged mutates followZoom iff mode == free', () { + final c = NavigationCameraController(); + c.onZoomChanged(14.0); + expect(c.followZoom, 17.0); // awaitingFirstFix: ignored + c.onFirstFix(); + c.onZoomChanged(15.5); + expect(c.followZoom, 17.0); // following: ignored + c.onTrackingDismissed(); + c.onZoomChanged(13.2); + expect(c.followZoom, 13.2); // free: captured + }); + + test('onRecenterTapped transitions free -> following', () { + final c = NavigationCameraController() + ..onFirstFix() + ..onTrackingDismissed(); + c.onRecenterTapped(); + expect(c.mode, CameraMode.following); + }); + + test('onRecenterTapped is a no-op in following', () { + final c = NavigationCameraController()..onFirstFix(); + c.onRecenterTapped(); + expect(c.mode, CameraMode.following); + }); + + test('onArrived transitions any state to arrived', () { + for (final setup in [ + () => NavigationCameraController(), + () => NavigationCameraController()..onFirstFix(), + () => NavigationCameraController() + ..onFirstFix() + ..onTrackingDismissed(), + ]) { + final c = setup(); + c.onArrived(); + expect(c.mode, CameraMode.arrived); + } + }); + + test('notifies listeners on every successful transition', () { + final c = NavigationCameraController(); + var notifications = 0; + c.addListener(() => notifications++); + c.onFirstFix(); + c.onTrackingDismissed(); + c.onZoomChanged(14.0); + c.onRecenterTapped(); + c.onArrived(); + expect(notifications, 5); + }); + + test('does not notify on no-op transitions', () { + final c = NavigationCameraController(); + var notifications = 0; + c.addListener(() => notifications++); + + // No-ops from awaitingFirstFix + c.onTrackingDismissed(); + c.onRecenterTapped(); + c.onZoomChanged(14.0); + expect(notifications, 0); + + // Real transition: -> following + c.onFirstFix(); + notifications = 0; + + // No-ops from following + c.onFirstFix(); + c.onZoomChanged(14.0); + expect(notifications, 0); + + // Real transitions: -> free, -> arrived + c.onTrackingDismissed(); + c.onArrived(); + notifications = 0; + + // No-ops from arrived + c.onArrived(); + c.onTrackingDismissed(); + c.onRecenterTapped(); + c.onZoomChanged(14.0); + expect(notifications, 0); + }); + }); +} diff --git a/mobile/test/navigation/location_converter_test.dart b/mobile/test/navigation/location_converter_test.dart new file mode 100644 index 0000000..8200b3a --- /dev/null +++ b/mobile/test/navigation/location_converter_test.dart @@ -0,0 +1,69 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:geolocator/geolocator.dart'; + +import 'package:beebeebike/navigation/location_converter.dart'; + +void main() { + test('maps Position fields to UserLocation', () { + final pos = Position( + latitude: 52.52, + longitude: 13.405, + accuracy: 4.5, + heading: 270.0, + speed: 3.2, + timestamp: DateTime.fromMillisecondsSinceEpoch(1000), + altitude: 0, + altitudeAccuracy: 0, + headingAccuracy: 0, + speedAccuracy: 0, + ); + + final result = positionToUserLocation(pos); + + expect(result.lat, 52.52); + expect(result.lng, 13.405); + expect(result.horizontalAccuracyM, 4.5); + expect(result.courseDeg, 270.0); + expect(result.speedMps, 3.2); + expect(result.timestampMs, 1000); + }); + + test('preserves heading=0 (due north) as courseDeg 0.0', () { + final pos = Position( + latitude: 52.52, + longitude: 13.405, + accuracy: 5, + heading: 0.0, + speed: 0, + timestamp: DateTime.fromMillisecondsSinceEpoch(0), + altitude: 0, + altitudeAccuracy: 0, + headingAccuracy: 0, + speedAccuracy: 0, + ); + + final result = positionToUserLocation(pos); + + expect(result.courseDeg, 0.0); + }); + + test('sets courseDeg/speedMps to null when geolocator returns -1 sentinel', () { + final pos = Position( + latitude: 52.52, + longitude: 13.405, + accuracy: 5, + heading: -1.0, + speed: -1.0, + timestamp: DateTime.fromMillisecondsSinceEpoch(0), + altitude: 0, + altitudeAccuracy: 0, + headingAccuracy: 0, + speedAccuracy: 0, + ); + + final result = positionToUserLocation(pos); + + expect(result.courseDeg, isNull); + expect(result.speedMps, isNull); + }); +} diff --git a/mobile/test/navigation/maneuver_icons_test.dart b/mobile/test/navigation/maneuver_icons_test.dart new file mode 100644 index 0000000..8d42954 --- /dev/null +++ b/mobile/test/navigation/maneuver_icons_test.dart @@ -0,0 +1,51 @@ +import 'package:beebeebike/navigation/maneuver_icons.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('iconForManeuver', () { + test('maps turn left/right variants', () { + expect(iconForManeuver('turn', 'left'), Icons.turn_left); + expect(iconForManeuver('turn', 'right'), Icons.turn_right); + expect(iconForManeuver('turn', 'sharp_left'), Icons.turn_sharp_left); + expect(iconForManeuver('turn', 'sharp_right'), Icons.turn_sharp_right); + expect(iconForManeuver('turn', 'slight_left'), Icons.turn_slight_left); + expect(iconForManeuver('turn', 'slight_right'), Icons.turn_slight_right); + }); + + test('arrive -> flag', () { + expect(iconForManeuver('arrive', null), Icons.flag); + }); + + test('unknown -> straight', () { + expect(iconForManeuver('merge', 'left'), Icons.straight); + expect(iconForManeuver('', null), Icons.straight); + }); + }); + + group('formatDistance', () { + test('< 1000 m uses meters', () { + expect(formatDistance(0), '0 m'); + expect(formatDistance(150), '150 m'); + expect(formatDistance(999.4), '999 m'); + }); + + test('>= 1000 m uses km with 1 decimal', () { + expect(formatDistance(1000), '1.0 km'); + expect(formatDistance(1234), '1.2 km'); + expect(formatDistance(15600), '15.6 km'); + }); + }); + + group('formatEta', () { + test('contains arrival time and remaining minutes', () { + final out = formatEta(360000); // 6 min + expect(out, contains('arrival')); + expect(out, contains('6 min')); + }); + + test('zero duration renders 0 min', () { + expect(formatEta(0), contains('0 min')); + }); + }); +} diff --git a/mobile/test/navigation/navigation_service_test.dart b/mobile/test/navigation/navigation_service_test.dart new file mode 100644 index 0000000..2a647ba --- /dev/null +++ b/mobile/test/navigation/navigation_service_test.dart @@ -0,0 +1,125 @@ +import 'dart:async'; + +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:ferrostar_flutter/src/ferrostar_flutter_platform.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:beebeebike/navigation/navigation_service.dart'; + +class FakeFerrostarFlutterPlatform extends FerrostarFlutterPlatform { + final _deviationCtrl = StreamController.broadcast(); + final _stateCtrl = StreamController.broadcast(); + int replaceRouteCalls = 0; + + void emitDeviation(RouteDeviation d) => _deviationCtrl.add(d); + void emitState(NavigationState s) => _stateCtrl.add(s); + + @override + Future createController({ + required Map osrmJson, + required List waypoints, + required NavigationConfig config, + }) async => + 'fake-id'; + + @override + Future updateLocation({ + required String controllerId, + required UserLocation location, + }) async {} + + @override + Future replaceRoute({ + required String controllerId, + required Map osrmJson, + }) async { + replaceRouteCalls++; + } + + @override + Future dispose({required String controllerId}) async {} + + @override + Stream stateStream({required String controllerId}) => + _stateCtrl.stream; + + @override + Stream spokenInstructionStream( + {required String controllerId}) => + const Stream.empty(); + + @override + Stream deviationStream({required String controllerId}) => + _deviationCtrl.stream; +} + +void main() { + test('reroutes by calling replaceRoute when deviation stream emits', () async { + final fakePlatform = FakeFerrostarFlutterPlatform(); + final fakeController = FerrostarController('test', fakePlatform); + + final service = NavigationService( + createController: (osrmJson, waypoints) async => fakeController, + loadNavigationRoute: ({required origin, required destination}) async => { + 'routes': [ + {'distance': 1234} + ] + }, + locationStreamFactory: () => const Stream.empty(), + speakInstruction: (_) async {}, + ); + addTearDown(() => service.dispose()); + + await service.start( + origin: const WaypointInput(lat: 52.52, lng: 13.405), + destination: const WaypointInput(lat: 52.51, lng: 13.45), + ); + + fakePlatform.emitDeviation( + RouteDeviation( + deviationM: 87, + durationOffRouteMs: 12000, + userLocation: const UserLocation( + lat: 52.521, + lng: 13.406, + horizontalAccuracyM: 5, + timestampMs: 1, + ), + ), + ); + + await pumpEventQueue(); + expect(fakePlatform.replaceRouteCalls, 1); + }); + + test('stateStream forwards NavigationState emitted by the controller', () async { + final fakePlatform = FakeFerrostarFlutterPlatform(); + final fakeController = FerrostarController('test', fakePlatform); + + final service = NavigationService( + createController: (osrmJson, waypoints) async => fakeController, + loadNavigationRoute: ({required origin, required destination}) async => { + 'routes': [ + {'distance': 1234} + ] + }, + locationStreamFactory: () => const Stream.empty(), + speakInstruction: (_) async {}, + ); + addTearDown(() => service.dispose()); + + final received = []; + service.stateStream.listen(received.add); + + await service.start( + origin: const WaypointInput(lat: 52.52, lng: 13.405), + destination: const WaypointInput(lat: 52.51, lng: 13.45), + ); + + const state = NavigationState(status: TripStatus.navigating, isOffRoute: false); + fakePlatform.emitState(state); + await pumpEventQueue(); + + expect(received, [state]); + }); +} diff --git a/mobile/test/providers/auth_provider_test.dart b/mobile/test/providers/auth_provider_test.dart new file mode 100644 index 0000000..1a68ef0 --- /dev/null +++ b/mobile/test/providers/auth_provider_test.dart @@ -0,0 +1,33 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:beebeebike/api/client.dart'; +import 'package:beebeebike/providers/auth_provider.dart'; + +void main() { + test('bootstraps anonymous session when /api/auth/me returns 401', () async { + final dio = Dio(BaseOptions(baseUrl: 'https://maps.001.land')); + final adapter = DioAdapter(dio: dio); + dio.httpClientAdapter = adapter; + + adapter.onGet('/api/auth/me', (server) => server.reply(401, {'error': 'unauthorized'})); + adapter.onPost( + '/api/auth/anonymous', + (server) => server.reply(200, { + 'id': 'user-1', + 'account_type': 'anonymous', + 'display_name': '', + 'email': null, + }), + ); + + final container = ProviderContainer(overrides: [ + dioProvider.overrideWithValue(dio), + ]); + addTearDown(container.dispose); + + final user = await container.read(authControllerProvider.future); + expect(user?.accountType, 'anonymous'); + }); +} diff --git a/mobile/test/providers/navigation_provider_test.dart b/mobile/test/providers/navigation_provider_test.dart new file mode 100644 index 0000000..b594ae0 --- /dev/null +++ b/mobile/test/providers/navigation_provider_test.dart @@ -0,0 +1,35 @@ +import 'package:beebeebike/app.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/providers/navigation_provider.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_tts/flutter_tts.dart'; +import 'package:mocktail/mocktail.dart'; + +class MockFlutterTts extends Mock implements FlutterTts {} + +void main() { + test('speakInstruction calls FlutterTts.speak with the given text', () async { + final mockTts = MockFlutterTts(); + when(() => mockTts.speak(any())).thenAnswer((_) async => 1); + + final container = ProviderContainer( + overrides: [ + appConfigProvider.overrideWithValue( + const AppConfig( + apiBaseUrl: 'http://localhost', + tileServerBaseUrl: 'http://localhost', + tileStyleUrl: 'http://localhost/tiles', + ), + ), + flutterTtsProvider.overrideWithValue(mockTts), + ], + ); + addTearDown(container.dispose); + + final service = container.read(navigationServiceProvider); + await service.speakInstruction('Turn left'); + + verify(() => mockTts.speak('Turn left')).called(1); + }); +} diff --git a/mobile/test/providers/route_provider_test.dart b/mobile/test/providers/route_provider_test.dart new file mode 100644 index 0000000..145236c --- /dev/null +++ b/mobile/test/providers/route_provider_test.dart @@ -0,0 +1,29 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:beebeebike/models/location.dart'; +import 'package:beebeebike/models/route_preview.dart'; +import 'package:beebeebike/providers/route_provider.dart'; + +void main() { + test('setDestination computes a preview when origin already exists', () async { + final container = ProviderContainer(overrides: [ + routePreviewLoaderProvider.overrideWithValue( + ({required origin, required destination}) async => RoutePreview( + geometry: const {'type': 'LineString', 'coordinates': []}, + distance: 3200, + time: 720, + ), + ), + ]); + addTearDown(container.dispose); + + await container.read(routeControllerProvider.notifier).setOrigin( + const Location(id: 'o', name: 'origin', label: 'Origin', lng: 13.4, lat: 52.5), + ); + await container.read(routeControllerProvider.notifier).setDestination( + const Location(id: 'd', name: 'destination', label: 'Destination', lng: 13.45, lat: 52.51), + ); + + expect(container.read(routeControllerProvider).preview?.distance, 3200); + }); +} diff --git a/mobile/test/screens/map_screen_navigation_test.dart b/mobile/test/screens/map_screen_navigation_test.dart new file mode 100644 index 0000000..4588f75 --- /dev/null +++ b/mobile/test/screens/map_screen_navigation_test.dart @@ -0,0 +1,159 @@ +import 'dart:async'; + +import 'package:beebeebike/app.dart'; +import 'package:beebeebike/config/app_config.dart'; +import 'package:beebeebike/navigation/camera_controller.dart'; +import 'package:beebeebike/navigation/navigation_service.dart'; +import 'package:beebeebike/providers/navigation_camera_provider.dart'; +import 'package:beebeebike/providers/navigation_provider.dart'; +import 'package:beebeebike/providers/navigation_session_provider.dart'; +import 'package:beebeebike/screens/map_screen.dart'; +import 'package:beebeebike/services/map_style_loader.dart'; +import 'package:beebeebike/widgets/arrived_sheet.dart'; +import 'package:beebeebike/widgets/recenter_fab.dart'; +import 'package:beebeebike/widgets/rerouting_toast.dart'; +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../helpers/test_helpers.dart'; + +NavigationState _baseState({ + TripStatus status = TripStatus.navigating, + bool isOffRoute = false, + UserLocation? snapped, +}) { + return NavigationState( + status: status, + isOffRoute: isOffRoute, + snappedLocation: snapped, + progress: const TripProgress( + distanceToNextManeuverM: 150, + distanceRemainingM: 3200, + durationRemainingMs: 720000, + ), + ); +} + +class _NavHarness { + _NavHarness({ + required this.tester, + required this.navStream, + required this.cam, + required this.rerouteStream, + }); + + final WidgetTester tester; + final StreamController navStream; + final NavigationCameraController cam; + final StreamController rerouteStream; +} + +Future<_NavHarness> _pumpNavActive(WidgetTester tester) async { + SharedPreferences.setMockInitialValues({}); + final prefs = await SharedPreferences.getInstance(); + + final navStream = StreamController.broadcast(); + final rerouteStream = StreamController.broadcast(); + final cam = NavigationCameraController(); + + final fakeService = NavigationService( + createController: (_, __) => throw UnimplementedError(), + loadNavigationRoute: ({required origin, required destination}) => + throw UnimplementedError(), + locationStreamFactory: () => const Stream.empty(), + speakInstruction: (_) async {}, + ); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...testProviderOverrides(prefs: prefs), + appConfigProvider.overrideWithValue( + const AppConfig( + apiBaseUrl: 'http://localhost', + tileServerBaseUrl: 'http://localhost', + tileStyleUrl: 'http://localhost/tiles', + ), + ), + mapStyleProvider.overrideWith((ref) => Future.value('{}')), + navigationSessionProvider.overrideWith((ref) => true), + navigationStateProvider.overrideWith((ref) => navStream.stream), + rerouteInProgressProvider + .overrideWith((ref) => rerouteStream.stream), + navigationServiceProvider.overrideWithValue(fakeService), + navigationCameraControllerProvider.overrideWith((ref) => cam), + ], + child: const MaterialApp(home: MapScreen()), + ), + ); + await tester.pump(); + addTearDown(navStream.close); + addTearDown(rerouteStream.close); + return _NavHarness( + tester: tester, + navStream: navStream, + cam: cam, + rerouteStream: rerouteStream, + ); +} + +Future _triggerRebuild( + WidgetTester tester, StreamController stream) async { + stream.add(_baseState()); + await tester.pump(); +} + +void main() { + testWidgets('recenter FAB hidden initially', (tester) async { + await _pumpNavActive(tester); + expect(find.byType(RecenterFab), findsNothing); + }); + + testWidgets('recenter FAB visible when camera enters free mode', + (tester) async { + final h = await _pumpNavActive(tester); + h.cam.onFirstFix(); + h.cam.onTrackingDismissed(); + await _triggerRebuild(tester, h.navStream); + expect(find.byType(RecenterFab), findsOneWidget); + }); + + testWidgets( + 'rerouting toast follows rerouteInProgress stream (shown when true, hidden when false)', + (tester) async { + final h = await _pumpNavActive(tester); + h.rerouteStream.add(true); + await tester.pump(const Duration(milliseconds: 100)); + expect(find.byType(ReroutingToast), findsOneWidget); + + h.rerouteStream.add(false); + await tester.pump(const Duration(milliseconds: 100)); + expect(find.byType(ReroutingToast), findsNothing); + }); + + testWidgets('arrived sheet replaces ETA sheet on TripStatus.complete', + (tester) async { + final h = await _pumpNavActive(tester); + h.navStream.add(_baseState(status: TripStatus.complete)); + await tester.pump(); + await tester.pump(); + expect(find.byType(ArrivedSheet), findsOneWidget); + }); + + testWidgets('rerouting toast clears when arrival fires while rerouting', + (tester) async { + final h = await _pumpNavActive(tester); + h.rerouteStream.add(true); + await tester.pump(const Duration(milliseconds: 100)); + expect(find.byType(ReroutingToast), findsOneWidget); + + h.navStream.add(_baseState(status: TripStatus.complete)); + await tester.pump(); + await tester.pump(); + expect(find.byType(ArrivedSheet), findsOneWidget); + expect(find.byType(ReroutingToast), findsNothing); + }); +} diff --git a/mobile/test/screens/map_screen_test.dart b/mobile/test/screens/map_screen_test.dart new file mode 100644 index 0000000..01a9d1e --- /dev/null +++ b/mobile/test/screens/map_screen_test.dart @@ -0,0 +1,129 @@ +import 'package:beebeebike/models/route_state.dart'; +import 'package:beebeebike/providers/navigation_session_provider.dart'; +import 'package:beebeebike/providers/route_provider.dart'; +import 'package:beebeebike/screens/map_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../helpers/test_helpers.dart'; + +// --- Stub controllers --- + +class _LoadingRouteController extends RouteController { + @override + RouteState build() => const RouteState(isLoading: true); +} + +class _ErrorRouteController extends RouteController { + @override + RouteState build() => const RouteState(error: 'some error'); +} + +class _PreviewRouteController extends RouteController { + @override + RouteState build() => RouteState(preview: fakePreview()); +} + +// --- Tests --- + +void main() { + setUp(() { + SharedPreferences.setMockInitialValues({}); + }); + + testWidgets('loading state shows CircularProgressIndicator', (tester) async { + final prefs = await SharedPreferences.getInstance(); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...testProviderOverrides(prefs: prefs), + routeControllerProvider.overrideWith(_LoadingRouteController.new), + ], + child: const MaterialApp(home: MapScreen()), + ), + ); + await tester.pump(); + + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); + + testWidgets('error state shows "Could not load route"', (tester) async { + final prefs = await SharedPreferences.getInstance(); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...testProviderOverrides(prefs: prefs), + routeControllerProvider.overrideWith(_ErrorRouteController.new), + ], + child: const MaterialApp(home: MapScreen()), + ), + ); + await tester.pump(); + + expect(find.text('Could not load route'), findsOneWidget); + }); + + testWidgets('preview state shows Start button and route info', (tester) async { + final prefs = await SharedPreferences.getInstance(); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...testProviderOverrides(prefs: prefs), + routeControllerProvider.overrideWith(_PreviewRouteController.new), + ], + child: const MaterialApp(home: MapScreen()), + ), + ); + await tester.pump(); + + // RouteSummary shows a Start button + expect(find.text('Start'), findsOneWidget); + + // time=1200s → 20 min, distance=5000m → 5.0 km + expect(find.textContaining('20 min'), findsOneWidget); + expect(find.textContaining('5.0 km'), findsOneWidget); + }); + + testWidgets('tapping Start flips navigationSessionProvider to true', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + final container = ProviderContainer(overrides: [ + ...testProviderOverrides(prefs: prefs), + routeControllerProvider.overrideWith(_PreviewRouteController.new), + ]); + addTearDown(container.dispose); + + await tester.pumpWidget( + UncontrolledProviderScope( + container: container, + child: const MaterialApp(home: MapScreen()), + ), + ); + await tester.pump(); + + expect(container.read(navigationSessionProvider), isFalse); + expect(find.text('Start'), findsOneWidget); + await tester.tap(find.text('Start')); + await tester.pump(); + + expect(container.read(navigationSessionProvider), isTrue); + }); + + testWidgets('empty state shows Home and Saved places placeholders', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + + await tester.pumpWidget( + buildTestWidget(const MapScreen(), prefs: prefs), + ); + await tester.pump(); + + expect(find.text('Home'), findsOneWidget); + expect(find.text('Saved places'), findsOneWidget); + }); +} diff --git a/mobile/test/screens/search_screen_test.dart b/mobile/test/screens/search_screen_test.dart new file mode 100644 index 0000000..8beacc3 --- /dev/null +++ b/mobile/test/screens/search_screen_test.dart @@ -0,0 +1,151 @@ +import 'package:beebeebike/models/geocode_result.dart'; +import 'package:beebeebike/screens/search_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + setUp(() { + SharedPreferences.setMockInitialValues({}); + }); + + testWidgets('shows search results after typing with debounce', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SearchScreen(), + prefs: prefs, + geocodeReturnsResults: true, + ), + ); + + // Type a search query + await tester.enterText(find.byType(TextField), 'Alex'); + + // Before debounce fires: no results yet (still loading or empty) + await tester.pump(const Duration(milliseconds: 200)); + expect(find.text('Alexanderplatz'), findsNothing); + + // After debounce (400ms) + async response + await tester.pump(const Duration(milliseconds: 300)); + await tester.pumpAndSettle(); + + // Result should appear + expect(find.text('Alexanderplatz'), findsOneWidget); + // Label: district "Mitte" + osm_value "station" → "Mitte · station" + expect(find.text('Mitte · station'), findsOneWidget); + }); + + testWidgets('shows CircularProgressIndicator while loading', (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SearchScreen(), + prefs: prefs, + geocodeReturnsResults: true, + ), + ); + + await tester.enterText(find.byType(TextField), 'Alex'); + + // Advance past the debounce so _search() is called. + // _search() calls setState(_loading = true) before awaiting. + // We pump(Duration.zero) once to process the microtask that sets + // _loading = true, then pump again before the Dio future resolves. + await tester.pump(const Duration(milliseconds: 400)); + // At this point the debounce fired and _search() was invoked. + // The setState for _loading=true runs synchronously in _search before + // the first await, so pump() processes that frame. + await tester.pump(Duration.zero); + + // The mock resolves via a microtask; before it resolves _loading is true. + // If the mock resolves synchronously in the same microtask queue cycle, + // the spinner may already be gone. Accept either state: spinner present + // (loading) or results present (loaded). Verify at least one is shown. + final hasSpinner = + tester.any(find.byType(CircularProgressIndicator)); + final hasResult = tester.any(find.text('Alexanderplatz')); + expect(hasSpinner || hasResult, isTrue, + reason: 'Expected either the loading spinner or the results'); + + // Settle everything — spinner should be gone and results shown + await tester.pumpAndSettle(); + expect(find.byType(CircularProgressIndicator), findsNothing); + expect(find.text('Alexanderplatz'), findsOneWidget); + }); + + testWidgets('shows empty list when geocode returns no results', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SearchScreen(), + prefs: prefs, + geocodeReturnsResults: false, + ), + ); + + await tester.enterText(find.byType(TextField), 'nowhere'); + + // Wait for debounce + response + await tester.pump(const Duration(milliseconds: 400)); + await tester.pumpAndSettle(); + + expect(find.byType(ListTile), findsNothing); + expect(find.text('Alexanderplatz'), findsNothing); + }); + + testWidgets('tapping a result pops with the correct GeocodeResult', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + + GeocodeResult? poppedResult; + + // Wrap SearchScreen in a route so Navigator.pop works and we can capture + // the returned value. + await tester.pumpWidget( + buildTestWidget( + Builder( + builder: (context) => ElevatedButton( + onPressed: () async { + final result = await Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => const SearchScreen(), + ), + ); + poppedResult = result; + }, + child: const Text('Open Search'), + ), + ), + prefs: prefs, + geocodeReturnsResults: true, + ), + ); + + // Open the SearchScreen + await tester.tap(find.text('Open Search')); + await tester.pumpAndSettle(); + + // Type a query and wait for results + await tester.enterText(find.byType(TextField), 'Alex'); + await tester.pump(const Duration(milliseconds: 400)); + await tester.pumpAndSettle(); + + // Tap the result tile + expect(find.text('Alexanderplatz'), findsOneWidget); + await tester.tap(find.text('Alexanderplatz')); + await tester.pumpAndSettle(); + + // Verify the popped value matches the fixture + expect(poppedResult, isNotNull); + expect(poppedResult!.id, 'N:42'); + expect(poppedResult!.name, 'Alexanderplatz'); + expect(poppedResult!.label, 'Mitte · station'); + expect(poppedResult!.lng, 13.4050); + expect(poppedResult!.lat, 52.5200); + }); +} diff --git a/mobile/test/screens/settings_login_test.dart b/mobile/test/screens/settings_login_test.dart new file mode 100644 index 0000000..5264b07 --- /dev/null +++ b/mobile/test/screens/settings_login_test.dart @@ -0,0 +1,163 @@ +import 'package:beebeebike/screens/login_screen.dart'; +import 'package:beebeebike/screens/settings_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + setUp(() { + SharedPreferences.setMockInitialValues({}); + }); + + group('SettingsScreen', () { + testWidgets('shows Log in tile when anonymous (not authenticated)', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SettingsScreen(), + prefs: prefs, + authenticated: false, + ), + ); + await tester.pumpAndSettle(); + + expect(find.text('Log in'), findsOneWidget); + expect(find.text('Log out'), findsNothing); + }); + + testWidgets('Log in tile is enabled (tappable) when anonymous', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SettingsScreen(), + prefs: prefs, + authenticated: false, + ), + ); + await tester.pumpAndSettle(); + + final loginTile = tester.widget( + find.ancestor( + of: find.text('Log in'), + matching: find.byType(ListTile), + ), + ); + expect(loginTile.onTap, isNotNull); + }); + + testWidgets('tapping Log in navigates to LoginScreen', (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SettingsScreen(), + prefs: prefs, + authenticated: false, + ), + ); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Log in')); + await tester.pumpAndSettle(); + + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('shows Log out tile and email when authenticated', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const SettingsScreen(), + prefs: prefs, + authenticated: true, + ), + ); + await tester.pumpAndSettle(); + + expect(find.text('Log out'), findsOneWidget); + expect(find.text('Log in'), findsNothing); + expect(find.text(TestFixtures.loggedInUser['email'] as String), + findsOneWidget); + }); + }); + + group('LoginScreen', () { + testWidgets('renders email and password fields with correct keys', + (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const LoginScreen(), + prefs: prefs, + ), + ); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('login_email')), findsOneWidget); + expect(find.byKey(const Key('login_password')), findsOneWidget); + }); + + testWidgets('shows error message after failed login', (tester) async { + final prefs = await SharedPreferences.getInstance(); + await tester.pumpWidget( + buildTestWidget( + const LoginScreen(), + prefs: prefs, + loginSucceeds: false, + ), + ); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byKey(const Key('login_email')), 'wrong@example.com'); + await tester.enterText( + find.byKey(const Key('login_password')), 'wrongpassword'); + + await tester.tap(find.byType(FilledButton)); + await tester.pumpAndSettle(); + + expect(find.text('Invalid email or password'), findsOneWidget); + }); + + testWidgets('pops screen after successful login', (tester) async { + final prefs = await SharedPreferences.getInstance(); + + // Wrap LoginScreen in a navigator so we can verify the pop + await tester.pumpWidget( + buildTestWidget( + Builder( + builder: (context) => ElevatedButton( + onPressed: () => Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const LoginScreen()), + ), + child: const Text('Open Login'), + ), + ), + prefs: prefs, + loginSucceeds: true, + ), + ); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Open Login')); + await tester.pumpAndSettle(); + + expect(find.byType(LoginScreen), findsOneWidget); + + await tester.enterText( + find.byKey(const Key('login_email')), 'test@example.com'); + await tester.enterText( + find.byKey(const Key('login_password')), 'password123'); + + await tester.tap(find.byType(FilledButton)); + await tester.pumpAndSettle(); + + // LoginScreen should have been popped + expect(find.byType(LoginScreen), findsNothing); + }); + }); +} diff --git a/mobile/test/widgets/arrived_sheet_test.dart b/mobile/test/widgets/arrived_sheet_test.dart new file mode 100644 index 0000000..859c1a0 --- /dev/null +++ b/mobile/test/widgets/arrived_sheet_test.dart @@ -0,0 +1,18 @@ +import 'package:beebeebike/widgets/arrived_sheet.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders Arrived headline and fires onDone when Done tapped', + (tester) async { + var tapped = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold(body: ArrivedSheet(onDone: () => tapped++)), + )); + + expect(find.text('Arrived'), findsOneWidget); + await tester.tap(find.widgetWithText(FilledButton, 'Done')); + await tester.pumpAndSettle(); + expect(tapped, 1); + }); +} diff --git a/mobile/test/widgets/eta_sheet_test.dart b/mobile/test/widgets/eta_sheet_test.dart new file mode 100644 index 0000000..e229964 --- /dev/null +++ b/mobile/test/widgets/eta_sheet_test.dart @@ -0,0 +1,86 @@ +import 'package:beebeebike/widgets/eta_sheet.dart'; +import 'package:ferrostar_flutter/ferrostar_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +NavigationState _state() => const NavigationState( + status: TripStatus.navigating, + isOffRoute: false, + progress: TripProgress( + distanceToNextManeuverM: 120, + distanceRemainingM: 1500, + durationRemainingMs: 360000, + ), + ); + +void main() { + testWidgets('close IconButton fires onClose', (tester) async { + var closed = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: EtaSheet( + navState: AsyncValue.data(_state()), + ttsEnabled: true, + onToggleTts: () {}, + onClose: () => closed++, + ), + ), + )); + final closeBtn = find.widgetWithIcon(IconButton, Icons.close); + expect(closeBtn, findsOneWidget); + await tester.tap(closeBtn); + await tester.pumpAndSettle(); + expect(closed, 1); + }); + + testWidgets('tts IconButton toggles tts icon via onToggleTts', + (tester) async { + var toggled = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: EtaSheet( + navState: AsyncValue.data(_state()), + ttsEnabled: true, + onToggleTts: () => toggled++, + onClose: () {}, + ), + ), + )); + expect(find.byIcon(Icons.volume_up), findsOneWidget); + await tester.tap(find.byIcon(Icons.volume_up)); + await tester.pumpAndSettle(); + expect(toggled, 1); + }); + + testWidgets('renders volume_off icon when ttsEnabled is false', + (tester) async { + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: EtaSheet( + navState: AsyncValue.data(_state()), + ttsEnabled: false, + onToggleTts: () {}, + onClose: () {}, + ), + ), + )); + expect(find.byIcon(Icons.volume_off), findsOneWidget); + expect(find.byIcon(Icons.volume_up), findsNothing); + }); + + testWidgets('shows loading fallback when navState is loading', + (tester) async { + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: EtaSheet( + navState: const AsyncValue.loading(), + ttsEnabled: true, + onToggleTts: () {}, + onClose: () {}, + ), + ), + )); + expect(find.text('Loading...'), findsOneWidget); + }); +} diff --git a/mobile/test/widgets/recenter_fab_test.dart b/mobile/test/widgets/recenter_fab_test.dart new file mode 100644 index 0000000..cac3ef2 --- /dev/null +++ b/mobile/test/widgets/recenter_fab_test.dart @@ -0,0 +1,18 @@ +import 'package:beebeebike/widgets/recenter_fab.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders my_location icon and fires onTap when tapped', + (tester) async { + var tapped = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold(body: RecenterFab(onTap: () => tapped++)), + )); + + expect(find.byIcon(Icons.my_location), findsOneWidget); + await tester.tap(find.byType(RecenterFab)); + await tester.pumpAndSettle(); + expect(tapped, 1); + }); +} diff --git a/mobile/test/widgets/rerouting_toast_test.dart b/mobile/test/widgets/rerouting_toast_test.dart new file mode 100644 index 0000000..4974b4c --- /dev/null +++ b/mobile/test/widgets/rerouting_toast_test.dart @@ -0,0 +1,13 @@ +import 'package:beebeebike/widgets/rerouting_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders text and spinner', (tester) async { + await tester.pumpWidget(const MaterialApp( + home: Scaffold(body: ReroutingToast()), + )); + expect(find.text('Rerouting…'), findsOneWidget); + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); +} diff --git a/mobile/test/widgets/route_summary_test.dart b/mobile/test/widgets/route_summary_test.dart new file mode 100644 index 0000000..8cd8339 --- /dev/null +++ b/mobile/test/widgets/route_summary_test.dart @@ -0,0 +1,67 @@ +import 'package:beebeebike/widgets/route_summary.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('renders duration and distance', (tester) async { + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: RouteSummary( + durationMinutes: 12, + distanceKm: 3.4, + onStart: () {}, + ), + ), + )); + expect(find.textContaining('12 min'), findsOneWidget); + expect(find.textContaining('3.4 km'), findsOneWidget); + }); + + testWidgets('Start button fires onStart', (tester) async { + var tapped = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: RouteSummary( + durationMinutes: 12, + distanceKm: 3.4, + onStart: () => tapped++, + ), + ), + )); + await tester.tap(find.widgetWithText(FilledButton, 'Start')); + await tester.pumpAndSettle(); + expect(tapped, 1); + }); + + testWidgets('close button hidden when onClose is null', (tester) async { + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: RouteSummary( + durationMinutes: 12, + distanceKm: 3.4, + onStart: () {}, + ), + ), + )); + expect(find.byIcon(Icons.close), findsNothing); + }); + + testWidgets('close button visible and fires onClose when provided', + (tester) async { + var closed = 0; + await tester.pumpWidget(MaterialApp( + home: Scaffold( + body: RouteSummary( + durationMinutes: 12, + distanceKm: 3.4, + onStart: () {}, + onClose: () => closed++, + ), + ), + )); + expect(find.byIcon(Icons.close), findsOneWidget); + await tester.tap(find.byIcon(Icons.close)); + await tester.pumpAndSettle(); + expect(closed, 1); + }); +} diff --git a/packages/ferrostar_flutter/analysis_options.yaml b/packages/ferrostar_flutter/analysis_options.yaml index 1a66281..3882ff4 100644 --- a/packages/ferrostar_flutter/analysis_options.yaml +++ b/packages/ferrostar_flutter/analysis_options.yaml @@ -7,6 +7,7 @@ analyzer: errors: missing_required_param: error missing_return: error + invalid_annotation_target: ignore exclude: - "**/*.g.dart" - "**/*.freezed.dart" diff --git a/packages/ferrostar_flutter/example/test/widget_test.dart b/packages/ferrostar_flutter/example/test/widget_test.dart index 6c16710..7f8f990 100644 --- a/packages/ferrostar_flutter/example/test/widget_test.dart +++ b/packages/ferrostar_flutter/example/test/widget_test.dart @@ -1,27 +1,11 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:ferrostar_flutter_example/main.dart'; void main() { - testWidgets('Verify Platform version', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that platform version is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && widget.data!.startsWith('Running on:'), - ), - findsOneWidget, - ); + testWidgets('E2EHome renders without error', (WidgetTester tester) async { + await tester.pumpWidget(const MaterialApp(home: E2EHome())); + expect(find.byType(Scaffold), findsOneWidget); }); } diff --git a/packages/ferrostar_flutter/test/method_channel_platform_test.dart b/packages/ferrostar_flutter/test/method_channel_platform_test.dart index 06abdb3..dc20f25 100644 --- a/packages/ferrostar_flutter/test/method_channel_platform_test.dart +++ b/packages/ferrostar_flutter/test/method_channel_platform_test.dart @@ -48,10 +48,10 @@ void main() { expect(id, 'ctrl-1'); expect(log, hasLength(1)); expect(log.first.method, 'createController'); - final args = log.first.arguments as Map; - expect(args['osrm_json'], isA()); - expect((args['waypoints'] as List), hasLength(2)); - expect(args['config'], isA()); + final args = log.first.arguments as Map; + expect(args['osrm_json'], isA>()); + expect((args['waypoints'] as List), hasLength(2)); + expect(args['config'], isA>()); }); test('updateLocation sends controller_id and location map', () async { diff --git a/frontend/.gitignore b/web/.gitignore similarity index 100% rename from frontend/.gitignore rename to web/.gitignore diff --git a/frontend/README.md b/web/README.md similarity index 100% rename from frontend/README.md rename to web/README.md diff --git a/frontend/index.html b/web/index.html similarity index 100% rename from frontend/index.html rename to web/index.html diff --git a/frontend/jsconfig.json b/web/jsconfig.json similarity index 100% rename from frontend/jsconfig.json rename to web/jsconfig.json diff --git a/frontend/package-lock.json b/web/package-lock.json similarity index 97% rename from frontend/package-lock.json rename to web/package-lock.json index 1cbb127..96203a2 100644 --- a/frontend/package-lock.json +++ b/web/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@turf/buffer": "^7.3.4", "@turf/helpers": "^7.3.4", + "@versatiles/style": "^5.10.2", "maplibre-gl": "^5.23.0" }, "devDependencies": { @@ -685,6 +686,15 @@ "dev": true, "license": "MIT" }, + "node_modules/@versatiles/style": { + "version": "5.10.2", + "resolved": "https://registry.npmjs.org/@versatiles/style/-/style-5.10.2.tgz", + "integrity": "sha512-ORtYQZ8M0e/XKvZ+pvr9G2m0YVKNddqPHT6cDMVkcuAe1a/KVodRx1/GkooimudqI1X2LmQ2feY+Q0EGeu3TYg==", + "license": "MIT", + "dependencies": { + "brace-expansion": "^5.0.5" + } + }, "node_modules/acorn": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", @@ -718,6 +728,27 @@ "node": ">= 0.4" } }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", + "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", diff --git a/frontend/package.json b/web/package.json similarity index 75% rename from frontend/package.json rename to web/package.json index d7abf0b..7950e02 100644 --- a/frontend/package.json +++ b/web/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "build:mobile-style": "node scripts/build-mobile-style.mjs" }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^7.0.0", @@ -16,6 +17,7 @@ "dependencies": { "@turf/buffer": "^7.3.4", "@turf/helpers": "^7.3.4", + "@versatiles/style": "^5.10.2", "maplibre-gl": "^5.23.0" } } diff --git a/frontend/public/assets/maplibre-gl/maplibre-gl.css b/web/public/assets/maplibre-gl/maplibre-gl.css similarity index 100% rename from frontend/public/assets/maplibre-gl/maplibre-gl.css rename to web/public/assets/maplibre-gl/maplibre-gl.css diff --git a/frontend/public/assets/welcome-intro.mp4 b/web/public/assets/welcome-intro.mp4 similarity index 100% rename from frontend/public/assets/welcome-intro.mp4 rename to web/public/assets/welcome-intro.mp4 diff --git a/frontend/public/assets/welcome-route.png b/web/public/assets/welcome-route.png similarity index 100% rename from frontend/public/assets/welcome-route.png rename to web/public/assets/welcome-route.png diff --git a/frontend/public/favicon.svg b/web/public/favicon.svg similarity index 100% rename from frontend/public/favicon.svg rename to web/public/favicon.svg diff --git a/frontend/public/icons.svg b/web/public/icons.svg similarity index 100% rename from frontend/public/icons.svg rename to web/public/icons.svg diff --git a/web/scripts/build-mobile-style.mjs b/web/scripts/build-mobile-style.mjs new file mode 100644 index 0000000..f726593 --- /dev/null +++ b/web/scripts/build-mobile-style.mjs @@ -0,0 +1,30 @@ +#!/usr/bin/env node +// Builds mobile/assets/styles/beebeebike-style.json by running +// `buildBicycleStyle` (which wraps `@versatiles/style`) with placeholder URLs. +// The mobile app substitutes `{{TILE_BASE}}` with `AppConfig.tileServerBaseUrl` +// at runtime. +// +// Usage: +// npm --prefix web run build:mobile-style + +import { writeFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import { dirname, resolve } from 'node:path'; + +import { buildBicycleStyle } from '../src/lib/bicycle-style.js'; + +const TILE_BASE = '{{TILE_BASE}}'; + +const style = buildBicycleStyle({ + tilesUrl: `${TILE_BASE}/tiles/osm/{z}/{x}/{y}`, + glyphsUrl: `${TILE_BASE}/assets/glyphs/{fontstack}/{range}.pbf`, + spriteUrl: `${TILE_BASE}/assets/sprites/basics/sprites`, + mobile: true, +}); + +const here = dirname(fileURLToPath(import.meta.url)); +const outPath = resolve(here, '../../mobile/assets/styles/beebeebike-style.json'); +writeFileSync(outPath, `${JSON.stringify(style, null, '\t')}\n`); + +const sizeKb = (JSON.stringify(style).length / 1024).toFixed(1); +console.log(`wrote ${outPath} (${sizeKb} KB)`); diff --git a/frontend/src/App.svelte b/web/src/App.svelte similarity index 100% rename from frontend/src/App.svelte rename to web/src/App.svelte diff --git a/frontend/src/components/AuthModal.svelte b/web/src/components/AuthModal.svelte similarity index 100% rename from frontend/src/components/AuthModal.svelte rename to web/src/components/AuthModal.svelte diff --git a/frontend/src/components/Map.svelte b/web/src/components/Map.svelte similarity index 100% rename from frontend/src/components/Map.svelte rename to web/src/components/Map.svelte diff --git a/frontend/src/components/PreferencesPanel.svelte b/web/src/components/PreferencesPanel.svelte similarity index 100% rename from frontend/src/components/PreferencesPanel.svelte rename to web/src/components/PreferencesPanel.svelte diff --git a/frontend/src/components/RoutePanel.svelte b/web/src/components/RoutePanel.svelte similarity index 100% rename from frontend/src/components/RoutePanel.svelte rename to web/src/components/RoutePanel.svelte diff --git a/frontend/src/components/SearchBar.svelte b/web/src/components/SearchBar.svelte similarity index 100% rename from frontend/src/components/SearchBar.svelte rename to web/src/components/SearchBar.svelte diff --git a/frontend/src/components/Toolbar.svelte b/web/src/components/Toolbar.svelte similarity index 100% rename from frontend/src/components/Toolbar.svelte rename to web/src/components/Toolbar.svelte diff --git a/frontend/src/components/WelcomeModal.svelte b/web/src/components/WelcomeModal.svelte similarity index 100% rename from frontend/src/components/WelcomeModal.svelte rename to web/src/components/WelcomeModal.svelte diff --git a/frontend/src/components/ZoomControls.svelte b/web/src/components/ZoomControls.svelte similarity index 100% rename from frontend/src/components/ZoomControls.svelte rename to web/src/components/ZoomControls.svelte diff --git a/frontend/src/lib/api.js b/web/src/lib/api.js similarity index 100% rename from frontend/src/lib/api.js rename to web/src/lib/api.js diff --git a/frontend/src/lib/auth.svelte.js b/web/src/lib/auth.svelte.js similarity index 100% rename from frontend/src/lib/auth.svelte.js rename to web/src/lib/auth.svelte.js diff --git a/frontend/src/lib/map.js b/web/src/lib/bicycle-style.js similarity index 66% rename from frontend/src/lib/map.js rename to web/src/lib/bicycle-style.js index c5a4f5f..d825938 100644 --- a/frontend/src/lib/map.js +++ b/web/src/lib/bicycle-style.js @@ -1,11 +1,13 @@ -import maplibregl from 'maplibre-gl'; +// Pure style builder shared between the web app (runtime) and the mobile +// build script (offline). Wraps `@versatiles/style`'s `colorful` style with a +// bicycle-planning palette and an extra set of bike-priority layers. +// +// To regenerate the mobile asset after editing this file: +// npm --prefix web run build:mobile-style -const STYLE_URL = '/tiles/assets/styles/colorful/style.json'; -const LOCAL_TILE_PATH = '/tiles/tiles/osm/{z}/{x}/{y}'; -const LOCAL_GLYPHS_PATH = '/tiles/assets/glyphs/{fontstack}/{range}.pbf'; -const LOCAL_SPRITE_PATH = '/tiles/assets/sprites/basics/sprites'; +import { colorful } from '@versatiles/style'; -const COLORS = { +export const COLORS = { background: '#f8f4ec', water: '#b8dcef', park: '#cfe7bc', @@ -25,103 +27,68 @@ const COLORS = { caution: '#b8795d', }; -const DEFAULT_CENTER = [13.405, 52.52]; -const DEFAULT_ZOOM = 12; +// `colorful` requires baseUrl to parse as a URL. We override tile/sprite/glyph +// URLs explicitly afterwards, so this hostname is never fetched. +const BASE_URL_PLACEHOLDER = 'http://placeholder.local'; -export async function createMap(container, { center, zoom } = {}) { - const style = await loadBicycleStyle(); - const map = new maplibregl.Map({ - container, - style, - center: center || DEFAULT_CENTER, - zoom: zoom ?? DEFAULT_ZOOM, - maxBounds: [[12.9, 52.2], [13.9, 52.8]], +/** + * Build a MapLibre style for bicycle planning. + * + * @param {object} opts + * @param {string} opts.tilesUrl — URL template for vector tiles ({z}/{x}/{y}) + * @param {string} opts.glyphsUrl — URL template for glyph PBFs ({fontstack}/{range}) + * @param {string} opts.spriteUrl — base URL for the sprite atlas + * @param {boolean} [opts.mobile=false] — bump label sizes for mobile devices + */ +export function buildBicycleStyle({ tilesUrl, glyphsUrl, spriteUrl, mobile = false }) { + const style = colorful({ + baseUrl: BASE_URL_PLACEHOLDER, + colors: { + land: COLORS.background, + water: COLORS.water, + park: COLORS.park, + leisure: COLORS.park, + wood: COLORS.forest, + grass: COLORS.grass, + building: COLORS.building, + buildingbg: COLORS.buildingShadow, + street: COLORS.localRoad, + streetbg: COLORS.localRoadCasing, + motorway: COLORS.arterial, + motorwaybg: COLORS.arterialCasing, + trunk: COLORS.arterial, + trunkbg: COLORS.arterialCasing, + labelHalo: 'rgba(248,244,236,0.9)', + }, }); - - return map; -} - -async function loadBicycleStyle() { - const response = await fetch(STYLE_URL); - if (!response.ok) { - throw new Error(`Failed to load map style: ${response.status}`); - } - - return optimizeStyleForBicycleRouting(await response.json()); -} - -export function optimizeStyleForBicycleRouting(style) { style.name = 'beebeebike-bicycle-planning'; - style.glyphs = absoluteUrl(LOCAL_GLYPHS_PATH); - style.sprite = [{ id: 'basics', url: absoluteUrl(LOCAL_SPRITE_PATH) }]; - + style.glyphs = glyphsUrl; + style.sprite = [{ id: 'basics', url: spriteUrl }]; for (const source of Object.values(style.sources ?? {})) { if (source.type === 'vector') { - source.tiles = [absoluteUrl(LOCAL_TILE_PATH)]; + source.tiles = [tilesUrl]; source.scheme = 'xyz'; } } - style.layers = style.layers.map(tuneLayerForCycling); + style.layers = style.layers.map((layer) => tuneLayerForCycling(layer, { mobile })); insertBicyclePlanningLayers(style); return style; } -function absoluteUrl(path) { - const origin = globalThis.location?.origin ?? 'http://127.0.0.1:5175'; - return `${origin.replace(/\/$/, '')}${path}`; -} - -function tuneLayerForCycling(layer) { +function tuneLayerForCycling(layer, { mobile }) { const next = { ...layer, paint: { ...(layer.paint ?? {}) }, ...(layer.layout ? { layout: { ...layer.layout } } : {}), }; - if (next.id === 'background') { - next.paint['background-color'] = COLORS.background; - } - - if (next.id.startsWith('water-')) { - if (next.type === 'fill') next.paint['fill-color'] = COLORS.water; - if (next.type === 'line') next.paint['line-color'] = COLORS.water; - } - - const landColors = { - 'land-park': COLORS.park, - 'land-garden': COLORS.park, - 'land-leisure': COLORS.park, - 'land-forest': COLORS.forest, - 'land-grass': COLORS.grass, - 'land-vegetation': '#d5e4bf', - 'land-commercial': '#f0e3e5', - 'land-industrial': '#efe6ce', - 'land-residential': '#ebe7df', - }; - if (landColors[next.id]) { - next.paint['fill-color'] = landColors[next.id]; - } - - if (next.id === 'building:outline') { - next.paint['fill-color'] = COLORS.buildingShadow; - } if (next.id === 'building') { - next.paint['fill-color'] = COLORS.building; next.paint['fill-translate'] = [-1, -1]; } - if (next.type === 'line' && isArterialLayer(next.id)) { - next.paint['line-color'] = isCasingLayer(next.id) ? COLORS.arterialCasing : COLORS.arterial; - next.paint['line-opacity'] = isCasingLayer(next.id) ? 0.7 : 0.92; - } - - if (next.type === 'line' && isLocalStreetLayer(next.id)) { - next.paint['line-color'] = isCasingLayer(next.id) ? COLORS.localRoadCasing : COLORS.localRoad; - } - if (next.type === 'line' && next.id.includes('way-steps')) { next.paint['line-color'] = COLORS.caution; next.paint['line-opacity'] = 0.7; @@ -136,15 +103,28 @@ function tuneLayerForCycling(layer) { next.paint['icon-opacity'] = { stops: [[15, 0], [16, 0.55], [20, 0.55]] }; } - if (next.type === 'symbol' && next.paint?.['text-halo-color']) { - next.paint['text-halo-color'] = 'rgba(248,244,236,0.9)'; + if (mobile && next.type === 'symbol' && next.layout?.['text-size'] != null) { + next.layout = { ...next.layout, 'text-size': scaleTextSize(next.layout['text-size'], 1.15) }; } return next; } +function scaleTextSize(value, factor) { + if (typeof value === 'number') return Math.round(value * factor * 10) / 10; + if (value && Array.isArray(value.stops)) { + return { + ...value, + stops: value.stops.map(([z, s]) => [z, Math.round(s * factor * 10) / 10]), + }; + } + return value; +} + function insertBicyclePlanningLayers(style) { - const beforeId = style.layers.find((layer) => layer.type === 'symbol' && layer.id.startsWith('label-'))?.id; + const beforeId = style.layers.find( + (layer) => layer.type === 'symbol' && layer.id.startsWith('label-'), + )?.id; const insertAt = beforeId ? style.layers.findIndex((layer) => layer.id === beforeId) : style.layers.length; @@ -306,15 +286,3 @@ function bicyclePlanningLayers() { }, ]; } - -function isArterialLayer(id) { - return /(^|-)street-(motorway|trunk|primary|secondary)(-|:|$)/.test(id); -} - -function isLocalStreetLayer(id) { - return /(^|-)street-(residential|livingstreet|unclassified|service|pedestrian|track)(:|$)/.test(id); -} - -function isCasingLayer(id) { - return id.includes(':outline') || id.includes(':bridge'); -} diff --git a/frontend/src/lib/brush.svelte.js b/web/src/lib/brush.svelte.js similarity index 100% rename from frontend/src/lib/brush.svelte.js rename to web/src/lib/brush.svelte.js diff --git a/frontend/src/lib/locations.svelte.js b/web/src/lib/locations.svelte.js similarity index 100% rename from frontend/src/lib/locations.svelte.js rename to web/src/lib/locations.svelte.js diff --git a/web/src/lib/map.js b/web/src/lib/map.js new file mode 100644 index 0000000..7239240 --- /dev/null +++ b/web/src/lib/map.js @@ -0,0 +1,33 @@ +import maplibregl from 'maplibre-gl'; + +import { buildBicycleStyle } from './bicycle-style.js'; + +const LOCAL_TILE_PATH = '/tiles/tiles/osm/{z}/{x}/{y}'; +const LOCAL_GLYPHS_PATH = '/tiles/assets/glyphs/{fontstack}/{range}.pbf'; +const LOCAL_SPRITE_PATH = '/tiles/assets/sprites/basics/sprites'; + +const DEFAULT_CENTER = [13.405, 52.52]; +const DEFAULT_ZOOM = 12; + +export async function createMap(container, { center, zoom } = {}) { + const style = buildBicycleStyle({ + tilesUrl: absoluteUrl(LOCAL_TILE_PATH), + glyphsUrl: absoluteUrl(LOCAL_GLYPHS_PATH), + spriteUrl: absoluteUrl(LOCAL_SPRITE_PATH), + }); + + return new maplibregl.Map({ + container, + style, + center: center || DEFAULT_CENTER, + zoom: zoom ?? DEFAULT_ZOOM, + maxBounds: [[12.9, 52.2], [13.9, 52.8]], + }); +} + +function absoluteUrl(path) { + const origin = globalThis.location?.origin ?? 'http://127.0.0.1:5175'; + return `${origin.replace(/\/$/, '')}${path}`; +} + +export { buildBicycleStyle }; diff --git a/frontend/src/lib/overlay.js b/web/src/lib/overlay.js similarity index 100% rename from frontend/src/lib/overlay.js rename to web/src/lib/overlay.js diff --git a/frontend/src/lib/paintGesture.js b/web/src/lib/paintGesture.js similarity index 100% rename from frontend/src/lib/paintGesture.js rename to web/src/lib/paintGesture.js diff --git a/frontend/src/lib/preferences.svelte.js b/web/src/lib/preferences.svelte.js similarity index 100% rename from frontend/src/lib/preferences.svelte.js rename to web/src/lib/preferences.svelte.js diff --git a/frontend/src/lib/routing.svelte.js b/web/src/lib/routing.svelte.js similarity index 100% rename from frontend/src/lib/routing.svelte.js rename to web/src/lib/routing.svelte.js diff --git a/frontend/src/main.js b/web/src/main.js similarity index 100% rename from frontend/src/main.js rename to web/src/main.js diff --git a/frontend/svelte.config.js b/web/svelte.config.js similarity index 100% rename from frontend/svelte.config.js rename to web/svelte.config.js diff --git a/frontend/vite.config.js b/web/vite.config.js similarity index 100% rename from frontend/vite.config.js rename to web/vite.config.js