Skip to content

Commit fbadb47

Browse files
committed
Make sure the web project build
1 parent de5cd84 commit fbadb47

File tree

11 files changed

+137
-6
lines changed

11 files changed

+137
-6
lines changed

example/.metadata

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: db747aa1331bd95bc9b3874c842261ca2d302cd5
7+
revision: c07f7888888435fd9df505aa2efc38d3cf65681b
88
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
17+
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
18+
- platform: web
19+
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
20+
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bool _initialUriIsHandled = false;
1414
Future<void> main() async {
1515
WidgetsFlutterBinding.ensureInitialized();
1616

17-
if (Platform.isWindows) {
17+
if (!kIsWeb && Platform.isWindows) {
1818
registerProtocol('unilinks');
1919
}
2020

example/web/favicon.png

917 Bytes
Loading

example/web/icons/Icon-192.png

5.17 KB
Loading

example/web/icons/Icon-512.png

8.06 KB
Loading
5.46 KB
Loading
20.5 KB
Loading

example/web/index.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<!--
5+
If you are serving your web app in a path other than the root, change the
6+
href value below to reflect the base path you are serving from.
7+
8+
The path provided below has to start and end with a slash "/" in order for
9+
it to work correctly.
10+
11+
For more details:
12+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13+
14+
This is a placeholder for base href that will be replaced by the value of
15+
the `--base-href` argument provided to `flutter build`.
16+
-->
17+
<base href="$FLUTTER_BASE_HREF">
18+
19+
<meta charset="UTF-8">
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21+
<meta name="description" content="A new Flutter project.">
22+
23+
<!-- iOS meta tags & icons -->
24+
<meta name="apple-mobile-web-app-capable" content="yes">
25+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
26+
<meta name="apple-mobile-web-app-title" content="example">
27+
<link rel="apple-touch-icon" href="icons/Icon-192.png">
28+
29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png"/>
31+
32+
<title>example</title>
33+
<link rel="manifest" href="manifest.json">
34+
35+
<script>
36+
// The value below is injected by flutter build, do not touch.
37+
var serviceWorkerVersion = null;
38+
</script>
39+
<!-- This script adds the flutter initialization JS code -->
40+
<script src="flutter.js" defer></script>
41+
</head>
42+
<body>
43+
<script>
44+
window.addEventListener('load', function(ev) {
45+
// Download main.dart.js
46+
_flutter.loader.loadEntrypoint({
47+
serviceWorker: {
48+
serviceWorkerVersion: serviceWorkerVersion,
49+
},
50+
onEntrypointLoaded: function(engineInitializer) {
51+
engineInitializer.initializeEngine().then(function(appRunner) {
52+
appRunner.runApp();
53+
});
54+
}
55+
});
56+
});
57+
</script>
58+
</body>
59+
</html>

example/web/manifest.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "example",
3+
"short_name": "example",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#0175C2",
7+
"theme_color": "#0175C2",
8+
"description": "A new Flutter project.",
9+
"orientation": "portrait-primary",
10+
"prefer_related_applications": false,
11+
"icons": [
12+
{
13+
"src": "icons/Icon-192.png",
14+
"sizes": "192x192",
15+
"type": "image/png"
16+
},
17+
{
18+
"src": "icons/Icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png"
21+
},
22+
{
23+
"src": "icons/Icon-maskable-192.png",
24+
"sizes": "192x192",
25+
"type": "image/png",
26+
"purpose": "maskable"
27+
},
28+
{
29+
"src": "icons/Icon-maskable-512.png",
30+
"sizes": "512x512",
31+
"type": "image/png",
32+
"purpose": "maskable"
33+
}
34+
]
35+
}

lib/src/protocol_registrar.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import 'dart:io';
22

3+
import 'package:flutter/foundation.dart';
34
import 'package:uni_links_desktop/src/protocol_registrar_impl_macos.dart';
4-
import 'package:uni_links_desktop/src/protocol_registrar_impl_windows.dart';
5+
import 'package:uni_links_desktop/src/protocol_registrar_impl_windows.dart'
6+
if (dart.library.html) 'package:uni_links_desktop/src/protocol_registrar_impl_windows_noop.dart';
57

68
class ProtocolRegistrar {
79
/// The shared instance of [ProtocolRegistrar].
810
static ProtocolRegistrar get instance {
9-
if (Platform.isMacOS) return ProtocolRegistrarImplMacOS.instance;
10-
if (Platform.isWindows) return ProtocolRegistrarImplWindows.instance;
11+
if (!kIsWeb && Platform.isMacOS) {
12+
return ProtocolRegistrarImplMacOS.instance;
13+
} else if (!kIsWeb && Platform.isWindows) {
14+
return ProtocolRegistrarImplWindows.instance;
15+
}
1116
return ProtocolRegistrar();
1217
}
1318

0 commit comments

Comments
 (0)