[mob][photos] Fix: FileAppbar buttons not working on some screens (#5022)

## Description

The Appbar was getting cut off at the bottom, likely due to a larger top
inset on certain screens, which makes the AppBar buttons unclickable
(have received reports on the favourite button being unclickable).

This change ensures that the Appbar remains useable on all screens. 

#### Before  
<img
src="https://github.com/user-attachments/assets/9611aae5-0671-4767-b5b6-22bac1f9d8f3"
width="320">



#### After  
<img
src="https://github.com/user-attachments/assets/8a360440-1d92-4168-a0e6-b8151b2a2788"
width="320">
This commit is contained in:
Ashil
2025-02-11 16:14:00 +05:30
committed by GitHub
3 changed files with 26 additions and 56 deletions

View File

@@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
class CustomAppBar extends PreferredSize {
@override
final Widget child;
@override
final Size preferredSize;
final double height;
const CustomAppBar(
this.child,
this.preferredSize, {
Key? key,
this.height = kToolbarHeight,
}) : super(key: key, child: child, preferredSize: preferredSize);
@override
Widget build(BuildContext context) {
return Container(
height: preferredSize.height,
alignment: Alignment.center,
child: child,
);
}
}

View File

@@ -156,7 +156,6 @@ class _DetailPageState extends State<DetailPage> {
return FileAppBar(
_files![selectedIndex],
_onFileRemoved,
100,
widget.config.mode == DetailPageMode.full,
enableFullScreenNotifier: _enableFullScreenNotifier,
);

View File

@@ -23,7 +23,6 @@ import "package:photos/services/local_authentication_service.dart";
import "package:photos/services/preview_video_store.dart";
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/ui/viewer/file/custom_app_bar.dart';
import "package:photos/ui/viewer/file_details/favorite_widget.dart";
import "package:photos/ui/viewer/file_details/upload_icon_widget.dart";
import 'package:photos/utils/dialog_util.dart';
@@ -35,14 +34,12 @@ import 'package:photos/utils/toast_util.dart';
class FileAppBar extends StatefulWidget {
final EnteFile file;
final Function(EnteFile) onFileRemoved;
final double height;
final bool shouldShowActions;
final ValueNotifier<bool> enableFullScreenNotifier;
const FileAppBar(
this.file,
this.onFileRemoved,
this.height,
this.shouldShowActions, {
required this.enableFullScreenNotifier,
super.key,
@@ -98,8 +95,9 @@ class FileAppBarState extends State<FileAppBar> {
final isTrashedFile = widget.file is TrashFile;
final shouldShowActions = widget.shouldShowActions && !isTrashedFile;
return CustomAppBar(
ValueListenableBuilder(
return PreferredSize(
preferredSize: const Size.fromHeight(kToolbarHeight),
child: ValueListenableBuilder(
valueListenable: widget.enableFullScreenNotifier,
builder: (context, bool isFullScreen, child) {
return IgnorePointer(
@@ -124,32 +122,33 @@ class FileAppBarState extends State<FileAppBar> {
stops: const [0, 0.2, 1],
),
),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
switchInCurve: Curves.easeInOut,
switchOutCurve: Curves.easeInOut,
child: AppBar(
clipBehavior: Clip.none,
key: ValueKey(isGuestView),
iconTheme: const IconThemeData(
color: Colors.white,
), //same for both themes
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
isGuestView
? _requestAuthentication()
: Navigator.of(context).pop();
},
child: SafeArea(
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
switchInCurve: Curves.easeInOut,
switchOutCurve: Curves.easeInOut,
child: AppBar(
clipBehavior: Clip.none,
key: ValueKey(isGuestView),
iconTheme: const IconThemeData(
color: Colors.white,
), //same for both themes
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
isGuestView
? _requestAuthentication()
: Navigator.of(context).pop();
},
),
actions: shouldShowActions && !isGuestView ? _actions : [],
elevation: 0,
backgroundColor: const Color(0x00000000),
),
actions: shouldShowActions && !isGuestView ? _actions : [],
elevation: 0,
backgroundColor: const Color(0x00000000),
),
),
),
),
Size.fromHeight(Platform.isAndroid ? 84 : 96),
);
}
@@ -179,10 +178,7 @@ class FileAppBarState extends State<FileAppBar> {
}
if (!isFileHidden && isFileUploaded) {
_actions.add(
Padding(
padding: const EdgeInsets.all(8),
child: FavoriteWidget(widget.file),
),
Center(child: FavoriteWidget(widget.file)),
);
}
if (!isFileUploaded) {