diff --git a/lib/dependencies/initialization_js.dart b/lib/dependencies/initialization_js.dart new file mode 100644 index 0000000..2b0c53f --- /dev/null +++ b/lib/dependencies/initialization_js.dart @@ -0,0 +1,8 @@ +// ignore_for_file: avoid_web_libraries_in_flutter, deprecated_member_use + +import 'dart:html' as html; + +Future $platformInitialization() async { + //Удаляем сплеш-скрин + html.document.getElementById('splash')?.remove(); +} diff --git a/lib/dependencies/initialization_vm.dart b/lib/dependencies/initialization_vm.dart new file mode 100644 index 0000000..dea48b6 --- /dev/null +++ b/lib/dependencies/initialization_vm.dart @@ -0,0 +1,14 @@ +import 'dart:io' as io; + +Future $platformInitialization() => + io.Platform.isAndroid || io.Platform.isIOS + ? _mobileInitialization() + : _desktopInitialization(); + +Future _mobileInitialization() async { + /* Initialize mobile dependencies */ +} + +Future _desktopInitialization() async { + /* Initialize desktop dependencies */ +} diff --git a/lib/main.dart b/lib/main.dart index 79e47ff..5b898e5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,11 +1,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:map_tanks/constants.dart'; -import 'src/v1/tanks_map.dart' as v1; +import 'src/v1/tanks_map.dart' deferred as v1; +import 'dependencies/initialization_vm.dart' + // ignore: uri_does_not_exist + if (dart.library.html) 'dependencies/initialization_js.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); + WidgetsBinding.instance.deferFirstFrame(); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + $platformInitialization(); runApp( const MaterialApp( debugShowCheckedModeBanner: false, @@ -20,6 +25,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + WidgetsBinding.instance.allowFirstFrame(); return Scaffold( body: DecoratedBox( decoration: BoxDecoration( @@ -81,13 +87,16 @@ class MyApp extends StatelessWidget { style: ElevatedButton.styleFrom( backgroundColor: Colors.green, ), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const v1.TanksMap(), - ), - ); + onPressed: () async { + await v1.loadLibrary(); + if (context.mounted) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => v1.TanksMap(), + ), + ); + } }, child: const Text( "Войти", diff --git a/pubspec.lock b/pubspec.lock index 5b91ca6..9234a50 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.3" ffi: dependency: transitive description: @@ -159,26 +159,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.8" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -223,10 +223,10 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mgrs_dart: dependency: transitive description: @@ -364,10 +364,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.7" typed_data: dependency: transitive description: @@ -396,10 +396,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -433,5 +433,5 @@ packages: source: hosted version: "1.1.0" sdks: - dart: ">=3.7.2 <4.0.0" + dart: ">=3.8.0-0 <4.0.0" flutter: ">=3.29.0" diff --git a/web/favicon.ico b/web/favicon.ico new file mode 100644 index 0000000..d251fae Binary files /dev/null and b/web/favicon.ico differ diff --git a/web/favicon.png b/web/favicon.png deleted file mode 100644 index 8aaa46a..0000000 Binary files a/web/favicon.png and /dev/null differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png index b749bfe..9871e9a 100644 Binary files a/web/icons/Icon-192.png and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png index 88cfd48..6450d76 100644 Binary files a/web/icons/Icon-512.png and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png deleted file mode 100644 index eb9b4d7..0000000 Binary files a/web/icons/Icon-maskable-192.png and /dev/null differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png deleted file mode 100644 index d69c566..0000000 Binary files a/web/icons/Icon-maskable-512.png and /dev/null differ diff --git a/web/icons/icon-192-maskable.png b/web/icons/icon-192-maskable.png new file mode 100644 index 0000000..06b398c Binary files /dev/null and b/web/icons/icon-192-maskable.png differ diff --git a/web/icons/icon-512-maskable.png b/web/icons/icon-512-maskable.png new file mode 100644 index 0000000..0f6a80f Binary files /dev/null and b/web/icons/icon-512-maskable.png differ diff --git a/web/index.html b/web/index.html index 3e7d4d9..62c6583 100644 --- a/web/index.html +++ b/web/index.html @@ -1,19 +1,6 @@ - @@ -27,12 +14,134 @@ - + - map_tanks + Map Tanks + +
+
+ +
+ +
MAP TANKS
+ +
+ LOADING + + + + + +
+ +
+
+
+
+ - + \ No newline at end of file