Map gallery: Fixed broken UI for FileSelectionOverlay

This commit is contained in:
ashilkn 2023-06-25 03:13:11 +05:30
parent 233a005927
commit 6f2c3c3e56
6 changed files with 53 additions and 35 deletions

View file

@ -83,6 +83,7 @@ class HomeGalleryWidget extends StatelessWidget {
scrollBottomSafeArea: bottomSafeArea + 180,
);
return Stack(
alignment: Alignment.bottomCenter,
children: [
gallery,
FileSelectionOverlayBar(GalleryType.homepage, selectedFiles)

View file

@ -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,8 +45,10 @@ class _MapPullUpGalleryState extends State<MapPullUpGallery> {
Widget? cachedScrollableContent;
return Stack(
fit: StackFit.expand,
return DeferredPointerHandler(
child: Stack(
alignment: Alignment.bottomCenter,
clipBehavior: Clip.none,
children: [
DraggableScrollableSheet(
expand: false,
@ -62,12 +65,15 @@ class _MapPullUpGalleryState extends State<MapPullUpGallery> {
return cachedScrollableContent!;
},
),
FileSelectionOverlayBar(
DeferPointer(
child: FileSelectionOverlayBar(
GalleryType.searchResults,
_selectedFiles,
backgroundColor: getEnteColorScheme(context).backgroundElevated2,
),
),
],
),
);
}

View file

@ -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;
}
}

View file

@ -203,6 +203,7 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {
builder: (context, snapshot) {
if (snapshot.hasData) {
return Stack(
alignment: Alignment.bottomCenter,
children: [
Gallery(
loadingWidget: Column(

View file

@ -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:

View file

@ -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