Map gallery: Fixed broken UI for FileSelectionOverlay
This commit is contained in:
parent
233a005927
commit
6f2c3c3e56
|
@ -83,6 +83,7 @@ class HomeGalleryWidget extends StatelessWidget {
|
|||
scrollBottomSafeArea: bottomSafeArea + 180,
|
||||
);
|
||||
return Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
gallery,
|
||||
FileSelectionOverlayBar(GalleryType.homepage, selectedFiles)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import "dart:async";
|
||||
|
||||
import "package:defer_pointer/defer_pointer.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:logging/logging.dart";
|
||||
import "package:photos/core/event_bus.dart";
|
||||
|
@ -44,30 +45,35 @@ class _MapPullUpGalleryState extends State<MapPullUpGallery> {
|
|||
|
||||
Widget? cachedScrollableContent;
|
||||
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
DraggableScrollableSheet(
|
||||
expand: false,
|
||||
initialChildSize: initialChildSize,
|
||||
minChildSize: initialChildSize,
|
||||
maxChildSize: 0.8,
|
||||
snap: true,
|
||||
snapSizes: const [0.5],
|
||||
builder: (context, scrollController) {
|
||||
//Must use cached widget here to avoid rebuilds when DraggableScrollableSheet
|
||||
//is snapped to it's initialChildSize
|
||||
cachedScrollableContent ??=
|
||||
cacheScrollableContent(scrollController, context, logger);
|
||||
return cachedScrollableContent!;
|
||||
},
|
||||
),
|
||||
FileSelectionOverlayBar(
|
||||
GalleryType.searchResults,
|
||||
_selectedFiles,
|
||||
backgroundColor: getEnteColorScheme(context).backgroundElevated2,
|
||||
),
|
||||
],
|
||||
return DeferredPointerHandler(
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
DraggableScrollableSheet(
|
||||
expand: false,
|
||||
initialChildSize: initialChildSize,
|
||||
minChildSize: initialChildSize,
|
||||
maxChildSize: 0.8,
|
||||
snap: true,
|
||||
snapSizes: const [0.5],
|
||||
builder: (context, scrollController) {
|
||||
//Must use cached widget here to avoid rebuilds when DraggableScrollableSheet
|
||||
//is snapped to it's initialChildSize
|
||||
cachedScrollableContent ??=
|
||||
cacheScrollableContent(scrollController, context, logger);
|
||||
return cachedScrollableContent!;
|
||||
},
|
||||
),
|
||||
DeferPointer(
|
||||
child: FileSelectionOverlayBar(
|
||||
GalleryType.searchResults,
|
||||
_selectedFiles,
|
||||
backgroundColor: getEnteColorScheme(context).backgroundElevated2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class FileSelectionOverlayBar extends StatefulWidget {
|
|||
|
||||
class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
|
||||
final GlobalKey shareButtonKey = GlobalKey();
|
||||
final ValueNotifier<double> _bottomPosition = ValueNotifier(-150.0);
|
||||
final ValueNotifier<bool> _hasSelectedFilesNotifier = ValueNotifier(false);
|
||||
late bool showDeleteOption;
|
||||
|
||||
@override
|
||||
|
@ -127,15 +127,17 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
|
|||
),
|
||||
);
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: _bottomPosition,
|
||||
valueListenable: _hasSelectedFilesNotifier,
|
||||
builder: (context, value, child) {
|
||||
return AnimatedPositioned(
|
||||
curve: Curves.easeInOutExpo,
|
||||
bottom: _bottomPosition.value,
|
||||
right: 0,
|
||||
left: 0,
|
||||
return AnimatedCrossFade(
|
||||
firstCurve: Curves.easeInOutExpo,
|
||||
secondCurve: Curves.easeInOutExpo,
|
||||
sizeCurve: Curves.easeInOutExpo,
|
||||
crossFadeState: _hasSelectedFilesNotifier.value
|
||||
? CrossFadeState.showFirst
|
||||
: CrossFadeState.showSecond,
|
||||
duration: const Duration(milliseconds: 400),
|
||||
child: BottomActionBarWidget(
|
||||
firstChild: BottomActionBarWidget(
|
||||
selectedFiles: widget.selectedFiles,
|
||||
hasSmallerBottomPadding: true,
|
||||
type: widget.galleryType,
|
||||
|
@ -155,6 +157,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
|
|||
iconButtons: iconsButton,
|
||||
backgroundColor: widget.backgroundColor,
|
||||
),
|
||||
secondChild: const SizedBox(width: double.infinity),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -170,8 +173,6 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
|
|||
}
|
||||
|
||||
_selectedFilesListener() {
|
||||
widget.selectedFiles.files.isNotEmpty
|
||||
? _bottomPosition.value = 0.0
|
||||
: _bottomPosition.value = -150.0;
|
||||
_hasSelectedFilesNotifier.value = widget.selectedFiles.files.isNotEmpty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {
|
|||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Gallery(
|
||||
loadingWidget: Column(
|
||||
|
|
|
@ -379,6 +379,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.4"
|
||||
defer_pointer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: defer_pointer
|
||||
sha256: d69e6f8c1d0f052d2616cc1db3782e0ea73f42e4c6f6122fd1a548dfe79faf02
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.2"
|
||||
device_info:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -36,6 +36,7 @@ dependencies:
|
|||
connectivity_plus: ^3.0.3
|
||||
crypto: ^3.0.2
|
||||
cupertino_icons: ^1.0.0
|
||||
defer_pointer: ^0.0.2
|
||||
device_info: ^2.0.2
|
||||
dio: ^4.0.6
|
||||
dots_indicator: ^2.0.0
|
||||
|
|
Loading…
Reference in a new issue