Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/dependencies/initialization_js.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// ignore_for_file: avoid_web_libraries_in_flutter, deprecated_member_use

import 'dart:html' as html;

Future<void> $platformInitialization() async {
//Удаляем сплеш-скрин
html.document.getElementById('splash')?.remove();
}
14 changes: 14 additions & 0 deletions lib/dependencies/initialization_vm.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'dart:io' as io;

Future<void> $platformInitialization() =>
io.Platform.isAndroid || io.Platform.isIOS
? _mobileInitialization()
: _desktopInitialization();

Future<void> _mobileInitialization() async {
/* Initialize mobile dependencies */
}

Future<void> _desktopInitialization() async {
/* Initialize desktop dependencies */
}
25 changes: 17 additions & 8 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -20,6 +25,7 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
WidgetsBinding.instance.allowFirstFrame();
return Scaffold(
body: DecoratedBox(
decoration: BoxDecoration(
Expand Down Expand Up @@ -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(
"Войти",
Expand Down
30 changes: 15 additions & 15 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Binary file added web/favicon.ico
Binary file not shown.
Binary file removed web/favicon.png
Binary file not shown.
Binary file modified web/icons/Icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/icons/Icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed web/icons/Icon-maskable-192.png
Binary file not shown.
Binary file removed web/icons/Icon-maskable-512.png
Binary file not shown.
Binary file added web/icons/icon-192-maskable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/icons/icon-512-maskable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 125 additions & 16 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.

The path provided below has to start and end with a slash "/" in order for
it to work correctly.

For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base href="$FLUTTER_BASE_HREF">

<meta charset="UTF-8">
Expand All @@ -27,12 +14,134 @@
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<link rel="icon" type="image/ico" href="favicon.ico"/>

<title>map_tanks</title>
<title>Map Tanks</title>
<link rel="manifest" href="manifest.json">
<style>
body {
margin: 0;
padding: 0;
background: linear-gradient(135deg, white 0%, white 100%);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#splash {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
position: relative;
z-index: 2;
}

.splash-logo-container {
position: relative;
width: 160px;
height: 160px;
margin-bottom: 30px;
}

.splash-logo {
width: 120px;
height: 120px;
background: url("icons/Icon-192.png") no-repeat center/contain;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
filter: drop-shadow(0 0 10px rgba(66, 220, 219, 0.5));
animation: pulse 2s infinite ease-in-out;
}

#splash-branding {
font-size: 32px;
font-weight: 700;
margin-bottom: 20px;
text-shadow: 0 0 10px rgba(66, 220, 245, 0.7);
background: linear-gradient(90deg, green, black, #42f578);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
letter-spacing: 1px;
}

.loading-text {
font-size: 16px;
color: #b0b0b0;
margin-top: 10px;
font-weight: 300;
letter-spacing: 2px;
}

.loading-dots {
display: inline-flex;
gap: 4px;
}

.dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #42dcf5;
animation: dots 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

.progress-bar {
width: 200px;
height: 4px;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
margin-top: 20px;
overflow: hidden;
}

@keyframes pulse {
0% { transform: translate(-50%, -50%) scale(1); }
50% { transform: translate(-50%, -50%) scale(1.05); }
100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes dots {
0%, 80%, 100% { transform: scale(0); }
40% { transform: scale(1); }
}

</style>
</head>
<body>
<div id="splash">
<div class="splash-logo-container">
<div class="splash-logo"></div>
</div>

<div id="splash-branding">MAP TANKS</div>

<div class="loading-text">
LOADING
<span class="loading-dots">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</span>
</div>

<div class="loading-text">
<div class="progress-fill"></div>
</div>
</div>

<script src="flutter_bootstrap.js" async></script>
</body>
</html>
</html>