Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Animate visibility toggling of appbar and bottom bar when toggling swipe lock

ashilkn6cb5c06ea8ce
diff --git a/mobile/lib/ui/viewer/file/file_app_bar.dart b/mobile/lib/ui/viewer/file/file_app_bar.dart
index 6c2c2ab0a8..df4f425767 100644
--- a/mobile/lib/ui/viewer/file/file_app_bar.dart
+++ b/mobile/lib/ui/viewer/file/file_app_bar.dart
@@ -118,21 +118,27 @@ class FileAppBarState extends State<FileAppBar> {
stops: const [0, 0.2, 1],
),
),
- child: AppBar(
- iconTheme: const IconThemeData(
- color: Colors.white,
- ), //same for both themes
- leading: IconButton(
- icon: const Icon(Icons.arrow_back),
- onPressed: () {
- _isFileSwipeLocked
- ? _requestAuthentication()
- : Navigator.of(context).pop();
- },
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 250),
+ switchInCurve: Curves.easeInOut,
+ switchOutCurve: Curves.easeInOut,
+ child: AppBar(
+ key: ValueKey(_isFileSwipeLocked),
+ iconTheme: const IconThemeData(
+ color: Colors.white,
+ ), //same for both themes
+ leading: IconButton(
+ icon: const Icon(Icons.arrow_back),
+ onPressed: () {
+ _isFileSwipeLocked
+ ? _requestAuthentication()
+ : Navigator.of(context).pop();
+ },
+ ),
+ actions: shouldShowActions && !_isFileSwipeLocked ? _actions : [],
+ elevation: 0,
+ backgroundColor: const Color(0x00000000),
),
- actions: shouldShowActions && !_isFileSwipeLocked ? _actions : [],
- elevation: 0,
- backgroundColor: const Color(0x00000000),
),
),
),
diff --git a/mobile/lib/ui/viewer/file/file_bottom_bar.dart b/mobile/lib/ui/viewer/file/file_bottom_bar.dart
index 5183a7dba2..9db7275918 100644
--- a/mobile/lib/ui/viewer/file/file_bottom_bar.dart
+++ b/mobile/lib/ui/viewer/file/file_bottom_bar.dart
@@ -38,8 +38,8 @@ class FileBottomBar extends StatefulWidget {
required this.onFileRemoved,
required this.enableFullScreenNotifier,
this.userID,
- Key? key,
- }) : super(key: key);
+ super.key,
+ });
@override
FileBottomBarState createState() => FileBottomBarState();
@@ -76,7 +76,7 @@ class FileBottomBarState extends State<FileBottomBar> {
isPanorama = widget.file.isPanorama() ?? false;
_checkPanorama();
}
- return _isFileSwipeLocked ? Container() : _getBottomBar();
+ return _getBottomBar();
}
// _checkPanorama() method is used to check if the file is a panorama image.
@@ -222,8 +222,9 @@ class FileBottomBarState extends State<FileBottomBar> {
return IgnorePointer(
ignoring: isFullScreen || _isFileSwipeLocked,
child: AnimatedOpacity(
- opacity: isFullScreen ? 0 : 1,
- duration: const Duration(milliseconds: 150),
+ opacity: isFullScreen || _isFileSwipeLocked ? 0 : 1,
+ duration: const Duration(milliseconds: 250),
+ curve: Curves.easeInOut,
child: Align(
alignment: Alignment.bottomCenter,
child: Container(