diff --git a/.gitignore b/.gitignore index bb431f0..da4f20a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ .pub/ build/ +#web secrets +example/web/ + # Android related **/android/**/gradle-wrapper.jar **/android/.gradle diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9d204d4..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "dart.flutterSdkPath": "/Users/mac/fvm/versions/2.10.5" -} \ No newline at end of file diff --git a/example/.metadata b/example/.metadata index 4adf4bf..d00a406 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,27 @@ # This file should be version controlled and should not be manually edited. version: - revision: f139b11009aeb8ed2a3a3aa8b0066e482709dde3 - channel: stable + revision: "d211f42860350d914a5ad8102f9ec32764dc6d06" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: web + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/lib/main.dart b/example/lib/main.dart index 2cd8396..e5cbe8c 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -82,7 +82,7 @@ class _HomeBodyState extends State { height: 45, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.blue, + backgroundColor: Colors.blue, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10)), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 42524eb..82d3675 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,58 +5,82 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.2" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "1.0.8" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + url: "https://pub.dev" + source: hosted + version: "1.3.2" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -66,9 +90,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: "5a1e6fb2c0561958d7e4c33574674bda7b77caaca7a33b758876956f2902eea3" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.27" flutter_test: dependency: "direct dev" description: flutter @@ -83,189 +108,342 @@ packages: dependency: transitive description: name: geolocator - url: "https://pub.dartlang.org" + sha256: f62bcd90459e63210bbf9c35deb6a51c521f992a78de19a1fe5c11704f9530e2 + url: "https://pub.dev" source: hosted - version: "8.2.1" + version: "13.0.4" geolocator_android: dependency: transitive description: name: geolocator_android - url: "https://pub.dartlang.org" + sha256: fcb1760a50d7500deca37c9a666785c047139b5f9ee15aa5469fae7dbbe3170d + url: "https://pub.dev" source: hosted - version: "3.1.8" + version: "4.6.2" geolocator_apple: dependency: transitive description: name: geolocator_apple - url: "https://pub.dartlang.org" + sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.13" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - url: "https://pub.dartlang.org" + sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" + url: "https://pub.dev" source: hosted - version: "4.0.5" + version: "4.2.6" geolocator_web: dependency: transitive description: name: geolocator_web - url: "https://pub.dartlang.org" + sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172 + url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "4.1.3" geolocator_windows: dependency: transitive description: name: geolocator_windows - url: "https://pub.dartlang.org" + sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" + url: "https://pub.dev" + source: hosted + version: "0.2.5" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "4d6e199c561ca06792c964fa24b2bac7197bf4b401c2e1d23e345e5f9939f531" + url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "8.1.1" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - url: "https://pub.dartlang.org" + sha256: "830d8f7b51b4a950bf0d7daa675324fed6c9beb57a7ecca2a59018270c96b4e0" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.12.1" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "0ede4ae8326335c0c007c8c7a8c9737449263123385e2bdf49f3e71103b2dc2e" + url: "https://pub.dev" + source: hosted + version: "2.16.0" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: "2911e0c5654c2cc0d664324e0f49f055bb748740162821bdc0285045150b0439" + url: "https://pub.dev" + source: hosted + version: "2.15.1" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - url: "https://pub.dartlang.org" + sha256: "970c8f766c02909c7be282dea923c971f83a88adaf07f8871d0aacebc3b07bb2" + url: "https://pub.dev" + source: hosted + version: "2.11.1" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: a45786ea6691cc7cdbe2cf3ce2c2daf4f82a885745666b4a36baada3a4e12897 + url: "https://pub.dev" + source: hosted + version: "0.5.12" + html: + dependency: transitive + description: + name: html + sha256: "9475be233c437f0e3637af55e7702cbbe5c23a68bd56e8a5fa2d426297b7c6c8" + url: "https://pub.dev" + source: hosted + version: "0.15.5+1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + url: "https://pub.dev" + source: hosted + version: "10.0.8" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" source: hosted - version: "2.0.1" - js: + version: "3.0.9" + leak_tracker_testing: dependency: transitive description: - name: js - url: "https://pub.dartlang.org" + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" source: hosted - version: "0.6.3" + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.16.0" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.8" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: "57210410680379aea8b1b7ed6ae0c3ad349bfd56fe845b8ea934a53344b9d523" + url: "https://pub.dev" + source: hosted + version: "0.10.1+2" + pointer_interceptor_ios: + dependency: transitive + description: + name: pointer_interceptor_ios + sha256: a6906772b3205b42c44614fcea28f818b1e5fdad73a4ca742a7bd49818d9c917 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + pointer_interceptor_platform_interface: + dependency: transitive + description: + name: pointer_interceptor_platform_interface + sha256: "0597b0560e14354baeb23f8375cd612e8bd4841bf8306ecb71fcd0bb78552506" + url: "https://pub.dev" + source: hosted + version: "0.10.0+1" + pointer_interceptor_web: + dependency: transitive + description: + name: pointer_interceptor_web + sha256: "7a7087782110f8c1827170660b09f8aa893e0e9a61431dbbe2ac3fc482e8c044" + url: "https://pub.dev" + source: hosted + version: "0.10.2+1" polymaker: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.0.3" + version: "1.0.4" provider: dependency: transitive description: name: provider - url: "https://pub.dartlang.org" + sha256: "489024f942069c2920c844ee18bb3d467c69e48955a4f32d1677f71be103e310" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "2.1.0" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "7.0.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.4.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.2" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" source: hosted - version: "0.4.8" + version: "0.7.4" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.dev" + source: hosted + version: "4.5.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + url: "https://pub.dev" + source: hosted + version: "14.3.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" sdks: - dart: ">=2.15.0 <3.0.0" - flutter: ">=2.8.0" + dart: ">=3.7.0-0 <3.13.8" + flutter: ">=3.27.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index d34d7e7..684e18b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,10 +4,10 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.12.0 <3.13.8' dependencies: - cupertino_icons: ^0.1.2 + cupertino_icons: "any" flutter: sdk: flutter google_maps_flutter: any diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart new file mode 100644 index 0000000..9322cd7 --- /dev/null +++ b/example/test/widget_test.dart @@ -0,0 +1,28 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + // await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/lib/core/viewmodels/map_provider.dart b/lib/core/viewmodels/map_provider.dart index a98c7f5..65216d7 100644 --- a/lib/core/viewmodels/map_provider.dart +++ b/lib/core/viewmodels/map_provider.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:math'; -import 'dart:typed_data'; import 'dart:ui'; import 'dart:math' as math; // import 'dart:math' show cos, sqrt, asin; @@ -14,6 +13,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:polymaker/core/models/trackingmode.dart'; class MapProvider extends ChangeNotifier { + bool _disposed = false; + ///------------------------/// /// PROPERTY SECTIONS /// ///------------------------/// @@ -121,6 +122,20 @@ class MapProvider extends ChangeNotifier { bool _onInitCamera = false; bool get onInitCamera => _onInitCamera; + //overides to squash bugs of trying to call disposed MapProvider + @override + void dispose() { + _disposed = true; + super.dispose(); + } + + @override + void notifyListeners() { + if (!_disposed) { + super.notifyListeners(); + } + } + ///------------------------/// /// FUNCTION SECTIONS /// ///------------------------/// @@ -181,23 +196,36 @@ class MapProvider extends ChangeNotifier { final serviceEnable = await Geolocator.isLocationServiceEnabled(); if (serviceEnable) { var permission = await Geolocator.checkPermission(); - if ((permission != LocationPermission.always || permission != LocationPermission.whileInUse)) { + if ((permission != LocationPermission.always || + permission != LocationPermission.whileInUse)) { permission = await Geolocator.requestPermission(); } currentPos = await Geolocator.getCurrentPosition(); } else { currentPos = Position( - latitude: Platform.isAndroid ? 0 : -6.215412, - longitude: Platform.isAndroid ? 0 : 106.777773, - timestamp: DateTime.now(), accuracy: 0, altitude: 0, heading: 0, speed: 0, speedAccuracy: 0 - ); + latitude: Platform.isAndroid ? 0 : -6.215412, + longitude: Platform.isAndroid ? 0 : 106.777773, + timestamp: DateTime.now(), + accuracy: 0, + altitude: 0, + heading: 0, + speed: 0, + speedAccuracy: 0, + altitudeAccuracy: 3.0, + headingAccuracy: 3.0); } - } catch(_) { + } catch (_) { currentPos = Position( - latitude: Platform.isAndroid ? 0 : -6.215412, - longitude: Platform.isAndroid ? 0 : 106.777773, - timestamp: DateTime.now(), accuracy: 0, altitude: 0, heading: 0, speed: 0, speedAccuracy: 0 - ); + latitude: Platform.isAndroid ? 0 : -6.215412, + longitude: Platform.isAndroid ? 0 : 106.777773, + timestamp: DateTime.now(), + accuracy: 0, + altitude: 0, + heading: 0, + speed: 0, + speedAccuracy: 0, + altitudeAccuracy: 3.0, + headingAccuracy: 3.0); } _sourceLocation = LatLng(currentPos.latitude, currentPos.longitude); @@ -206,7 +234,6 @@ class MapProvider extends ChangeNotifier { print(e.toString()); initLocation(); } - notifyListeners(); } @@ -363,7 +390,7 @@ class MapProvider extends ChangeNotifier { void addGpsLocation({TrackingMode? mode = TrackingMode.PLANAR}) async { Position position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.high); + locationSettings: LocationSettings(accuracy: LocationAccuracy.high)); var _location = new LatLng(position.latitude, position.longitude); if (isEditMode == true) { ///Find center position between two coordinate @@ -411,7 +438,7 @@ class MapProvider extends ChangeNotifier { markerId: MarkerId("${uniqueID + id}"), position: _location, draggable: enableDragMarker, - icon: BitmapDescriptor.fromBytes(markerIcon!), + icon: BitmapDescriptor.bytes(markerIcon!), onDragEnd: (newLoc) { if (enableDragMarker) { updateNewMarkerLocation(id, newLoc); @@ -469,7 +496,7 @@ class MapProvider extends ChangeNotifier { polygonId: PolygonId(uniqueID), points: _tempLocation, strokeWidth: 3, - fillColor: _polygonColor!.withOpacity(0.3), + fillColor: _polygonColor!.withValues(alpha: .3), strokeColor: _polygonColor!)); _polygons = _tempPolygons; @@ -485,7 +512,7 @@ class MapProvider extends ChangeNotifier { polylineId: PolylineId(uniqueID), points: _tempLocation, width: 8, - color: _polygonColor!.withOpacity(0.3), + color: _polygonColor!.withValues(alpha: .3), ), ); _polylines = _tempPolylines; @@ -505,7 +532,7 @@ class MapProvider extends ChangeNotifier { Future getUint8List(GlobalKey widgetKey) async { RenderRepaintBoundary boundary = widgetKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - var image = await boundary.toImage(pixelRatio: 2.0); + var image = await boundary.toImage(pixelRatio: 1.0); ByteData? byteData = await (image.toByteData(format: ImageByteFormat.png)); return byteData?.buffer.asUint8List(); } diff --git a/lib/ui/screens/map_screen.dart b/lib/ui/screens/map_screen.dart index 3beb8a9..b202a26 100644 --- a/lib/ui/screens/map_screen.dart +++ b/lib/ui/screens/map_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'package:polymaker/core/models/trackingmode.dart'; import 'package:polymaker/core/viewmodels/map_provider.dart'; import 'package:provider/provider.dart'; @@ -208,22 +209,24 @@ class _MapScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ mapProv.isEditMode == true - ? InkWell( - onTap: () => mapProv.undoLocation(), - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( + ? PointerInterceptor( + child: InkWell( + onTap: () => mapProv.undoLocation(), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: isSatellite + ? Colors.white + : widget.toolColor, + borderRadius: + BorderRadius.circular(50)), + child: Icon( + widget.iconUndoEdit, color: isSatellite - ? Colors.white - : widget.toolColor, - borderRadius: - BorderRadius.circular(50)), - child: Icon( - widget.iconUndoEdit, - color: isSatellite - ? Colors.black87 - : Colors.white, + ? Colors.black87 + : Colors.white, + ), ), ), ) @@ -231,90 +234,99 @@ class _MapScreenState extends State { SizedBox( width: mapProv.isEditMode == true ? 10 : 0), mapProv.isEditMode == true - ? InkWell( - onTap: () => mapProv.saveTracking(context), - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( + ? PointerInterceptor( + child: InkWell( + onTap: () => + mapProv.saveTracking(context), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: isSatellite + ? Colors.white + : widget.toolColor, + borderRadius: + BorderRadius.circular(50)), + child: Icon( + widget.iconDoneEdit, color: isSatellite - ? Colors.white - : widget.toolColor, - borderRadius: - BorderRadius.circular(50)), - child: Icon( - widget.iconDoneEdit, - color: isSatellite - ? Colors.black87 - : Colors.white, + ? Colors.black87 + : Colors.white, + ), ), ), ) : SizedBox(), SizedBox( width: mapProv.isEditMode == true ? 10 : 0), - InkWell( - onTap: () => mapProv.changeEditMode(), - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( + PointerInterceptor( + child: InkWell( + onTap: () => mapProv.changeEditMode(), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: isSatellite + ? Colors.white + : widget.toolColor, + borderRadius: BorderRadius.circular(50)), + child: Icon( + mapProv.isEditMode == false + ? widget.iconEditMode + : widget.iconCloseEdit, color: isSatellite - ? Colors.white - : widget.toolColor, - borderRadius: BorderRadius.circular(50)), - child: Icon( - mapProv.isEditMode == false - ? widget.iconEditMode - : widget.iconCloseEdit, - color: isSatellite - ? Colors.black87 - : Colors.white, + ? Colors.black87 + : Colors.white, + ), ), ), ), SizedBox(width: 10), - InkWell( - onTap: () => mapProv.changeCameraPosition( - mapProv.sourceLocation!), - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( + PointerInterceptor( + child: InkWell( + onTap: () => mapProv.changeCameraPosition( + mapProv.sourceLocation!), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: isSatellite + ? Colors.white + : widget.toolColor, + borderRadius: BorderRadius.circular(50)), + child: Icon( + widget.iconLocation, color: isSatellite - ? Colors.white - : widget.toolColor, - borderRadius: BorderRadius.circular(50)), - child: Icon( - widget.iconLocation, - color: isSatellite - ? Colors.black87 - : Colors.white, + ? Colors.black87 + : Colors.white, + ), ), ), ), SizedBox(width: 10), - InkWell( - onTap: () { - if (isSatellite) { - isSatellite = false; - } else - isSatellite = true; - setState(() {}); - }, - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( + PointerInterceptor( + child: InkWell( + onTap: () { + if (isSatellite) { + isSatellite = false; + } else + isSatellite = true; + setState(() {}); + }, + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: isSatellite + ? Colors.white + : widget.toolColor, + borderRadius: BorderRadius.circular(50)), + child: Icon( + isSatellite ? Icons.map : Icons.satellite, color: isSatellite - ? Colors.white - : widget.toolColor, - borderRadius: BorderRadius.circular(50)), - child: Icon( - isSatellite ? Icons.map : Icons.satellite, - color: isSatellite - ? Colors.black87 - : Colors.white, + ? Colors.black87 + : Colors.white, + ), ), ), ), @@ -327,24 +339,26 @@ class _MapScreenState extends State { child: Padding( padding: const EdgeInsets.only(bottom: 30, left: 20), - child: InkWell( - onTap: () { - mapProv.addGpsLocation( - mode: widget.trackingMode); - }, - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( + child: PointerInterceptor( + child: InkWell( + onTap: () { + mapProv.addGpsLocation( + mode: widget.trackingMode); + }, + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: isSatellite + ? Colors.white + : widget.toolColor, + borderRadius: BorderRadius.circular(50)), + child: Icon( + widget.iconGPSPoint, color: isSatellite - ? Colors.white - : widget.toolColor, - borderRadius: BorderRadius.circular(50)), - child: Icon( - widget.iconGPSPoint, - color: isSatellite - ? Colors.black87 - : Colors.white, + ? Colors.black87 + : Colors.white, + ), ), ), ), diff --git a/pubspec.lock b/pubspec.lock index d4f6489..6259797 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,82 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.2" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.2" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -59,9 +90,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: "5a1e6fb2c0561958d7e4c33574674bda7b77caaca7a33b758876956f2902eea3" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.27" flutter_test: dependency: "direct dev" description: flutter @@ -76,175 +108,335 @@ packages: dependency: "direct main" description: name: geolocator - url: "https://pub.dartlang.org" + sha256: f62bcd90459e63210bbf9c35deb6a51c521f992a78de19a1fe5c11704f9530e2 + url: "https://pub.dev" source: hosted - version: "8.0.1" + version: "13.0.4" geolocator_android: dependency: transitive description: name: geolocator_android - url: "https://pub.dartlang.org" + sha256: fcb1760a50d7500deca37c9a666785c047139b5f9ee15aa5469fae7dbbe3170d + url: "https://pub.dev" source: hosted - version: "3.0.4" + version: "4.6.2" geolocator_apple: dependency: transitive description: name: geolocator_apple - url: "https://pub.dartlang.org" + sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 + url: "https://pub.dev" source: hosted - version: "2.0.0+2" + version: "2.3.13" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - url: "https://pub.dartlang.org" + sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "4.2.6" geolocator_web: dependency: transitive description: name: geolocator_web - url: "https://pub.dartlang.org" + sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172 + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "4.1.3" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" + url: "https://pub.dev" + source: hosted + version: "0.2.5" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "4d6e199c561ca06792c964fa24b2bac7197bf4b401c2e1d23e345e5f9939f531" + url: "https://pub.dev" + source: hosted + version: "8.1.1" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - url: "https://pub.dartlang.org" + sha256: "830d8f7b51b4a950bf0d7daa675324fed6c9beb57a7ecca2a59018270c96b4e0" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.12.1" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "0ede4ae8326335c0c007c8c7a8c9737449263123385e2bdf49f3e71103b2dc2e" + url: "https://pub.dev" + source: hosted + version: "2.16.0" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: "2911e0c5654c2cc0d664324e0f49f055bb748740162821bdc0285045150b0439" + url: "https://pub.dev" + source: hosted + version: "2.15.1" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - url: "https://pub.dartlang.org" + sha256: "970c8f766c02909c7be282dea923c971f83a88adaf07f8871d0aacebc3b07bb2" + url: "https://pub.dev" + source: hosted + version: "2.11.1" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: a45786ea6691cc7cdbe2cf3ce2c2daf4f82a885745666b4a36baada3a4e12897 + url: "https://pub.dev" + source: hosted + version: "0.5.12" + html: + dependency: transitive + description: + name: html + sha256: "9475be233c437f0e3637af55e7702cbbe5c23a68bd56e8a5fa2d426297b7c6c8" + url: "https://pub.dev" + source: hosted + version: "0.15.5+1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + url: "https://pub.dev" + source: hosted + version: "10.0.8" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" source: hosted - version: "2.0.1" - js: + version: "3.0.9" + leak_tracker_testing: dependency: transitive description: - name: js - url: "https://pub.dartlang.org" + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" source: hosted - version: "0.6.3" + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.16.0" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.8" + pointer_interceptor: + dependency: "direct main" + description: + name: pointer_interceptor + sha256: "57210410680379aea8b1b7ed6ae0c3ad349bfd56fe845b8ea934a53344b9d523" + url: "https://pub.dev" + source: hosted + version: "0.10.1+2" + pointer_interceptor_ios: + dependency: transitive + description: + name: pointer_interceptor_ios + sha256: a6906772b3205b42c44614fcea28f818b1e5fdad73a4ca742a7bd49818d9c917 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + pointer_interceptor_platform_interface: + dependency: transitive + description: + name: pointer_interceptor_platform_interface + sha256: "0597b0560e14354baeb23f8375cd612e8bd4841bf8306ecb71fcd0bb78552506" + url: "https://pub.dev" + source: hosted + version: "0.10.0+1" + pointer_interceptor_web: + dependency: transitive + description: + name: pointer_interceptor_web + sha256: "7a7087782110f8c1827170660b09f8aa893e0e9a61431dbbe2ac3fc482e8c044" + url: "https://pub.dev" + source: hosted + version: "0.10.2+1" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + sha256: "489024f942069c2920c844ee18bb3d467c69e48955a4f32d1677f71be103e310" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "2.1.0" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "7.0.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.4.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.2" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" source: hosted - version: "0.4.8" + version: "0.7.4" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.dev" + source: hosted + version: "4.5.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + url: "https://pub.dev" + source: hosted + version: "14.3.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=1.22.0" + dart: ">=3.7.0-0 <3.13.8" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index 652178a..8ae58dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,17 +1,19 @@ name: polymaker # author: Yusril Rapsanjani -version: 1.0.3 +version: 1.0.4 homepage: https://github.com/yusriltakeuchi/polymaker.git description: Polymaker is a flutter package used to get a list of locations for polygon google maps environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.12.0 <3.13.8' flutter: ">=1.17.0" dependencies: google_maps_flutter: '>=2.0.1 <=3.0.0' - geolocator: '>=8.0.1 <=9.0.0' + geolocator: ^13.0.4 provider: '>=5.0.0 <=7.0.0' flutter: sdk: flutter + cupertino_icons: ^1.0.6 + pointer_interceptor: ^0.10.1+2 dev_dependencies: flutter_test: sdk: flutter