fix(mobile): Disable hit testing for transparent bars (#2727)

This commit is contained in:
Sergey Kondrikov 2023-06-11 21:10:17 +03:00 committed by GitHub
parent 9a80a2151c
commit e101e40c47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -276,28 +276,33 @@ class GalleryViewerPage extends HookConsumerWidget {
(showAppBar.value && !isZoomed.value)) && (showAppBar.value && !isZoomed.value)) &&
!isPlayingVideo.value; !isPlayingVideo.value;
return AnimatedOpacity( return IgnorePointer(
duration: const Duration(milliseconds: 100), ignoring: !show,
opacity: show ? 1.0 : 0.0, child: AnimatedOpacity(
child: Container( duration: const Duration(milliseconds: 100),
color: Colors.black.withOpacity(0.4), opacity: show ? 1.0 : 0.0,
child: TopControlAppBar( child: Container(
isPlayingMotionVideo: isPlayingMotionVideo.value, color: Colors.black.withOpacity(0.4),
asset: asset(), child: TopControlAppBar(
isFavorite: asset().isFavorite, isPlayingMotionVideo: isPlayingMotionVideo.value,
onMoreInfoPressed: showInfo, asset: asset(),
onFavorite: asset().isRemote ? () => toggleFavorite(asset()) : null, isFavorite: asset().isFavorite,
onDownloadPressed: asset().isLocal onMoreInfoPressed: showInfo,
? null onFavorite:
: () => asset().isRemote ? () => toggleFavorite(asset()) : null,
ref.watch(imageViewerStateProvider.notifier).downloadAsset( onDownloadPressed: asset().isLocal
asset(), ? null
context, : () => ref
), .watch(imageViewerStateProvider.notifier)
onToggleMotionVideo: (() { .downloadAsset(
isPlayingMotionVideo.value = !isPlayingMotionVideo.value; asset(),
}), context,
onAddToAlbumPressed: () => addToAlbum(asset()), ),
onToggleMotionVideo: (() {
isPlayingMotionVideo.value = !isPlayingMotionVideo.value;
}),
onAddToAlbumPressed: () => addToAlbum(asset()),
),
), ),
), ),
); );
@ -307,53 +312,57 @@ class GalleryViewerPage extends HookConsumerWidget {
final show = (showAppBar.value || // onTap has the final say final show = (showAppBar.value || // onTap has the final say
(showAppBar.value && !isZoomed.value)) && (showAppBar.value && !isZoomed.value)) &&
!isPlayingVideo.value; !isPlayingVideo.value;
return AnimatedOpacity(
duration: const Duration(milliseconds: 100), return IgnorePointer(
opacity: show ? 1.0 : 0.0, ignoring: !show,
child: BottomNavigationBar( child: AnimatedOpacity(
backgroundColor: Colors.black.withOpacity(0.4), duration: const Duration(milliseconds: 100),
unselectedIconTheme: const IconThemeData(color: Colors.white), opacity: show ? 1.0 : 0.0,
selectedIconTheme: const IconThemeData(color: Colors.white), child: BottomNavigationBar(
unselectedLabelStyle: const TextStyle(color: Colors.black), backgroundColor: Colors.black.withOpacity(0.4),
selectedLabelStyle: const TextStyle(color: Colors.black), unselectedIconTheme: const IconThemeData(color: Colors.white),
showSelectedLabels: false, selectedIconTheme: const IconThemeData(color: Colors.white),
showUnselectedLabels: false, unselectedLabelStyle: const TextStyle(color: Colors.black),
items: [ selectedLabelStyle: const TextStyle(color: Colors.black),
BottomNavigationBarItem( showSelectedLabels: false,
icon: const Icon(Icons.ios_share_rounded), showUnselectedLabels: false,
label: 'control_bottom_app_bar_share'.tr(), items: [
tooltip: 'control_bottom_app_bar_share'.tr(), BottomNavigationBarItem(
), icon: const Icon(Icons.ios_share_rounded),
asset().isArchived label: 'control_bottom_app_bar_share'.tr(),
? BottomNavigationBarItem( tooltip: 'control_bottom_app_bar_share'.tr(),
icon: const Icon(Icons.unarchive_rounded), ),
label: 'control_bottom_app_bar_unarchive'.tr(), asset().isArchived
tooltip: 'control_bottom_app_bar_unarchive'.tr(), ? BottomNavigationBarItem(
) icon: const Icon(Icons.unarchive_rounded),
: BottomNavigationBarItem( label: 'control_bottom_app_bar_unarchive'.tr(),
icon: const Icon(Icons.archive_outlined), tooltip: 'control_bottom_app_bar_unarchive'.tr(),
label: 'control_bottom_app_bar_archive'.tr(), )
tooltip: 'control_bottom_app_bar_archive'.tr(), : BottomNavigationBarItem(
), icon: const Icon(Icons.archive_outlined),
BottomNavigationBarItem( label: 'control_bottom_app_bar_archive'.tr(),
icon: const Icon(Icons.delete_outline), tooltip: 'control_bottom_app_bar_archive'.tr(),
label: 'control_bottom_app_bar_delete'.tr(), ),
tooltip: 'control_bottom_app_bar_delete'.tr(), BottomNavigationBarItem(
), icon: const Icon(Icons.delete_outline),
], label: 'control_bottom_app_bar_delete'.tr(),
onTap: (index) { tooltip: 'control_bottom_app_bar_delete'.tr(),
switch (index) { ),
case 0: ],
shareAsset(); onTap: (index) {
break; switch (index) {
case 1: case 0:
handleArchive(asset()); shareAsset();
break; break;
case 2: case 1:
handleDelete(asset()); handleArchive(asset());
break; break;
} case 2:
}, handleDelete(asset());
break;
}
},
),
), ),
); );
} }