From aaf92e1c0cfdd1de5f13f8b4ba1d9ad6e6667422 Mon Sep 17 00:00:00 2001 From: Chris Gu Date: Mon, 29 Apr 2024 17:40:22 -0400 Subject: [PATCH] resizing userlocation marker --- game/ios/Podfile.lock | 69 ++++++++++++++++------------- game/lib/gameplay/gameplay_map.dart | 28 ++++++++---- 2 files changed, 56 insertions(+), 41 deletions(-) diff --git a/game/ios/Podfile.lock b/game/ios/Podfile.lock index 4c9cc639..12ed4798 100644 --- a/game/ios/Podfile.lock +++ b/game/ios/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - AppAuth (1.7.4): - - AppAuth/Core (= 1.7.4) - - AppAuth/ExternalUserAgent (= 1.7.4) - - AppAuth/Core (1.7.4) - - AppAuth/ExternalUserAgent (1.7.4): + - AppAuth (1.7.5): + - AppAuth/Core (= 1.7.5) + - AppAuth/ExternalUserAgent (= 1.7.5) + - AppAuth/Core (1.7.5) + - AppAuth/ExternalUserAgent (1.7.5): - AppAuth/Core - device_info (0.0.1): - Flutter @@ -55,6 +55,9 @@ PODS: - fluttertoast (0.0.2): - Flutter - Toast + - FMDB (2.7.10): + - FMDB/standard (= 2.7.10) + - FMDB/standard (2.7.10) - geolocator_apple (1.2.0): - Flutter - google_maps_flutter_ios (0.0.1): @@ -62,9 +65,9 @@ PODS: - GoogleMaps (< 9.0) - google_sign_in_ios (0.0.1): - Flutter - - GoogleSignIn (~> 7.0) - - GoogleAppMeasurement (10.23.0): - - GoogleAppMeasurement/AdIdSupport (= 10.23.0) + - GoogleSignIn (~> 6.2) + - GoogleAppMeasurement (10.24.0): + - GoogleAppMeasurement/AdIdSupport (= 10.24.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) @@ -88,10 +91,10 @@ PODS: - GoogleMaps/Base (7.4.0) - GoogleMaps/Maps (7.4.0): - GoogleMaps/Base - - GoogleSignIn (7.0.0): + - GoogleSignIn (6.2.4): - AppAuth (~> 1.5) - - GTMAppAuth (< 3.0, >= 1.3) - - GTMSessionFetcher/Core (< 4.0, >= 1.1) + - GTMAppAuth (~> 1.3) + - GTMSessionFetcher/Core (< 3.0, >= 1.1) - GoogleUtilities/AppDelegateSwizzler (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Logger @@ -120,10 +123,10 @@ PODS: - GoogleUtilities/UserDefaults (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GTMAppAuth (2.0.0): + - GTMAppAuth (1.3.1): - AppAuth/Core (~> 1.6) - - GTMSessionFetcher/Core (< 4.0, >= 1.5) - - GTMSessionFetcher/Core (3.3.2) + - GTMSessionFetcher/Core (< 3.0, >= 1.5) + - GTMSessionFetcher/Core (2.3.0) - location (0.0.1): - Flutter - nanopb (2.30910.0): @@ -134,15 +137,15 @@ PODS: - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS - - permission_handler_apple (9.3.0): + - permission_handler_apple (9.1.1): - Flutter - platform_device_id (0.0.1): - Flutter - PromisesObjC (2.4.0) - sqflite (0.0.3): - Flutter - - FlutterMacOS - - Toast (4.1.0) + - FMDB (>= 2.7.5) + - Toast (4.1.1) - url_launcher_ios (0.0.1): - Flutter @@ -157,12 +160,12 @@ DEPENDENCIES: - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) + - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`) - location (from `.symlinks/plugins/location/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - platform_device_id (from `.symlinks/plugins/platform_device_id/ios`) - - sqflite (from `.symlinks/plugins/sqflite/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: @@ -173,6 +176,7 @@ SPEC REPOS: - FirebaseCore - FirebaseCoreInternal - FirebaseInstallations + - FMDB - GoogleAppMeasurement - GoogleMaps - GoogleSignIn @@ -201,7 +205,7 @@ EXTERNAL SOURCES: google_maps_flutter_ios: :path: ".symlinks/plugins/google_maps_flutter_ios/ios" google_sign_in_ios: - :path: ".symlinks/plugins/google_sign_in_ios/darwin" + :path: ".symlinks/plugins/google_sign_in_ios/ios" location: :path: ".symlinks/plugins/location/ios" path_provider_foundation: @@ -211,12 +215,12 @@ EXTERNAL SOURCES: platform_device_id: :path: ".symlinks/plugins/platform_device_id/ios" sqflite: - :path: ".symlinks/plugins/sqflite/darwin" + :path: ".symlinks/plugins/sqflite/ios" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: - AppAuth: 182c5b88630569df5acb672720534756c29b3358 + AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 Firebase: 91fefd38712feb9186ea8996af6cbdef41473442 @@ -228,24 +232,25 @@ SPEC CHECKSUMS: flutter_config: f48f0d47a284f1791aacce2687eabb3309ba7a41 flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265 - geolocator_apple: 9157311f654584b9bb72686c55fc02a97b73f461 + FMDB: eae540775bf7d0c87a5af926ae37af69effe5a19 + geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 - google_sign_in_ios: 8115e3fbe097e6509beb819ed602d47369d9011f - GoogleAppMeasurement: 453eb0de99fcf2bdec9403e9ac5d7871fdba3e3f + google_sign_in_ios: 1256ff9d941db546373826966720b0c24804bcdd + GoogleAppMeasurement: f3abf08495ef2cba7829f15318c373b8d9226491 GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac - GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842 + GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152 - GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae - GTMSessionFetcher: 0e876eea9782ec6462e91ab872711c357322c94f + GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd + GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2 location: d5cf8598915965547c3f36761ae9cc4f4e87d22e nanopb: 438bc412db1928dac798aa6fd75726007be04262 - path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 platform_device_id: 81b3e2993881f87d0c82ef151dc274df4869aef5 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 - sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec - Toast: ec33c32b8688982cecc6348adeae667c1b9938da - url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 + sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a + Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e + url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86 PODFILE CHECKSUM: 025aa7201e4cab1f9c884abb0535b2c942d9df36 diff --git a/game/lib/gameplay/gameplay_map.dart b/game/lib/gameplay/gameplay_map.dart index ef30ec4f..d664db8a 100644 --- a/game/lib/gameplay/gameplay_map.dart +++ b/game/lib/gameplay/gameplay_map.dart @@ -1,4 +1,7 @@ +import 'dart:typed_data'; + import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:game/navigation_page/bottom_navbar.dart'; import 'package:game/splash_page/splash_page.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -9,6 +12,7 @@ import 'dart:async'; import 'dart:math'; import 'package:game/gameplay/challenge_completed.dart'; import 'package:game/utils/utility_functions.dart'; +import 'dart:ui' as ui; // for backend connection import 'package:provider/provider.dart'; @@ -66,8 +70,8 @@ class _GameplayMapState extends State { @override void initState() { - super.initState(); setCustomMarkerIcon(); + super.initState(); streamStarted = startPositionStream(); setStartingHintCircle(); } @@ -222,19 +226,25 @@ class _GameplayMapState extends State { }); } + Future getBytesFromAsset(String path, int width) async { + ByteData data = await rootBundle.load(path); + ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), + targetWidth: width, targetHeight: width); + ui.FrameInfo fi = await codec.getNextFrame(); + return (await fi.image.toByteData(format: ui.ImageByteFormat.png))! + .buffer + .asUint8List(); + } + /** * Sets the custom user location icon, which is called upon * initializing the state */ BitmapDescriptor currentLocationIcon = BitmapDescriptor.defaultMarker; - void setCustomMarkerIcon() { - BitmapDescriptor.fromAssetImage(ImageConfiguration(size: Size(20, 20)), - "assets/icons/userlocation.png") - .then( - (icon) { - currentLocationIcon = icon; - }, - ); + void setCustomMarkerIcon() async { + Uint8List newMarker = + await getBytesFromAsset('assets/icons/userlocation.png', 200); + currentLocationIcon = BitmapDescriptor.fromBytes(newMarker); setState(() {}); }