Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(example): added WASM support to example #1885

Merged
merged 11 commits into from
Sep 12, 2024
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"
}
]
}
]
}
}
}
Loading