From 229357df2bd4dd2e76cb41f46312295c7e692a4f Mon Sep 17 00:00:00 2001
From: Alex <alex.tran1502@gmail.com>
Date: Sat, 30 Apr 2022 17:03:45 -0500
Subject: [PATCH] Appbar on homepage is fixed so the cursor won't be
 overlapping when scrolling

---
 mobile/lib/modules/home/ui/image_grid.dart    |  2 +-
 mobile/lib/modules/home/views/home_page.dart  | 22 +++++++---
 .../sharing/views/album_viewer_page.dart      | 40 +++++++++----------
 3 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/mobile/lib/modules/home/ui/image_grid.dart b/mobile/lib/modules/home/ui/image_grid.dart
index 1ac6d61ba7..4a22811aac 100644
--- a/mobile/lib/modules/home/ui/image_grid.dart
+++ b/mobile/lib/modules/home/ui/image_grid.dart
@@ -12,7 +12,7 @@ class ImageGrid extends ConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     return SliverGrid(
       gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
-        crossAxisCount: 3,
+        crossAxisCount: 4,
         crossAxisSpacing: 5.0,
         mainAxisSpacing: 5,
       ),
diff --git a/mobile/lib/modules/home/views/home_page.dart b/mobile/lib/modules/home/views/home_page.dart
index fd2e2baf81..06a3127949 100644
--- a/mobile/lib/modules/home/views/home_page.dart
+++ b/mobile/lib/modules/home/views/home_page.dart
@@ -100,13 +100,23 @@ class HomePage extends HookConsumerWidget {
         top: !isMultiSelectEnable,
         child: Stack(
           children: [
-            DraggableScrollbar.semicircle(
-              backgroundColor: Theme.of(context).primaryColor,
-              controller: _scrollController,
-              heightScrollThumb: 48.0,
-              child: CustomScrollView(
+            CustomScrollView(
+              slivers: [
+                _buildSliverAppBar(),
+              ],
+            ),
+            Padding(
+              padding: const EdgeInsets.only(top: 50.0),
+              child: DraggableScrollbar.semicircle(
+                backgroundColor: Theme.of(context).primaryColor,
                 controller: _scrollController,
-                slivers: [_buildSliverAppBar(), ..._imageGridGroup],
+                heightScrollThumb: 48.0,
+                child: CustomScrollView(
+                  controller: _scrollController,
+                  slivers: [
+                    ..._imageGridGroup,
+                  ],
+                ),
               ),
             ),
             _buildSelectedItemCountIndicator(),
diff --git a/mobile/lib/modules/sharing/views/album_viewer_page.dart b/mobile/lib/modules/sharing/views/album_viewer_page.dart
index 0e21bb06c4..ae8436abf5 100644
--- a/mobile/lib/modules/sharing/views/album_viewer_page.dart
+++ b/mobile/lib/modules/sharing/views/album_viewer_page.dart
@@ -215,31 +215,29 @@ class AlbumViewerPage extends HookConsumerWidget {
         onTap: () {
           titleFocusNode.unfocus();
         },
-        child: Stack(children: [
-          DraggableScrollbar.semicircle(
-            backgroundColor: Theme.of(context).primaryColor,
+        child: DraggableScrollbar.semicircle(
+          backgroundColor: Theme.of(context).primaryColor,
+          controller: _scrollController,
+          heightScrollThumb: 48.0,
+          child: CustomScrollView(
             controller: _scrollController,
-            heightScrollThumb: 48.0,
-            child: CustomScrollView(
-              controller: _scrollController,
-              slivers: [
-                _buildHeader(albumInfo),
-                SliverPersistentHeader(
-                  pinned: true,
-                  delegate: ImmichSliverPersistentAppBarDelegate(
-                    minHeight: 50,
-                    maxHeight: 50,
-                    child: Container(
-                      color: immichBackgroundColor,
-                      child: _buildControlButton(albumInfo),
-                    ),
+            slivers: [
+              _buildHeader(albumInfo),
+              SliverPersistentHeader(
+                pinned: true,
+                delegate: ImmichSliverPersistentAppBarDelegate(
+                  minHeight: 50,
+                  maxHeight: 50,
+                  child: Container(
+                    color: immichBackgroundColor,
+                    child: _buildControlButton(albumInfo),
                   ),
                 ),
-                _buildImageGrid(albumInfo)
-              ],
-            ),
+              ),
+              _buildImageGrid(albumInfo)
+            ],
           ),
-        ]),
+        ),
       );
     }