mirror of
https://github.com/immich-app/immich.git
synced 2026-09-30 13:23:21 +08:00
fix(mobile): prevent SurfaceLayer crashing on maps in Viewer on Android (#31709)
This commit is contained in:
@@ -46,10 +46,17 @@ import 'package:immich_mobile/wm_executor.dart';
|
||||
import 'package:immich_ui/immich_ui.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
import 'package:timezone/data/latest.dart';
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
// https://github.com/flutter/flutter/issues/118384
|
||||
// Android only: Render maps into a TextureView
|
||||
// By default, MapLibre will embed them into platform views, using Virtual Display. For some reason Flutter has a bug
|
||||
// that leaks a presentation window and SurfaceFlinger layer for every map built, and it is never discarded
|
||||
MapLibreMap.useHybridComposition = true;
|
||||
|
||||
ImmichWidgetsBinding();
|
||||
unawaited(BackgroundWorkerLockService(BackgroundWorkerLockApi()).lock());
|
||||
await EasyLocalization.ensureInitialized();
|
||||
|
||||
@@ -514,7 +514,9 @@ class _AssetPageState extends ConsumerState<AssetPage> {
|
||||
child: AnimatedOpacity(
|
||||
opacity: _showingDetails ? 1.0 : 0.0,
|
||||
duration: Durations.short2,
|
||||
child: AssetDetails(asset: displayAsset, minHeight: viewportHeight - snapTarget),
|
||||
child: _showingDetails
|
||||
? AssetDetails(asset: displayAsset, minHeight: viewportHeight - snapTarget)
|
||||
: SizedBox(height: viewportHeight - snapTarget),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user