Skip to content

armgit / ente

Public Imported from GitHub
0

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

update trash page delete all button

AmanRajSinghMourya12f9626d7f41
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
index 8d98d27c9b..5cd664c6ba 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
@@ -1,6 +1,3 @@
-import 'dart:math';
-import 'dart:ui';
-
import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter/material.dart';
import 'package:photos/core/event_bus.dart';
@@ -10,7 +7,6 @@ import 'package:photos/events/force_reload_trash_page_event.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/gallery_type.dart';
import 'package:photos/models/selected_files.dart';
-import 'package:photos/ui/common/bottom_shadow.dart';
import "package:photos/ui/components/empty_state_component.dart";
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import 'package:photos/ui/viewer/gallery/gallery.dart';
@@ -18,7 +14,6 @@ import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';
import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
-import 'package:photos/utils/delete_file_util.dart';
class TrashPage extends StatelessWidget {
final String tagPrefix;
@@ -34,13 +29,13 @@ class TrashPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final bool filesAreSelected = _selectedFiles.files.isNotEmpty;
- final bottomPadding = MediaQuery.of(context).padding.bottom;
- final deleteAllButtonHeight = 40.0 + max(bottomPadding, 6.0) + 12.0;
final appBar = GalleryAppBarWidget.sliverConfig(
appBarType,
AppLocalizations.of(context).trash,
_selectedFiles,
+ subtitle: AppLocalizations.of(
+ context,
+ ).itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion,
);
final gallery = Gallery(
@@ -63,7 +58,6 @@ class TrashPage extends StatelessWidget {
forceReloadEvents: [Bus.instance.on<ForceReloadTrashPageEvent>()],
tagPrefix: tagPrefix,
selectedFiles: _selectedFiles,
- header: _headerWidget(),
initialFiles: null,
emptyState: EmptyStateComponent(
assetPath: "assets/empty_state_trash.png",
@@ -80,24 +74,6 @@ class TrashPage extends StatelessWidget {
alignment: Alignment.bottomCenter,
children: [
gallery,
- const BottomShadowWidget(offsetDy: 20),
- AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- curve: Curves.easeInOut,
- height: filesAreSelected ? 0 : deleteAllButtonHeight,
- child: AnimatedOpacity(
- duration: const Duration(milliseconds: 100),
- opacity: filesAreSelected ? 0.0 : 1.0,
- curve: Curves.easeIn,
- child: IgnorePointer(
- ignoring: filesAreSelected,
- child: const SafeArea(
- minimum: EdgeInsets.only(bottom: 6),
- child: BottomButtonsWidget(),
- ),
- ),
- ),
- ),
FileSelectionOverlayBar(GalleryType.trash, _selectedFiles),
],
),
@@ -106,70 +82,4 @@ class TrashPage extends StatelessWidget {
),
);
}
-
- Widget _headerWidget() {
- return FutureBuilder<int>(
- future: TrashDB.instance.count(),
- builder: (context, snapshot) {
- if (snapshot.hasData && snapshot.data! > 0) {
- return Padding(
- padding: const EdgeInsets.all(16),
- child: Text(
- AppLocalizations.of(
- context,
- ).itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion,
- style: Theme.of(context).textTheme.bodySmall,
- ),
- );
- } else {
- return const SizedBox.shrink();
- }
- },
- );
- }
-}
-
-class BottomButtonsWidget extends StatelessWidget {
- const BottomButtonsWidget({super.key});
-
- @override
- Widget build(BuildContext context) {
- return Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(24),
- child: InkWell(
- child: BackdropFilter(
- filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
- child: Container(
- height: 40,
- decoration: const BoxDecoration(
- color: Color.fromRGBO(255, 101, 101, 0.2),
- ),
- child: Center(
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 8.0,
- horizontal: 16,
- ),
- child: Text(
- AppLocalizations.of(context).deleteAll,
- style: Theme.of(context).textTheme.titleSmall!.copyWith(
- color: const Color.fromRGBO(255, 101, 101, 1),
- ),
- ),
- ),
- ),
- ),
- ),
- onTap: () async {
- await emptyTrash(context);
- },
- ),
- ),
- ],
- );
- }
}