1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-28 06:32:44 +01:00

fix(mobile): appBar on home screen animates out and doesnt alter asset grid position ()

This commit is contained in:
Conner Hnatiuk 2024-04-25 08:36:35 -06:00 committed by GitHub
parent 732bd1e652
commit a0d03925e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 18 deletions

View file

@ -17,7 +17,7 @@ class DisableMultiSelectButton extends ConsumerWidget {
return Align(
alignment: Alignment.topLeft,
child: Padding(
padding: const EdgeInsets.only(left: 16.0, top: 16.0),
padding: const EdgeInsets.only(left: 16.0, top: 8.0),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: ElevatedButton.icon(

View file

@ -16,9 +16,11 @@ import 'package:immich_mobile/modules/home/ui/asset_grid/thumbnail_placeholder.d
import 'package:immich_mobile/shared/ui/immich_toast.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:immich_mobile/modules/home/ui/control_bottom_app_bar.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/modules/asset_viewer/providers/scroll_to_date_notifier.provider.dart';
import 'package:immich_mobile/shared/providers/haptic_feedback.provider.dart';
import 'package:immich_mobile/shared/providers/tab.provider.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'asset_grid_data_structure.dart';
@ -235,8 +237,14 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
}
}
bool appBarOffset() {
return ref.watch(tabProvider).index == 0 &&
ModalRoute.of(context)?.settings.name == TabControllerRoute.name;
}
final listWidget = ScrollablePositionedList.builder(
padding: const EdgeInsets.only(
padding: EdgeInsets.only(
top: appBarOffset() ? 60 : 0,
bottom: 220,
),
itemBuilder: _itemBuilder,
@ -256,6 +264,9 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
controller: _itemScrollController,
backgroundColor: context.themeData.hintColor,
labelTextBuilder: _labelBuilder,
padding: appBarOffset()
? const EdgeInsets.only(top: 60)
: const EdgeInsets.only(),
labelConstraints: const BoxConstraints(maxHeight: 28),
scrollbarAnimationDuration: const Duration(milliseconds: 300),
scrollbarTimeToFade: const Duration(milliseconds: 1000),
@ -264,6 +275,12 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
: listWidget;
return widget.onRefresh == null
? child
: appBarOffset()
? RefreshIndicator(
onRefresh: widget.onRefresh!,
edgeOffset: 30,
child: child,
)
: RefreshIndicator(onRefresh: widget.onRefresh!, child: child);
}

View file

@ -98,9 +98,9 @@ class HomePage extends HookConsumerWidget {
}
}
return Scaffold(
appBar: ref.watch(multiselectProvider) ? null : const ImmichAppBar(),
body: MultiselectGrid(
return Stack(
children: [
MultiselectGrid(
topWidget: (currentUser != null && currentUser.memoryEnabled)
? const MemoryLane()
: const SizedBox(),
@ -113,6 +113,22 @@ class HomePage extends HookConsumerWidget {
archiveEnabled: true,
editEnabled: true,
),
AnimatedPositioned(
duration: const Duration(milliseconds: 300),
top: ref.watch(multiselectProvider)
? -(kToolbarHeight + MediaQuery.of(context).padding.top)
: 0,
left: 0,
right: 0,
child: Container(
height: kToolbarHeight + MediaQuery.of(context).padding.top,
color: context.themeData.appBarTheme.backgroundColor,
child: const SafeArea(
child: ImmichAppBar(),
),
),
),
],
);
}
}