From 8b7d7f166605593ba4fd86dcdbb3107749ccc7e9 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 24 Jan 2023 12:23:06 -0600 Subject: [PATCH] fix(mobile): Home page app bar icons don't conform to theme change (#1409) * fix(mobile): Home page app bar icons don't conform to theme change * Remove unsued code --- mobile/lib/main.dart | 7 --- ...ver_appbar.dart => home_page_app_bar.dart} | 12 ++--- mobile/lib/modules/home/views/home_page.dart | 45 ++++++++----------- mobile/lib/utils/immich_app_theme.dart | 3 -- 4 files changed, 24 insertions(+), 43 deletions(-) rename mobile/lib/modules/home/ui/{immich_sliver_appbar.dart => home_page_app_bar.dart} (93%) diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index eaae6a39e9..6564b20139 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -3,7 +3,6 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_displaymode/flutter_displaymode.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; @@ -57,12 +56,6 @@ Future initApp() async { await openBoxes(); - SystemChrome.setSystemUIOverlayStyle( - const SystemUiOverlayStyle( - statusBarIconBrightness: Brightness.light, - ), - ); - if (kReleaseMode && Platform.isAndroid) { try { await FlutterDisplayMode.setHighRefreshRate(); diff --git a/mobile/lib/modules/home/ui/immich_sliver_appbar.dart b/mobile/lib/modules/home/ui/home_page_app_bar.dart similarity index 93% rename from mobile/lib/modules/home/ui/immich_sliver_appbar.dart rename to mobile/lib/modules/home/ui/home_page_app_bar.dart index aeac61c9dc..919884b5b4 100644 --- a/mobile/lib/modules/home/ui/immich_sliver_appbar.dart +++ b/mobile/lib/modules/home/ui/home_page_app_bar.dart @@ -10,8 +10,11 @@ import 'package:immich_mobile/shared/models/server_info_state.model.dart'; import 'package:immich_mobile/modules/backup/providers/backup.provider.dart'; import 'package:immich_mobile/shared/providers/server_info.provider.dart'; -class ImmichSliverAppBar extends ConsumerWidget { - const ImmichSliverAppBar({ +class HomePageAppBar extends ConsumerWidget with PreferredSizeWidget { + @override + Size get preferredSize => const Size.fromHeight(kToolbarHeight); + + const HomePageAppBar({ Key? key, this.onPopBack, }) : super(key: key); @@ -25,11 +28,8 @@ class ImmichSliverAppBar extends ConsumerWidget { ref.watch(authenticationProvider).deviceInfo.isAutoBackup; final ServerInfoState serverInfoState = ref.watch(serverInfoProvider); - return SliverAppBar( + return AppBar( centerTitle: true, - floating: true, - pinned: false, - snap: false, backgroundColor: Theme.of(context).appBarTheme.backgroundColor, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( diff --git a/mobile/lib/modules/home/views/home_page.dart b/mobile/lib/modules/home/views/home_page.dart index 022eb6d152..3ea097cd16 100644 --- a/mobile/lib/modules/home/views/home_page.dart +++ b/mobile/lib/modules/home/views/home_page.dart @@ -11,7 +11,7 @@ import 'package:immich_mobile/modules/album/services/album.service.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'; +import 'package:immich_mobile/modules/home/ui/home_page_app_bar.dart'; import 'package:immich_mobile/modules/home/ui/profile_drawer/profile_drawer.dart'; import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart'; import 'package:immich_mobile/modules/settings/services/app_settings.service.dart'; @@ -197,33 +197,19 @@ class HomePage extends HookConsumerWidget { top: true, child: Stack( children: [ - CustomScrollView( - slivers: [ - if (!multiselectEnabled.state) - ImmichSliverAppBar( - onPopBack: reloadAllAsset, + ref.watch(assetProvider).renderList == null || + ref.watch(assetProvider).allAssets.isEmpty + ? buildLoadingIndicator() + : ImmichAssetGrid( + renderList: ref.watch(assetProvider).renderList!, + allAssets: ref.watch(assetProvider).allAssets, + assetsPerRow: appSettingService + .getSetting(AppSettingsEnum.tilesPerRow), + showStorageIndicator: appSettingService + .getSetting(AppSettingsEnum.storageIndicator), + listener: selectionListener, + selectionActive: selectionEnabledHook.value, ), - ], - ), - Padding( - padding: EdgeInsets.only( - top: selectionEnabledHook.value ? 0 : 60, - bottom: 0.0, - ), - child: ref.watch(assetProvider).renderList == null || - ref.watch(assetProvider).allAssets.isEmpty - ? buildLoadingIndicator() - : ImmichAssetGrid( - renderList: ref.watch(assetProvider).renderList!, - allAssets: ref.watch(assetProvider).allAssets, - assetsPerRow: appSettingService - .getSetting(AppSettingsEnum.tilesPerRow), - showStorageIndicator: appSettingService - .getSetting(AppSettingsEnum.storageIndicator), - listener: selectionListener, - selectionActive: selectionEnabledHook.value, - ), - ), if (selectionEnabledHook.value) ControlBottomAppBar( onShare: onShareAssets, @@ -238,6 +224,11 @@ class HomePage extends HookConsumerWidget { } return Scaffold( + appBar: multiselectEnabled.state + ? null + : HomePageAppBar( + onPopBack: reloadAllAsset, + ), drawer: const ProfileDrawer(), body: buildBody(), ); diff --git a/mobile/lib/utils/immich_app_theme.dart b/mobile/lib/utils/immich_app_theme.dart index 28bfc19bb6..a180627d2c 100644 --- a/mobile/lib/utils/immich_app_theme.dart +++ b/mobile/lib/utils/immich_app_theme.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/constants/immich_colors.dart'; import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart'; @@ -41,7 +40,6 @@ ThemeData immichDarkTheme = ThemeData( foregroundColor: immichDarkThemePrimaryColor, elevation: 1, centerTitle: true, - systemOverlayStyle: SystemUiOverlayStyle.light, ), bottomNavigationBarTheme: BottomNavigationBarThemeData( type: BottomNavigationBarType.fixed, @@ -97,7 +95,6 @@ ThemeData immichLightTheme = ThemeData( foregroundColor: Colors.indigo, elevation: 1, centerTitle: true, - systemOverlayStyle: SystemUiOverlayStyle.dark, ), bottomNavigationBarTheme: BottomNavigationBarThemeData( type: BottomNavigationBarType.fixed,