fix: remove safe area from bottom bar (#20102)

* remove safe area from bottom bar

* fix: video not playing in search view

* stop foreground / background back on migration

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-07-23 18:53:49 +05:30 committed by GitHub
parent c91382625c
commit 05d26dc683
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 24 deletions

View File

@ -2,10 +2,14 @@ import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/entities/store.entity.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/providers/album/album.provider.dart'; import 'package:immich_mobile/providers/album/album.provider.dart';
import 'package:immich_mobile/providers/asset.provider.dart'; import 'package:immich_mobile/providers/asset.provider.dart';
import 'package:immich_mobile/providers/background_sync.provider.dart'; import 'package:immich_mobile/providers/background_sync.provider.dart';
import 'package:immich_mobile/providers/backup/backup.provider.dart';
import 'package:immich_mobile/providers/backup/manual_upload.provider.dart';
import 'package:immich_mobile/providers/gallery_permission.provider.dart'; import 'package:immich_mobile/providers/gallery_permission.provider.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart'; import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
import 'package:immich_mobile/providers/websocket.provider.dart'; import 'package:immich_mobile/providers/websocket.provider.dart';
@ -43,6 +47,17 @@ class _ChangeExperiencePageState extends ConsumerState<ChangeExperiencePage> {
albumNotifier.dispose(); albumNotifier.dispose();
} }
// Cancel uploads
await Store.put(StoreKey.backgroundBackup, false);
ref.read(backupProvider.notifier).configureBackgroundBackup(
enabled: false,
onBatteryInfo: () {},
onError: (_) {},
);
ref.read(backupProvider.notifier).setAutoBackup(false);
ref.read(backupProvider.notifier).cancelBackup();
ref.read(manualUploadProvider.notifier).cancelBackup();
// Start listening to new websocket events
ref.read(websocketProvider.notifier).stopListenToOldEvents(); ref.read(websocketProvider.notifier).stopListenToOldEvents();
ref.read(websocketProvider.notifier).startListeningToBetaEvents(); ref.read(websocketProvider.notifier).startListeningToBetaEvents();

View File

@ -50,31 +50,30 @@ class ViewerBottomBar extends ConsumerWidget {
duration: Durations.short4, duration: Durations.short4,
child: isSheetOpen child: isSheetOpen
? const SizedBox.shrink() ? const SizedBox.shrink()
: SafeArea( : Theme(
child: Theme( data: context.themeData.copyWith(
data: context.themeData.copyWith( iconTheme:
iconTheme: const IconThemeData(size: 22, color: Colors.white),
const IconThemeData(size: 22, color: Colors.white), textTheme: context.themeData.textTheme.copyWith(
textTheme: context.themeData.textTheme.copyWith( labelLarge:
labelLarge: context.themeData.textTheme.labelLarge?.copyWith(
context.themeData.textTheme.labelLarge?.copyWith( color: Colors.white,
color: Colors.white,
),
), ),
), ),
child: Container( ),
height: asset.isVideo ? 160 : 80, child: Container(
color: Colors.black.withAlpha(125), height: context.padding.bottom + (asset.isVideo ? 160 : 80),
child: Column( color: Colors.black.withAlpha(125),
mainAxisAlignment: MainAxisAlignment.end, padding: EdgeInsets.only(bottom: context.padding.bottom),
children: [ child: Column(
if (asset.isVideo) const VideoControls(), mainAxisAlignment: MainAxisAlignment.end,
Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceEvenly, if (asset.isVideo) const VideoControls(),
children: actions, Row(
), mainAxisAlignment: MainAxisAlignment.spaceEvenly,
], children: actions,
), ),
],
), ),
), ),
), ),

View File

@ -27,6 +27,26 @@ import 'package:logging/logging.dart';
import 'package:native_video_player/native_video_player.dart'; import 'package:native_video_player/native_video_player.dart';
import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
bool _isCurrentAsset(
BaseAsset asset,
BaseAsset? currentAsset,
) {
if (asset is RemoteAsset) {
return switch (currentAsset) {
RemoteAsset remoteAsset => remoteAsset.id == asset.id,
LocalAsset localAsset => localAsset.remoteId == asset.id,
_ => false,
};
} else if (asset is LocalAsset) {
return switch (currentAsset) {
RemoteAsset remoteAsset => remoteAsset.localId == asset.id,
LocalAsset localAsset => localAsset.id == asset.id,
_ => false,
};
}
return false;
}
class NativeVideoViewer extends HookConsumerWidget { class NativeVideoViewer extends HookConsumerWidget {
final BaseAsset asset; final BaseAsset asset;
final bool showControls; final bool showControls;
@ -56,7 +76,7 @@ class NativeVideoViewer extends HookConsumerWidget {
// If the swipe is completed, `isCurrent` will be true for video B after a delay. // If the swipe is completed, `isCurrent` will be true for video B after a delay.
// If the swipe is canceled, `currentAsset` will not have changed and video A will continue to play. // If the swipe is canceled, `currentAsset` will not have changed and video A will continue to play.
final currentAsset = useState(ref.read(currentAssetNotifier)); final currentAsset = useState(ref.read(currentAssetNotifier));
final isCurrent = currentAsset.value == asset; final isCurrent = _isCurrentAsset(asset, currentAsset.value);
// Used to show the placeholder during hero animations for remote videos to avoid a stutter // Used to show the placeholder during hero animations for remote videos to avoid a stutter
final isVisible = useState(Platform.isIOS && asset.hasLocal); final isVisible = useState(Platform.isIOS && asset.hasLocal);