diff --git a/pkgs/dartpad_ui/web/flutter_bootstrap.js b/pkgs/dartpad_ui/web/flutter_bootstrap.js new file mode 100644 index 000000000..a3a9638cd --- /dev/null +++ b/pkgs/dartpad_ui/web/flutter_bootstrap.js @@ -0,0 +1,28 @@ +{{flutter_js}} +{{flutter_build_config}} + +const serviceWorkerSettings = { + serviceWorkerVersion: {{flutter_service_worker_version}} +}; + +_flutter.loader.load({ + serviceWorkerSettings, +}); + +const splash = document.querySelector('#splash'); + +_initSplashTheme(); + +window.addEventListener('flutter-first-frame', () => { + splash.classList.add('done'); + + setTimeout(() => splash.remove(), 500); +}); + +async function _initSplashTheme() { + const queryParams = new URLSearchParams(window.location.search); + const queryTheme = queryParams.get('theme'); + const theme = ['light', 'dark'].includes(queryTheme) ? queryTheme : 'dark'; + + splash.classList.add(theme); +} diff --git a/pkgs/dartpad_ui/web/icons/Icon.svg b/pkgs/dartpad_ui/web/icons/Icon.svg new file mode 100644 index 000000000..0ae2d2a58 --- /dev/null +++ b/pkgs/dartpad_ui/web/icons/Icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pkgs/dartpad_ui/web/index.html b/pkgs/dartpad_ui/web/index.html index cd0867d87..af490df1d 100644 --- a/pkgs/dartpad_ui/web/index.html +++ b/pkgs/dartpad_ui/web/index.html @@ -8,83 +8,37 @@ - + + - +