diff --git a/lib/main.dart b/lib/main.dart index 67f7099..ac84150 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,8 @@ +import 'dart:js_interop'; + +import 'package:device_preview/device_preview.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:device_preview/device_preview.dart'; import 'package:ht_main/app/config/config.dart'; import 'package:ht_main/bootstrap.dart'; @@ -9,6 +11,9 @@ import 'package:ht_main/bootstrap.dart'; // production/development/demo const currentEnvironment = AppEnvironment.demo; +@JS('removeSplashFromWeb') +external void removeSplashFromWeb(); + void main() async { final appConfig = switch (currentEnvironment) { AppEnvironment.production => AppConfig.production(), @@ -18,13 +23,17 @@ void main() async { final appWidget = await bootstrap(appConfig); + // Only remove the splash screen on web after the app is ready. + if (kIsWeb) { + removeSplashFromWeb(); + } + if (appConfig.environment == AppEnvironment.demo) { runApp( DevicePreview( enabled: true, builder: (context) => appWidget, tools: const [DeviceSection()], - ), ); } else { diff --git a/pubspec.lock b/pubspec.lock index 5227bc8..419477c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -501,10 +501,18 @@ packages: dependency: transitive description: name: js - sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.6.7" + js_interop: + dependency: "direct main" + description: + name: js_interop + sha256: "7ec859c296958ccea34dc770504bd3ff4ae52fdd9e7eeb2bacc7081ad476a1f5" + url: "https://pub.dev" + source: hosted + version: "0.0.1" json_annotation: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d418951..92c2945 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,6 +57,7 @@ dependencies: git: url: https://github.com/headlines-toolkit/ht-shared.git intl: ^0.20.2 + js_interop: ^0.0.1 meta: ^1.16.0 share_plus: ^11.0.0 stream_transform: ^2.1.1 diff --git a/web/index.html b/web/index.html index 1ebfb85..81eb366 100644 --- a/web/index.html +++ b/web/index.html @@ -31,14 +31,14 @@ +
+
+
- \ No newline at end of file +