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 (#9026)
This commit is contained in:
parent
732bd1e652
commit
a0d03925e0
3 changed files with 51 additions and 18 deletions
mobile/lib/modules/home
|
@ -17,7 +17,7 @@ class DisableMultiSelectButton extends ConsumerWidget {
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 16.0, top: 16.0),
|
padding: const EdgeInsets.only(left: 16.0, top: 8.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: ElevatedButton.icon(
|
child: ElevatedButton.icon(
|
||||||
|
|
|
@ -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:immich_mobile/shared/ui/immich_toast.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:immich_mobile/modules/home/ui/control_bottom_app_bar.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/shared/models/asset.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/providers/scroll_to_date_notifier.provider.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/haptic_feedback.provider.dart';
|
||||||
|
import 'package:immich_mobile/shared/providers/tab.provider.dart';
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
|
|
||||||
import 'asset_grid_data_structure.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(
|
final listWidget = ScrollablePositionedList.builder(
|
||||||
padding: const EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
|
top: appBarOffset() ? 60 : 0,
|
||||||
bottom: 220,
|
bottom: 220,
|
||||||
),
|
),
|
||||||
itemBuilder: _itemBuilder,
|
itemBuilder: _itemBuilder,
|
||||||
|
@ -256,6 +264,9 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
|
||||||
controller: _itemScrollController,
|
controller: _itemScrollController,
|
||||||
backgroundColor: context.themeData.hintColor,
|
backgroundColor: context.themeData.hintColor,
|
||||||
labelTextBuilder: _labelBuilder,
|
labelTextBuilder: _labelBuilder,
|
||||||
|
padding: appBarOffset()
|
||||||
|
? const EdgeInsets.only(top: 60)
|
||||||
|
: const EdgeInsets.only(),
|
||||||
labelConstraints: const BoxConstraints(maxHeight: 28),
|
labelConstraints: const BoxConstraints(maxHeight: 28),
|
||||||
scrollbarAnimationDuration: const Duration(milliseconds: 300),
|
scrollbarAnimationDuration: const Duration(milliseconds: 300),
|
||||||
scrollbarTimeToFade: const Duration(milliseconds: 1000),
|
scrollbarTimeToFade: const Duration(milliseconds: 1000),
|
||||||
|
@ -264,7 +275,13 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
|
||||||
: listWidget;
|
: listWidget;
|
||||||
return widget.onRefresh == null
|
return widget.onRefresh == null
|
||||||
? child
|
? child
|
||||||
: RefreshIndicator(onRefresh: widget.onRefresh!, child: child);
|
: appBarOffset()
|
||||||
|
? RefreshIndicator(
|
||||||
|
onRefresh: widget.onRefresh!,
|
||||||
|
edgeOffset: 30,
|
||||||
|
child: child,
|
||||||
|
)
|
||||||
|
: RefreshIndicator(onRefresh: widget.onRefresh!, child: child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _scrollToDate() {
|
void _scrollToDate() {
|
||||||
|
|
|
@ -98,21 +98,37 @@ class HomePage extends HookConsumerWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Stack(
|
||||||
appBar: ref.watch(multiselectProvider) ? null : const ImmichAppBar(),
|
children: [
|
||||||
body: MultiselectGrid(
|
MultiselectGrid(
|
||||||
topWidget: (currentUser != null && currentUser.memoryEnabled)
|
topWidget: (currentUser != null && currentUser.memoryEnabled)
|
||||||
? const MemoryLane()
|
? const MemoryLane()
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
renderListProvider: timelineUsers.length > 1
|
renderListProvider: timelineUsers.length > 1
|
||||||
? multiUserAssetsProvider(timelineUsers)
|
? multiUserAssetsProvider(timelineUsers)
|
||||||
: assetsProvider(currentUser?.isarId),
|
: assetsProvider(currentUser?.isarId),
|
||||||
buildLoadingIndicator: buildLoadingIndicator,
|
buildLoadingIndicator: buildLoadingIndicator,
|
||||||
onRefresh: refreshAssets,
|
onRefresh: refreshAssets,
|
||||||
stackEnabled: true,
|
stackEnabled: true,
|
||||||
archiveEnabled: true,
|
archiveEnabled: true,
|
||||||
editEnabled: 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(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue