Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

photos: conditionally show add album button based on offline mode and permissions

AmanRajSinghMourya94d5144dd5de
diff --git a/mobile/apps/photos/lib/ui/components/home_header_widget.dart b/mobile/apps/photos/lib/ui/components/home_header_widget.dart
index 8f7b3bed94..c75c10769a 100644
--- a/mobile/apps/photos/lib/ui/components/home_header_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/home_header_widget.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import "package:photos/service_locator.dart";
import "package:photos/ui/common/backup_flow_helper.dart";
import 'package:photos/ui/components/buttons/icon_button_widget.dart';
@@ -13,6 +14,8 @@ class HomeHeaderWidget extends StatefulWidget {
class _HomeHeaderWidgetState extends State<HomeHeaderWidget> {
@override
Widget build(BuildContext context) {
+ final showAddAlbumAction =
+ !isOfflineMode || permissionService.hasGrantedLimitedPermissions();
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -32,11 +35,13 @@ class _HomeHeaderWidgetState extends State<HomeHeaderWidget> {
duration: const Duration(milliseconds: 250),
child: widget.centerWidget,
),
- IconButtonWidget(
- icon: Icons.add_photo_alternate_outlined,
- iconButtonType: IconButtonType.primary,
- onTap: () async => handleFullPermissionBackupFlow(context),
- ),
+ showAddAlbumAction
+ ? IconButtonWidget(
+ icon: Icons.add_photo_alternate_outlined,
+ iconButtonType: IconButtonType.primary,
+ onTap: () async => handleFullPermissionBackupFlow(context),
+ )
+ : const SizedBox(width: 48, height: 48),
],
);
}