mirror of
https://github.com/immich-app/immich.git
synced 2024-11-24 08:52:28 +02:00
Hide bottom app bar when multiselect enabled
This commit is contained in:
parent
03866b4c31
commit
293e713af6
@ -0,0 +1,5 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
final multiselectProvider = StateProvider((ref) {
|
||||
return false;
|
||||
});
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/modules/home/providers/home_page_render_list_provider.dart';
|
||||
import 'package:immich_mobile/modules/home/providers/multiselect.provider.dart';
|
||||
import 'package:immich_mobile/modules/home/ui/asset_grid/immich_asset_grid.dart';
|
||||
import 'package:immich_mobile/modules/home/ui/control_bottom_app_bar.dart';
|
||||
import 'package:immich_mobile/modules/home/ui/immich_sliver_appbar.dart';
|
||||
@ -21,8 +22,7 @@ class HomePage extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final appSettingService = ref.watch(appSettingsServiceProvider);
|
||||
var renderList = ref.watch(renderListProvider);
|
||||
|
||||
final multiselectEnabled = useState(false);
|
||||
final multiselectEnabled = ref.watch(multiselectProvider.notifier);
|
||||
final selection = useState(<AssetResponseDto>{});
|
||||
|
||||
useEffect(
|
||||
@ -41,29 +41,31 @@ class HomePage extends HookConsumerWidget {
|
||||
|
||||
Widget buildBody() {
|
||||
void selectionListener(
|
||||
bool multiselect, Set<AssetResponseDto> selectedAssets) {
|
||||
multiselectEnabled.value = multiselect;
|
||||
bool multiselect,
|
||||
Set<AssetResponseDto> selectedAssets,
|
||||
) {
|
||||
multiselectEnabled.state = multiselect;
|
||||
selection.value = selectedAssets;
|
||||
}
|
||||
|
||||
void onShareAssets() {
|
||||
ref.watch(shareServiceProvider).shareAssets(selection.value.toList());
|
||||
multiselectEnabled.value = false;
|
||||
multiselectEnabled.state = false;
|
||||
}
|
||||
|
||||
void onDelete() {
|
||||
ref.watch(assetProvider.notifier).deleteAssets(selection.value);
|
||||
multiselectEnabled.value = false;
|
||||
multiselectEnabled.state = false;
|
||||
}
|
||||
|
||||
return SafeArea(
|
||||
bottom: !multiselectEnabled.value,
|
||||
top: !multiselectEnabled.value,
|
||||
bottom: !multiselectEnabled.state,
|
||||
top: !multiselectEnabled.state,
|
||||
child: Stack(
|
||||
children: [
|
||||
CustomScrollView(
|
||||
slivers: [
|
||||
multiselectEnabled.value
|
||||
multiselectEnabled.state
|
||||
? const SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 70,
|
||||
@ -84,10 +86,10 @@ class HomePage extends HookConsumerWidget {
|
||||
showStorageIndicator: appSettingService
|
||||
.getSetting(AppSettingsEnum.storageIndicator),
|
||||
listener: selectionListener,
|
||||
selectionActive: multiselectEnabled.value,
|
||||
selectionActive: multiselectEnabled.state,
|
||||
),
|
||||
),
|
||||
if (multiselectEnabled.value) ...[
|
||||
if (multiselectEnabled.state) ...[
|
||||
ControlBottomAppBar(
|
||||
onShare: onShareAssets,
|
||||
onDelete: onDelete,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/modules/home/providers/multiselect.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
|
||||
class TabControllerPage extends ConsumerWidget {
|
||||
@ -10,6 +10,7 @@ class TabControllerPage extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final multiselectEnabled = ref.watch(multiselectProvider);
|
||||
|
||||
return AutoTabsRouter(
|
||||
routes: [
|
||||
@ -30,7 +31,7 @@ class TabControllerPage extends ConsumerWidget {
|
||||
opacity: animation,
|
||||
child: child,
|
||||
),
|
||||
bottomNavigationBar: false
|
||||
bottomNavigationBar: multiselectEnabled
|
||||
? null
|
||||
: BottomNavigationBar(
|
||||
selectedLabelStyle: const TextStyle(
|
||||
|
Loading…
Reference in New Issue
Block a user