Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Fix: FileAppbar buttons not working on some screens

ashilkn45f15490795f
diff --git a/mobile/lib/ui/viewer/file/custom_app_bar.dart b/mobile/lib/ui/viewer/file/custom_app_bar.dart
deleted file mode 100644
index 1003e56af9..0000000000
--- a/mobile/lib/ui/viewer/file/custom_app_bar.dart
+++ /dev/null
@@ -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,
- );
- }
-}
diff --git a/mobile/lib/ui/viewer/file/detail_page.dart b/mobile/lib/ui/viewer/file/detail_page.dart
index 7e8795c978..3751e327f6 100644
--- a/mobile/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/lib/ui/viewer/file/detail_page.dart
@@ -156,7 +156,6 @@ class _DetailPageState extends State<DetailPage> {
return FileAppBar(
_files![selectedIndex],
_onFileRemoved,
- 100,
widget.config.mode == DetailPageMode.full,
enableFullScreenNotifier: _enableFullScreenNotifier,
);
diff --git a/mobile/lib/ui/viewer/file/file_app_bar.dart b/mobile/lib/ui/viewer/file/file_app_bar.dart
index e763a174cc..46adbad5d4 100644
--- a/mobile/lib/ui/viewer/file/file_app_bar.dart
+++ b/mobile/lib/ui/viewer/file/file_app_bar.dart
@@ -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) {