Skip to content

Commit

Permalink
chore(example): added WASM support to example (fleaflet#1885)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffaKetchup authored Sep 12, 2024
1 parent 93e51e7 commit 7632ccc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Web Application
run: flutter build web --web-renderer canvaskit
run: flutter build web --wasm
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Web Application
run: flutter build web --web-renderer canvaskit
run: flutter build web --wasm
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
9 changes: 9 additions & 0 deletions example/lib/widgets/drawer/menu_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map_example/pages/animated_map_controller.dart';
import 'package:flutter_map_example/pages/bundled_offline_map.dart';
Expand Down Expand Up @@ -33,6 +34,8 @@ import 'package:flutter_map_example/pages/tile_loading_error_handle.dart';
import 'package:flutter_map_example/pages/wms_tile_layer.dart';
import 'package:flutter_map_example/widgets/drawer/menu_item.dart';

const _isWASM = bool.fromEnvironment('dart.tool.dart2wasm');

class MenuDrawer extends StatelessWidget {
final String currentRoute;

Expand Down Expand Up @@ -61,6 +64,12 @@ class MenuDrawer extends StatelessWidget {
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14),
),
if (kIsWeb)
const Text(
_isWASM ? 'Running with WASM' : 'Running without WASM',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14),
),
],
),
),
Expand Down
8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ dependencies:
flutter:
sdk: flutter
flutter_map:
flutter_map_cancellable_tile_provider: ^3.0.0
flutter_map_cancellable_tile_provider: ^3.0.2
flutter_map_geojson: ^1.0.8
http: ^1.2.1
http: ^1.2.2
latlong2: ^0.9.1
proj4dart: ^2.1.0
shared_preferences: ^2.2.3
shared_preferences: ^2.3.2
url_launcher: ^6.3.0
url_strategy: ^0.2.0
url_strategy: ^0.3.0
vector_math: ^2.1.4

dependency_overrides:
Expand Down
17 changes: 16 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Cross-Origin-Embedder-Policy",
"value": "credentialless"
},
{
"key": "Cross-Origin-Opener-Policy",
"value": "same-origin"
}
]
}
]
}
}
}

0 comments on commit 7632ccc

Please sign in to comment.