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

This commit is contained in:
ashilkn
2024-07-23 11:47:35 +05:30
parent 4cfc38c4db
commit 6cb5c06ea8
2 changed files with 26 additions and 19 deletions

View File

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

View File

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