mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
fix: expand sheet when album search is focused (#20651)
* fix: expand sheet when album search is focused * convert GeneralBottomSheet to ConsumerStatefulWidget * fix: cleaning up --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
a91bb399f0
commit
081307ced2
2 changed files with 35 additions and 5 deletions
|
|
@ -25,12 +25,30 @@ import 'package:immich_mobile/providers/server_info.provider.dart';
|
|||
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
|
||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||
|
||||
class GeneralBottomSheet extends ConsumerWidget {
|
||||
class GeneralBottomSheet extends ConsumerStatefulWidget {
|
||||
final double? minChildSize;
|
||||
const GeneralBottomSheet({super.key, this.minChildSize});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
ConsumerState<GeneralBottomSheet> createState() => _GeneralBottomSheetState();
|
||||
}
|
||||
|
||||
class _GeneralBottomSheetState extends ConsumerState<GeneralBottomSheet> {
|
||||
late DraggableScrollableController sheetController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
sheetController = DraggableScrollableController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
sheetController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final multiselect = ref.watch(multiSelectProvider);
|
||||
final isTrashEnable = ref.watch(serverInfoProvider.select((state) => state.serverFeatures.trash));
|
||||
|
||||
|
|
@ -59,9 +77,14 @@ class GeneralBottomSheet extends ConsumerWidget {
|
|||
ref.read(multiSelectProvider.notifier).reset();
|
||||
}
|
||||
|
||||
Future<void> onKeyboardExpand() {
|
||||
return sheetController.animateTo(0.85, duration: const Duration(milliseconds: 200), curve: Curves.easeInOut);
|
||||
}
|
||||
|
||||
return BaseBottomSheet(
|
||||
controller: sheetController,
|
||||
initialChildSize: 0.45,
|
||||
minChildSize: minChildSize,
|
||||
minChildSize: widget.minChildSize,
|
||||
maxChildSize: 0.85,
|
||||
shouldCloseOnMinExtent: false,
|
||||
actions: [
|
||||
|
|
@ -90,7 +113,7 @@ class GeneralBottomSheet extends ConsumerWidget {
|
|||
],
|
||||
slivers: [
|
||||
const AddToAlbumHeader(),
|
||||
AlbumSelector(onAlbumSelected: addAssetsToAlbum),
|
||||
AlbumSelector(onAlbumSelected: addAssetsToAlbum, onKeyboardExpanded: onKeyboardExpand),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue