[mob][photos] Upgrade to flutter 3.22.0 (#1933)

## Description

- Upgraded flutter and some packages.
- `flutter_map` had some breaking changes. 
- `flutter_map_marker_cluster` also required some changes.
- Marker clusters weren't rendering after upgrading to flutter 3.22.0 on
profile and release mode. This was also fixed.
This commit is contained in:
Neeraj Gupta
2024-05-31 13:57:30 +05:30
committed by GitHub
10 changed files with 96 additions and 97 deletions

View File

@@ -4,7 +4,7 @@ on:
workflow_dispatch: # Allow manually running the action
env:
FLUTTER_VERSION: "3.19.4"
FLUTTER_VERSION: "3.22.0"
jobs:
build:

View File

@@ -9,7 +9,8 @@ on:
- ".github/workflows/mobile-lint.yml"
env:
FLUTTER_VERSION: "3.19.4"
FLUTTER_VERSION: "3.22.0"
jobs:
lint:

View File

@@ -46,7 +46,7 @@ You can alternatively install the build from PlayStore or F-Droid.
## 🧑‍💻 Building from source
1. [Install Flutter v3.19.4](https://flutter.dev/docs/get-started/install).
1. [Install Flutter v3.22.0](https://flutter.dev/docs/get-started/install).
2. Pull in all submodules with `git submodule update --init --recursive`

View File

@@ -427,7 +427,7 @@ SPEC CHECKSUMS:
home_widget: 0434835a4c9a75704264feff6be17ea40e0f0d57
image_editor_common: d6f6644ae4a6de80481e89fe6d0a8c49e30b4b43
in_app_purchase_storekit: 0e4b3c2e43ba1e1281f4f46dd71b0593ce529892
integration_test: 13825b8a9334a850581300559b8839134b124670
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
local_auth_darwin: c7e464000a6a89e952235699e32b329457608d98
local_auth_ios: 5046a18c018dd973247a0564496c8898dbb5adf9

View File

@@ -7,20 +7,19 @@ import "package:photos/ui/map/marker_image.dart";
Marker mapMarker(
ImageMarker imageMarker,
String key, {
ValueKey<int> key, {
Size markerSize = MapView.defaultMarkerSize,
}) {
return Marker(
//-6.5 is for taking in the height of the MarkerPointer
anchorPos: AnchorPos.exactly(Anchor(markerSize.height / 2, -6.5)),
key: Key(key),
alignment: Alignment.topCenter,
key: key,
width: markerSize.width,
height: markerSize.height,
point: LatLng(
imageMarker.latitude,
imageMarker.longitude,
),
builder: (context) => MarkerImage(
child: MarkerImage(
file: imageMarker.imageFile,
seperator: (MapView.defaultMarkerSize.height + 10) -
(MapView.defaultMarkerSize.height - markerSize.height),

View File

@@ -114,7 +114,7 @@ class _MapScreenState extends State<MapScreen> {
);
Timer(Duration(milliseconds: debounceDuration), () {
calculateVisibleMarkers(mapController.bounds!);
calculateVisibleMarkers(mapController.camera.visibleBounds);
setState(() {
isLoading = false;
});

View File

@@ -4,8 +4,8 @@ import "package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart";
import "package:latlong2/latlong.dart";
import "package:photos/ui/map/image_marker.dart";
import "package:photos/ui/map/map_button.dart";
import 'package:photos/ui/map/map_gallery_tile.dart';
import 'package:photos/ui/map/map_gallery_tile_badge.dart';
import "package:photos/ui/map/map_gallery_tile.dart";
import "package:photos/ui/map/map_gallery_tile_badge.dart";
import "package:photos/ui/map/map_marker.dart";
import "package:photos/ui/map/tile/layers.dart";
import "package:photos/utils/debouncer.dart";
@@ -60,11 +60,6 @@ class _MapViewState extends State<MapView> {
_markers = _buildMakers();
}
@override
void dispose() {
super.dispose();
}
void onChange(LatLngBounds bounds) {
_debouncer.run(
() async {
@@ -85,55 +80,44 @@ class _MapViewState extends State<MapView> {
widget.onTap!.call();
}
: null,
center: widget.center,
initialCenter: widget.center,
minZoom: widget.minZoom,
maxZoom: widget.maxZoom,
enableMultiFingerGestureRace: true,
zoom: widget.initialZoom,
maxBounds: LatLngBounds(
const LatLng(-90, -180),
const LatLng(90, 180),
interactionOptions: InteractionOptions(
flags: widget.interactiveFlags,
enableMultiFingerGestureRace: true,
),
initialZoom: widget.initialZoom,
cameraConstraint: CameraConstraint.contain(
bounds: LatLngBounds(
const LatLng(-90, -180),
const LatLng(90, 180),
),
),
onPositionChanged: (position, hasGesture) {
if (position.bounds != null) {
onChange(position.bounds!);
}
},
interactiveFlags: widget.interactiveFlags,
),
nonRotatedChildren: [
Padding(
padding: EdgeInsets.only(
bottom: widget.bottomSheetDraggableAreaHeight,
),
child: OSMFranceTileAttributes(
options: widget.mapAttributionOptions,
),
),
],
children: [
const OSMFranceTileLayer(),
MarkerClusterLayerWidget(
options: MarkerClusterLayerOptions(
anchorPos: AnchorPos.align(AnchorAlign.top),
alignment: Alignment.topCenter,
maxClusterRadius: 100,
showPolygon: false,
size: widget.markerSize,
fitBoundsOptions: const FitBoundsOptions(
padding: EdgeInsets.all(80),
),
padding: const EdgeInsets.all(80),
markers: _markers,
onClusterTap: (_) {
onChange(widget.controller.bounds!);
onChange(widget.controller.camera.visibleBounds);
},
builder: (context, List<Marker> markers) {
final index = int.parse(
markers.first.key
.toString()
.replaceAll(RegExp(r'[^0-9]'), ''),
);
final String clusterKey =
'map-badge-$index-len-${markers.length}';
final valueKey = markers.first.key as ValueKey;
final index = valueKey.value as int;
final clusterKey = 'map-badge-$index-len-${markers.length}';
return Stack(
key: ValueKey(clusterKey),
@@ -148,6 +132,14 @@ class _MapViewState extends State<MapView> {
},
),
),
Padding(
padding: EdgeInsets.only(
bottom: widget.bottomSheetDraggableAreaHeight,
),
child: OSMFranceTileAttributes(
options: widget.mapAttributionOptions,
),
),
],
),
widget.showControls
@@ -175,8 +167,8 @@ class _MapViewState extends State<MapView> {
icon: Icons.add,
onPressed: () {
widget.controller.move(
widget.controller.center,
widget.controller.zoom + 1,
widget.controller.camera.center,
widget.controller.camera.zoom + 1,
);
},
heroTag: 'zoom-in',
@@ -185,8 +177,8 @@ class _MapViewState extends State<MapView> {
icon: Icons.remove,
onPressed: () {
widget.controller.move(
widget.controller.center,
widget.controller.zoom - 1,
widget.controller.camera.center,
widget.controller.camera.zoom - 1,
);
},
heroTag: 'zoom-out',
@@ -204,7 +196,7 @@ class _MapViewState extends State<MapView> {
final imageMarker = widget.imageMarkers[index];
return mapMarker(
imageMarker,
index.toString(),
ValueKey(index),
markerSize: widget.markerSize,
);
});

View File

@@ -3,7 +3,7 @@
import "dart:async";
import "package:flutter/material.dart";
import "package:flutter_map/plugin_api.dart";
import "package:flutter_map/flutter_map.dart";
import "package:photos/extensions/list.dart";
import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
@@ -194,10 +194,8 @@ class MapAttributionWidgetState extends State<MapAttributionWidget> {
context,
() {
setState(() => popupExpanded = true);
mapEventSubscription = FlutterMapState.of(context)
.mapController
.mapEventStream
.listen((e) {
mapEventSubscription =
MapController().mapEventStream.listen((e) {
setState(() => popupExpanded = false);
mapEventSubscription?.cancel();
});

View File

@@ -45,10 +45,10 @@ packages:
dependency: "direct main"
description:
name: animated_list_plus
sha256: fe66f9c300d715254727fbdf050487844d17b013fec344fa28081d29bddbdf1a
sha256: fb3d7f1fbaf5af84907f3c739236bacda8bf32cbe1f118dd51510752883ff50c
url: "https://pub.dev"
source: hosted
version: "0.4.5"
version: "0.5.2"
animated_stack_widget:
dependency: transitive
description:
@@ -764,26 +764,26 @@ packages:
dependency: "direct main"
description:
name: flutter_map
sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3"
sha256: "87cc8349b8fa5dccda5af50018c7374b6645334a0d680931c1fe11bce88fa5bb"
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "6.2.1"
flutter_map_marker_cluster:
dependency: "direct main"
description:
name: flutter_map_marker_cluster
sha256: "14bb31b9dd3a759ab4a1ba320d19bbb554d8d7952c8812029c6f6b7bda956906"
sha256: a324f48da5ee83a3f29fd8d08b4b1e6e3114ff5c6cab910124d6a2e1f06f08cc
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.6"
flutter_map_marker_popup:
dependency: transitive
description:
name: flutter_map_marker_popup
sha256: be209c68b19d4c10d9a2f5911e45f7c579624c43a353adb9bf0f2fec0cf30b8c
sha256: ec563bcbae24a18ac16815fb75ac5ab33ccba609e14db70e252a67de19c6639c
url: "https://pub.dev"
source: hosted
version: "5.2.0"
version: "6.1.2"
flutter_native_splash:
dependency: "direct main"
description:
@@ -971,10 +971,10 @@ packages:
dependency: "direct main"
description:
name: home_widget
sha256: "29565bfee4b32eaf9e7e8b998d504618b779a74b2b1ac62dd4dac7468e66f1a3"
sha256: "2a0fdd6267ff975bd07bedf74686bd5577200f504f5de36527ac1b56bdbe68e3"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.6.0"
html:
dependency: transitive
description:
@@ -1152,26 +1152,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.1"
like_button:
dependency: "direct main"
description:
@@ -1252,6 +1252,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.10"
logger:
dependency: transitive
description:
name: logger
sha256: af05cc8714f356fd1f3888fb6741cbe9fbe25cdb6eedbab80e1a6db21047d4a4
url: "https://pub.dev"
source: hosted
version: "2.3.0"
logging:
dependency: "direct main"
description:
@@ -1368,10 +1376,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.12.0"
mgrs_dart:
dependency: transitive
description:
@@ -2144,10 +2152,10 @@ packages:
dependency: "direct main"
description:
name: styled_text
sha256: f72928d1ebe8cb149e3b34a689cb1ddca696b808187cf40ac3a0bd183dff379c
sha256: fd624172cf629751b4f171dd0ecf9acf02a06df3f8a81bb56c0caa4f1df706c3
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "8.1.0"
sync_http:
dependency: transitive
description:
@@ -2160,18 +2168,18 @@ packages:
dependency: "direct main"
description:
name: syncfusion_flutter_core
sha256: "9be1bb9bbdb42823439a18da71484f1964c14dbe1c255ab1b931932b12fa96e8"
sha256: "63108a33f9b0d89f7b6b56cce908b8e519fe433dbbe0efcf41ad3e8bb2081bd9"
url: "https://pub.dev"
source: hosted
version: "19.4.56"
version: "25.2.5"
syncfusion_flutter_sliders:
dependency: "direct main"
description:
name: syncfusion_flutter_sliders
sha256: "1f6a63ccab4180b544074b9264a20f01ee80b553de154192fe1d7b434089d3c2"
sha256: f27310bedc0e96e84054f0a70ac593d1a3c38397c158c5226ba86027ad77b2c1
url: "https://pub.dev"
source: hosted
version: "19.4.56"
version: "25.2.5"
synchronized:
dependency: "direct main"
description:
@@ -2192,26 +2200,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
url: "https://pub.dev"
source: hosted
version: "1.24.9"
version: "1.25.2"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
test_core:
dependency: transitive
description:
name: test_core
sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
url: "https://pub.dev"
source: hosted
version: "0.5.9"
version: "0.6.0"
timezone:
dependency: transitive
description:
@@ -2441,10 +2449,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.2.1"
volume_controller:
dependency: transitive
description:
@@ -2591,4 +2599,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.0"
flutter: ">=3.20.0-1.2.pre"

View File

@@ -21,7 +21,7 @@ environment:
dependencies:
adaptive_theme: ^3.1.0
animate_do: ^2.0.0
animated_list_plus: ^0.4.5
animated_list_plus: ^0.5.2
archive: ^3.1.2
background_fetch: ^1.2.1
battery_info: ^1.1.1
@@ -83,8 +83,8 @@ dependencies:
flutter_local_notifications: ^17.0.0
flutter_localizations:
sdk: flutter
flutter_map: ^5.0.0
flutter_map_marker_cluster: ^1.2.0
flutter_map: ^6.2.0
flutter_map_marker_cluster: ^1.3.6
flutter_native_splash: ^2.2.0+1
flutter_password_strength: ^0.1.6
flutter_secure_storage: ^8.0.0
@@ -93,13 +93,13 @@ dependencies:
fluttertoast: ^8.0.6
freezed_annotation: ^2.4.1
google_nav_bar: ^5.0.5
home_widget: ^0.5.0
home_widget: ^0.6.0
html_unescape: ^2.0.0
http: ^1.1.0
image: ^4.0.17
image_editor: ^1.3.0
in_app_purchase: ^3.0.7
intl: ^0.18.0
intl: ^0.19.0
json_annotation: ^4.8.0
latlong2: ^0.9.0
like_button: ^2.0.5
@@ -152,9 +152,9 @@ dependencies:
sqlite3_flutter_libs: ^0.5.20
sqlite_async: ^0.6.1
step_progress_indicator: ^1.0.2
styled_text: ^7.0.0
syncfusion_flutter_core: ^19.2.49
syncfusion_flutter_sliders: ^19.2.49
styled_text: ^8.1.0
syncfusion_flutter_core: ^25.2.5
syncfusion_flutter_sliders: ^25.2.5
synchronized: ^3.1.0
tuple: ^2.0.0
uni_links: ^0.5.1
@@ -177,6 +177,7 @@ dependency_overrides:
# Remove this after removing dependency from flutter_sodium.
# Newer flutter packages depends on ffi > 2.0.0 while flutter_sodium depends on ffi < 2.0.0
ffi: 2.1.0
intl: 0.18.1
video_player:
git:
url: https://github.com/ente-io/packages.git