Selaa lähdekoodia

Add View all at the bottom for onEnte section

Neeraj Gupta 2 vuotta sitten
vanhempi
commit
bec98f7f8b

+ 1 - 0
lib/generated/intl/messages_en.dart

@@ -1294,6 +1294,7 @@ class MessageLookup extends MessageLookupByLibrary {
         "videoSmallCase": MessageLookupByLibrary.simpleMessage("video"),
         "viewActiveSessions":
             MessageLookupByLibrary.simpleMessage("View active sessions"),
+        "viewAll": MessageLookupByLibrary.simpleMessage("View all"),
         "viewAllExifData":
             MessageLookupByLibrary.simpleMessage("View all EXIF data"),
         "viewLogs": MessageLookupByLibrary.simpleMessage("View logs"),

+ 10 - 0
lib/generated/l10n.dart

@@ -7444,6 +7444,16 @@ class S {
       args: [],
     );
   }
+
+  /// `View all`
+  String get viewAll {
+    return Intl.message(
+      'View all',
+      name: 'viewAll',
+      desc: '',
+      args: [],
+    );
+  }
 }
 
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {

+ 2 - 1
lib/l10n/intl_en.arb

@@ -1086,5 +1086,6 @@
   "addPhotos": "Add photos",
   "unpinAlbum": "Unpin album",
   "pinAlbum": "Pin album",
-  "create": "Create"
+  "create": "Create",
+  "viewAll": "View all"
 }

+ 1 - 1
lib/ui/collections/create_new_album_widget.dart

@@ -16,7 +16,7 @@ class CreateNewAlbumIcon extends StatelessWidget {
   Widget build(BuildContext context) {
     return IconButtonWidget(
       icon: Icons.add_rounded,
-      iconButtonType: IconButtonType.primary,
+      iconButtonType: IconButtonType.secondary,
       onTap: () async {
         final result = await showTextInputDialog(
           context,

+ 5 - 2
lib/ui/collections/horizontal_grid_view.dart

@@ -1,3 +1,5 @@
+import "dart:math";
+
 import 'package:flutter/material.dart';
 import "package:photos/models/collection.dart";
 import "package:photos/ui/collections/album/row_item.dart";
@@ -18,8 +20,9 @@ class CollectionsHorizontalGridView extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    const double sizeBoxHeight =
-        (maxThumbnailWidth + albumNameSectionHeight + rowItemBottomPadding) * 2;
+    final double sizeBoxHeight =
+        (maxThumbnailWidth + albumNameSectionHeight + rowItemBottomPadding) *
+            min((collections?.length ?? 0), 2);
 
     return SizedBox(
       height: sizeBoxHeight,

+ 3 - 1
lib/ui/tabs/section_title.dart

@@ -6,12 +6,14 @@ import "package:styled_text/styled_text.dart";
 
 class SectionTitle extends StatelessWidget {
   final String? title;
+  final bool mutedTitle;
   final Widget? titleWithBrand;
   final EdgeInsetsGeometry? padding;
 
   const SectionTitle({
     this.title,
     this.titleWithBrand,
+    this.mutedTitle = false,
     Key? key,
     this.padding,
   }) : super(key: key);
@@ -25,7 +27,7 @@ class SectionTitle extends StatelessWidget {
     } else if (title != null) {
       child = Text(
         title!,
-        style: enteTextTheme.largeBold,
+        style: mutedTitle ? enteTextTheme.bodyMuted : enteTextTheme.largeBold,
       );
     } else {
       child = const SizedBox.shrink();

+ 24 - 30
lib/ui/tabs/user_collections_tab.dart

@@ -152,19 +152,6 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
         margin: const EdgeInsets.only(bottom: 50),
         child: Column(
           children: [
-            Padding(
-              padding: const EdgeInsets.only(left: 12.0, bottom: 8, right: 12),
-              child: Row(
-                mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                children: [
-                  Text(
-                    S.of(context).albums,
-                    style: enteTextTheme.h2Bold,
-                  ),
-                  const CreateNewAlbumIcon(),
-                ],
-              ),
-            ),
             SectionOptions(
               SectionTitle(title: S.of(context).onDevice),
               trailingWidget: IconButtonWidget(
@@ -188,11 +175,34 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
             SectionOptions(
               SectionTitle(titleWithBrand: getOnEnteSection(context)),
               trailingWidget: _sortMenu(collections),
+              padding: const EdgeInsets.only(left: 12, right: 6),
             ),
             DeleteEmptyAlbums(collections ?? []),
             Configuration.instance.hasConfiguredAccount()
                 ? CollectionsHorizontalGridView(collections)
                 : const EmptyState(),
+            GestureDetector(
+              onTap: () {
+                unawaited(
+                  routeToPage(
+                    context,
+                    CollectionVerticalGridView(
+                      collections,
+                      appTitle: SectionTitle(
+                        titleWithBrand: getOnEnteSection(context),
+                      ),
+                    ),
+                  ),
+                );
+              },
+              child: SectionOptions(
+                SectionTitle(title: S.of(context).viewAll, mutedTitle: true),
+                trailingWidget: const IconButtonWidget(
+                  icon: Icons.chevron_right,
+                  iconButtonType: IconButtonType.secondary,
+                ),
+              ),
+            ),
             const Divider(),
             const SizedBox(height: 16),
             Padding(
@@ -245,6 +255,7 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
       ),
       child: Row(
         children: [
+          const CreateNewAlbumIcon(),
           GestureDetector(
             onTapDown: (TapDownDetails details) async {
               final int? selectedValue = await showMenu<int>(
@@ -274,23 +285,6 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
               iconButtonType: IconButtonType.secondary,
             ),
           ),
-          IconButtonWidget(
-            icon: Icons.chevron_right,
-            iconButtonType: IconButtonType.secondary,
-            onTap: () {
-              unawaited(
-                routeToPage(
-                  context,
-                  CollectionVerticalGridView(
-                    collections,
-                    appTitle: SectionTitle(
-                      titleWithBrand: getOnEnteSection(context),
-                    ),
-                  ),
-                ),
-              );
-            },
-          )
         ],
       ),
     );