Skip to content

Commit 02470c1

Browse files
committedJan 23, 2024
modernize more
1 parent f92423c commit 02470c1

8 files changed

+87
-298
lines changed
 

‎README.md

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ This is just the visual web frontend. See [skyhook](https://github.com/Commit451
1010
flutter build web
1111
```
1212

13-
## Refs
14-
- https://github.com/mateenkiani/theming_flutter
15-
- https://medium.com/py-bits/turn-any-color-to-material-color-for-flutter-d8e8e037a837
16-
1713
## License
1814
skyhook-web is available under the MIT license. See the LICENSE file for more info.
1915

‎lib/api/skyhook_api.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
22
import 'dart:convert';
3+
34
import 'package:http/http.dart' as http;
45
import 'package:skyhook/model/provider.dart';
56

‎lib/main.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
23
import 'skyhook_app.dart';
34

45
void main() {

‎lib/model/provider.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Provider {
99
path = json['path'];
1010

1111
Map<String, dynamic> toJson() => {
12-
'name': name,
13-
'path': path,
14-
};
15-
}
12+
'name': name,
13+
'path': path,
14+
};
15+
}

‎lib/skyhook_app.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class SkyhookApp extends StatelessWidget {
88
@override
99
Widget build(BuildContext context) {
1010
return MaterialApp(
11-
title: 'SDPilates',
11+
title: 'skyhook',
1212
debugShowCheckedModeBanner: false,
1313
theme: ThemeData(
1414
colorScheme: ColorScheme.fromSeed(

‎pubspec.lock

+40-200
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
sha256: "271b8899fc99f9df4f4ed419fa14e2fff392c7b2c162fbb87b222e2e963ddc73"
8+
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.9.0"
11+
version: "2.11.0"
1212
characters:
1313
dependency: transitive
1414
description:
@@ -17,14 +17,6 @@ packages:
1717
url: "https://pub.dev"
1818
source: hosted
1919
version: "1.3.0"
20-
charcode:
21-
dependency: transitive
22-
description:
23-
name: charcode
24-
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
25-
url: "https://pub.dev"
26-
source: hosted
27-
version: "1.3.1"
2820
collection:
2921
dependency: transitive
3022
description:
@@ -33,22 +25,6 @@ packages:
3325
url: "https://pub.dev"
3426
source: hosted
3527
version: "1.18.0"
36-
ffi:
37-
dependency: transitive
38-
description:
39-
name: ffi
40-
sha256: "35d0f481d939de0d640b3db9a7aa36a52cd22054a798a73b4f50bdad5ce12678"
41-
url: "https://pub.dev"
42-
source: hosted
43-
version: "1.1.2"
44-
file:
45-
dependency: transitive
46-
description:
47-
name: file
48-
sha256: b69516f2c26a5bcac4eee2e32512e1a5205ab312b3536c1c1227b2b942b5f9ad
49-
url: "https://pub.dev"
50-
source: hosted
51-
version: "6.1.2"
5228
flutter:
5329
dependency: "direct main"
5430
description: flutter
@@ -58,10 +34,10 @@ packages:
5834
dependency: "direct dev"
5935
description:
6036
name: flutter_lints
61-
sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
37+
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
6238
url: "https://pub.dev"
6339
source: hosted
64-
version: "1.0.4"
40+
version: "3.0.1"
6541
flutter_web_plugins:
6642
dependency: transitive
6743
description: flutter
@@ -71,26 +47,26 @@ packages:
7147
dependency: "direct main"
7248
description:
7349
name: http
74-
sha256: "2ed163531e071c2c6b7c659635112f24cb64ecbebf6af46b550d536c0b1aa112"
50+
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba
7551
url: "https://pub.dev"
7652
source: hosted
77-
version: "0.13.4"
53+
version: "1.2.0"
7854
http_parser:
7955
dependency: transitive
8056
description:
8157
name: http_parser
82-
sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185
58+
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
8359
url: "https://pub.dev"
8460
source: hosted
85-
version: "4.0.0"
61+
version: "4.0.2"
8662
lints:
8763
dependency: transitive
8864
description:
8965
name: lints
90-
sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
66+
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
9167
url: "https://pub.dev"
9268
source: hosted
93-
version: "1.0.1"
69+
version: "3.0.0"
9470
material_color_utilities:
9571
dependency: transitive
9672
description:
@@ -107,142 +83,22 @@ packages:
10783
url: "https://pub.dev"
10884
source: hosted
10985
version: "1.10.0"
110-
nested:
111-
dependency: transitive
112-
description:
113-
name: nested
114-
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
115-
url: "https://pub.dev"
116-
source: hosted
117-
version: "1.0.0"
11886
path:
11987
dependency: transitive
12088
description:
12189
name: path
122-
sha256: "240ed0e9bd73daa2182e33c4efc68c7dd53c7c656f3da73515a2d163e151412d"
90+
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
12391
url: "https://pub.dev"
12492
source: hosted
125-
version: "1.8.1"
126-
path_provider_linux:
127-
dependency: transitive
128-
description:
129-
name: path_provider_linux
130-
sha256: "1e109f4df28bd95eab71e323008b53d19c4d633bc1ab05b577518773474e9621"
131-
url: "https://pub.dev"
132-
source: hosted
133-
version: "2.1.5"
134-
path_provider_platform_interface:
135-
dependency: transitive
136-
description:
137-
name: path_provider_platform_interface
138-
sha256: "3dc0d51b07f85fec3746d9f4e8d31c73bb173cafa2e763f03f8df2e8d1878882"
139-
url: "https://pub.dev"
140-
source: hosted
141-
version: "2.0.3"
142-
path_provider_windows:
143-
dependency: transitive
144-
description:
145-
name: path_provider_windows
146-
sha256: "366ad4e3541ea707f859e7148d4d5aba67d589d7936cee04a05c464a277eeb27"
147-
url: "https://pub.dev"
148-
source: hosted
149-
version: "2.0.5"
150-
platform:
151-
dependency: transitive
152-
description:
153-
name: platform
154-
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
155-
url: "https://pub.dev"
156-
source: hosted
157-
version: "3.1.0"
93+
version: "1.9.0"
15894
plugin_platform_interface:
15995
dependency: transitive
16096
description:
16197
name: plugin_platform_interface
162-
sha256: "075f927ebbab4262ace8d0b283929ac5410c0ac4e7fc123c76429564facfb757"
98+
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
16399
url: "https://pub.dev"
164100
source: hosted
165-
version: "2.1.2"
166-
process:
167-
dependency: transitive
168-
description:
169-
name: process
170-
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
171-
url: "https://pub.dev"
172-
source: hosted
173-
version: "4.2.4"
174-
provider:
175-
dependency: "direct main"
176-
description:
177-
name: provider
178-
sha256: "7896193cf752c40ba7f7732a95264319a787871e5d628225357f5c909182bc06"
179-
url: "https://pub.dev"
180-
source: hosted
181-
version: "6.0.2"
182-
shared_preferences:
183-
dependency: "direct main"
184-
description:
185-
name: shared_preferences
186-
sha256: "1cd0c3c0be0826eb52362ab018a81eed13b616ad9a52548c6ceb1bb349e6b6eb"
187-
url: "https://pub.dev"
188-
source: hosted
189-
version: "2.0.13"
190-
shared_preferences_android:
191-
dependency: transitive
192-
description:
193-
name: shared_preferences_android
194-
sha256: bc236594233d10b7668dd90414fe0e09d906115aaa1dfe269e478e5f2af532a6
195-
url: "https://pub.dev"
196-
source: hosted
197-
version: "2.0.11"
198-
shared_preferences_ios:
199-
dependency: transitive
200-
description:
201-
name: shared_preferences_ios
202-
sha256: "69d593a80fee48b97c66787eb930cdd42941c1537e80a1ff88a8c12a926c47d4"
203-
url: "https://pub.dev"
204-
source: hosted
205-
version: "2.1.0"
206-
shared_preferences_linux:
207-
dependency: transitive
208-
description:
209-
name: shared_preferences_linux
210-
sha256: ac361c65c4cf342dfc0a8b9e45eab66b9b3ad6eaff9785850d4ec0cf6b474422
211-
url: "https://pub.dev"
212-
source: hosted
213-
version: "2.1.0"
214-
shared_preferences_macos:
215-
dependency: transitive
216-
description:
217-
name: shared_preferences_macos
218-
sha256: f063907c3f678de8daa033d234b7c9e420df5fe3d499a97bfb82cc30cf171496
219-
url: "https://pub.dev"
220-
source: hosted
221-
version: "2.0.3"
222-
shared_preferences_platform_interface:
223-
dependency: transitive
224-
description:
225-
name: shared_preferences_platform_interface
226-
sha256: "992f0fdc46d0a3c0ac2e5859f2de0e577bbe51f78a77ee8f357cbe626a2ad32d"
227-
url: "https://pub.dev"
228-
source: hosted
229-
version: "2.0.0"
230-
shared_preferences_web:
231-
dependency: transitive
232-
description:
233-
name: shared_preferences_web
234-
sha256: "09da0185028a227d51721cade7a3cbd5cc5f163a19593266f2acba87f729bf9c"
235-
url: "https://pub.dev"
236-
source: hosted
237-
version: "2.0.3"
238-
shared_preferences_windows:
239-
dependency: transitive
240-
description:
241-
name: shared_preferences_windows
242-
sha256: ae68cf0df0910e38c95522dbd8a6082ce9715053c369750c5709d17de81d032e
243-
url: "https://pub.dev"
244-
source: hosted
245-
version: "2.1.0"
101+
version: "2.1.8"
246102
sky_engine:
247103
dependency: transitive
248104
description: flutter
@@ -252,98 +108,98 @@ packages:
252108
dependency: transitive
253109
description:
254110
name: source_span
255-
sha256: e3320978e3715725e62f04358fd249c1efe5999297b2c6acd626a817593281b0
111+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
256112
url: "https://pub.dev"
257113
source: hosted
258-
version: "1.9.0"
114+
version: "1.10.0"
259115
string_scanner:
260116
dependency: transitive
261117
description:
262118
name: string_scanner
263-
sha256: dd11571b8a03f7cadcf91ec26a77e02bfbd6bbba2a512924d3116646b4198fc4
119+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
264120
url: "https://pub.dev"
265121
source: hosted
266-
version: "1.1.0"
122+
version: "1.2.0"
267123
term_glyph:
268124
dependency: transitive
269125
description:
270126
name: term_glyph
271-
sha256: a88162591b02c1f3a3db3af8ce1ea2b374bd75a7bb8d5e353bcfbdc79d719830
127+
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
272128
url: "https://pub.dev"
273129
source: hosted
274-
version: "1.2.0"
130+
version: "1.2.1"
275131
typed_data:
276132
dependency: transitive
277133
description:
278134
name: typed_data
279-
sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee"
135+
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
280136
url: "https://pub.dev"
281137
source: hosted
282-
version: "1.3.0"
138+
version: "1.3.2"
283139
url_launcher:
284140
dependency: "direct main"
285141
description:
286142
name: url_launcher
287-
sha256: "2d9de5efddbd134ee68d73d0735e7477c00bcbf1ee91afa37514d6c876d38587"
143+
sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c
288144
url: "https://pub.dev"
289145
source: hosted
290-
version: "6.1.0"
146+
version: "6.2.4"
291147
url_launcher_android:
292148
dependency: transitive
293149
description:
294150
name: url_launcher_android
295-
sha256: "25072592e1bb3a12cf4fabd0cef79c2682ab5b0c81bf367eb535c299f081a34e"
151+
sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f"
296152
url: "https://pub.dev"
297153
source: hosted
298-
version: "6.0.16"
154+
version: "6.2.2"
299155
url_launcher_ios:
300156
dependency: transitive
301157
description:
302158
name: url_launcher_ios
303-
sha256: e51a93f0da65733beb69fdbc43cea524d86ed8e524479e9faefc9304cec34a57
159+
sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03"
304160
url: "https://pub.dev"
305161
source: hosted
306-
version: "6.0.15"
162+
version: "6.2.4"
307163
url_launcher_linux:
308164
dependency: transitive
309165
description:
310166
name: url_launcher_linux
311-
sha256: c3ec89d52305ec647cf037eafe2be8d2f1149b5723d1f2ec716fc3d58469de5d
167+
sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811
312168
url: "https://pub.dev"
313169
source: hosted
314-
version: "3.0.0"
170+
version: "3.1.1"
315171
url_launcher_macos:
316172
dependency: transitive
317173
description:
318174
name: url_launcher_macos
319-
sha256: c028c7f80fdb99cf48b94c471c0f8b9b855a188f4865df76e2a7663ae640e9d2
175+
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
320176
url: "https://pub.dev"
321177
source: hosted
322-
version: "3.0.0"
178+
version: "3.1.0"
323179
url_launcher_platform_interface:
324180
dependency: transitive
325181
description:
326182
name: url_launcher_platform_interface
327-
sha256: "1b9c4dab07794498b83b5f938e26b20f68c3b460a3015b0307f9541cb34ef93d"
183+
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
328184
url: "https://pub.dev"
329185
source: hosted
330-
version: "2.0.5"
186+
version: "2.3.1"
331187
url_launcher_web:
332188
dependency: transitive
333189
description:
334190
name: url_launcher_web
335-
sha256: "2b5494722d4eb0fe1a12ceb15a4b132ba7dfc92793089c243bf109bed828d97f"
191+
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b
336192
url: "https://pub.dev"
337193
source: hosted
338-
version: "2.0.9"
194+
version: "2.2.3"
339195
url_launcher_windows:
340196
dependency: transitive
341197
description:
342198
name: url_launcher_windows
343-
sha256: aa14bdb9265fa22416fc387b33e44eb37fd38768bf465fafcec73d283f3457b1
199+
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
344200
url: "https://pub.dev"
345201
source: hosted
346-
version: "3.0.0"
202+
version: "3.1.1"
347203
vector_math:
348204
dependency: transitive
349205
description:
@@ -360,22 +216,6 @@ packages:
360216
url: "https://pub.dev"
361217
source: hosted
362218
version: "0.3.0"
363-
win32:
364-
dependency: transitive
365-
description:
366-
name: win32
367-
sha256: "4658d864d83cdaedcbf3e65ad93b71880a3e8c9ee1ff15d855f88fb2da66cb8a"
368-
url: "https://pub.dev"
369-
source: hosted
370-
version: "2.5.2"
371-
xdg_directories:
372-
dependency: transitive
373-
description:
374-
name: xdg_directories
375-
sha256: "060b6e1c891d956f72b5ac9463466c37cce3fa962a921532fc001e86fe93438e"
376-
url: "https://pub.dev"
377-
source: hosted
378-
version: "0.2.0+1"
379219
sdks:
380-
dart: ">=3.2.0-194.0.dev <4.0.0"
381-
flutter: ">=2.10.0"
220+
dart: ">=3.2.0 <4.0.0"
221+
flutter: ">=3.16.0"

‎pubspec.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ environment:
99
sdk: ">=2.16.0 <3.0.0"
1010

1111
dependencies:
12-
http: 0.13.4
12+
http: ^1.2.0
1313
url_launcher: ^6.1.0
14-
shared_preferences: ^2.0.13
15-
provider: ^6.0.2
1614
flutter:
1715
sdk: flutter
1816

1917
dev_dependencies:
20-
flutter_lints: ^1.0.4
18+
flutter_lints: ^3.0.1
2119

2220
flutter:
2321

‎web/index.html

+38-85
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,52 @@
11
<!DOCTYPE html>
22
<html>
33
<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.
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.
77
8-
The path provided below has to start and end with a slash "/" in order for
9-
it to work correctly.
8+
The path provided below has to start and end with a slash "/" in order for
9+
it to work correctly.
1010
11-
For more details:
12-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
11+
For more details:
12+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
1313
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">
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">
1818

19-
<meta charset="UTF-8">
20-
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21-
<meta name="description" content="Website for skyhook">
19+
<meta charset="UTF-8">
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21+
<meta name="description" content="skyhook">
2222

23-
<!-- Favicon -->
24-
<link rel="icon" type="image/png" href="favicon.png"/>
23+
<!-- Favicon -->
24+
<link rel="icon" type="image/png" href="favicon.png"/>
2525

26-
<title>skyhook</title>
27-
</head>
28-
29-
<!-- Eagerly setting this to a dark theme before all the js stuff loads -->
30-
<body style="background-color:#303030;">
31-
<!-- This script installs service_worker.js to provide PWA functionality to
32-
application. For more information, see:
33-
https://developers.google.com/web/fundamentals/primers/service-workers -->
34-
<script>
35-
var serviceWorkerVersion = null;
36-
var scriptLoaded = false;
37-
function loadMainDartJs() {
38-
if (scriptLoaded) {
39-
return;
40-
}
41-
scriptLoaded = true;
42-
var scriptTag = document.createElement('script');
43-
scriptTag.src = 'main.dart.js';
44-
scriptTag.type = 'application/javascript';
45-
document.body.append(scriptTag);
46-
}
26+
<title>skyhook</title>
4727

48-
if ('serviceWorker' in navigator) {
49-
// Service workers are supported. Use them.
50-
window.addEventListener('load', function () {
51-
// Wait for registration to finish before dropping the <script> tag.
52-
// Otherwise, the browser will load the script multiple times,
53-
// potentially different versions.
54-
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
55-
navigator.serviceWorker.register(serviceWorkerUrl)
56-
.then((reg) => {
57-
function waitForActivation(serviceWorker) {
58-
serviceWorker.addEventListener('statechange', () => {
59-
if (serviceWorker.state == 'activated') {
60-
console.log('Installed new service worker.');
61-
loadMainDartJs();
62-
}
63-
});
64-
}
65-
if (!reg.active && (reg.installing || reg.waiting)) {
66-
// No active web worker and we have installed or are installing
67-
// one for the first time. Simply wait for it to activate.
68-
waitForActivation(reg.installing || reg.waiting);
69-
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
70-
// When the app updates the serviceWorkerVersion changes, so we
71-
// need to ask the service worker to update.
72-
console.log('New service worker available.');
73-
reg.update();
74-
waitForActivation(reg.installing);
75-
} else {
76-
// Existing service worker is still good.
77-
console.log('Loading app from service worker.');
78-
loadMainDartJs();
79-
}
28+
<script>
29+
// The value below is injected by flutter build, do not touch.
30+
const serviceWorkerVersion = null;
31+
</script>
32+
<!-- This script adds the flutter initialization JS code -->
33+
<script src="flutter.js" defer></script>
34+
</head>
35+
<body>
36+
<script>
37+
window.addEventListener('load', function(ev) {
38+
// Download main.dart.js
39+
_flutter.loader.loadEntrypoint({
40+
serviceWorker: {
41+
serviceWorkerVersion: serviceWorkerVersion,
42+
},
43+
onEntrypointLoaded: function(engineInitializer) {
44+
engineInitializer.initializeEngine().then(function(appRunner) {
45+
appRunner.runApp();
8046
});
81-
82-
// If service worker doesn't succeed in a reasonable amount of time,
83-
// fallback to plaint <script> tag.
84-
setTimeout(() => {
85-
if (!scriptLoaded) {
86-
console.warn(
87-
'Failed to load app from service worker. Falling back to plain <script> tag.',
88-
);
89-
loadMainDartJs();
90-
}
91-
}, 4000);
47+
}
9248
});
93-
} else {
94-
// Service workers not supported. Just drop the <script> tag.
95-
loadMainDartJs();
96-
}
97-
</script>
49+
});
50+
</script>
9851
</body>
9952
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.