Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge remote-tracking branch 'origin/main' into remove-intl_utils

Prateek Sunaldd420a80a436
diff --cc mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
index 44b895a553,e58cc2780e..4fa9d1226c
--- a/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
@@@ -67,48 -75,8 +75,8 @@@ class _DeduplicatePageState extends Sta
return Scaffold(
appBar: AppBar(
elevation: 0,
- title: Text(S.of(context).deduplicateFiles),
+ title: Text(AppLocalizations.of(context).deduplicateFiles),
- actions: <Widget>[
- PopupMenuButton(
- constraints: const BoxConstraints(minWidth: 180),
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(8),
- ),
- ),
- onSelected: (dynamic value) {
- setState(() {
- selectedGrids.clear();
- });
- },
- offset: const Offset(0, 50),
- itemBuilder: (BuildContext context) => [
- PopupMenuItem(
- value: true,
- height: 32,
- child: Row(
- children: [
- const Icon(
- Icons.remove_circle_outline,
- size: 20,
- ),
- const SizedBox(width: 12),
- Padding(
- padding: const EdgeInsets.only(bottom: 1),
- child: Text(
- AppLocalizations.of(context).deselectAll,
- style: Theme.of(context)
- .textTheme
- .titleMedium!
- .copyWith(fontWeight: FontWeight.w600),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ],
+ actions: _duplicates.isNotEmpty ? [_getSortMenu()] : null,
),
body: _getBody(),
);
@@@ -272,55 -223,60 +223,60 @@@
totalSize += toDeleteCount * _duplicates[index].size;
}
}
- final String text = AppLocalizations.of(context).deleteItemCount(fileCount);
- return SizedBox(
- width: double.infinity,
- child: SafeArea(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: crossAxisSpacing),
- child: TextButton(
- style: OutlinedButton.styleFrom(
- backgroundColor:
- Theme.of(context).colorScheme.inverseBackgroundColor,
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- const Padding(padding: EdgeInsets.all(4)),
- Text(
- text,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 14,
- color: Theme.of(context).colorScheme.inverseTextColor,
- ),
- textAlign: TextAlign.center,
+ final hasSelectedFiles = fileCount > 0;
+
+ return AnimatedSwitcher(
+ duration: const Duration(milliseconds: 200),
+ switchInCurve: Curves.easeOut,
+ switchOutCurve: Curves.easeIn,
+ child: hasSelectedFiles
+ ? SafeArea(
+ child: Container(
+ key: const ValueKey('bottom_buttons'),
+ padding: const EdgeInsets.symmetric(
+ horizontal: crossAxisSpacing,
+ vertical: 8,
),
- const Padding(padding: EdgeInsets.all(2)),
- Text(
- formatBytes(totalSize),
- style: TextStyle(
- color: Theme.of(context)
- .colorScheme
- .inverseTextColor
- .withValues(alpha: 0.7),
- fontSize: 12,
- ),
+ decoration: BoxDecoration(
+ color: getEnteColorScheme(context).backgroundBase,
),
- const Padding(padding: EdgeInsets.all(2)),
- ],
- ),
- onPressed: () async {
- try {
- await deleteDuplicates(totalSize);
- } catch (e) {
- log("Failed to delete duplicates", error: e);
- showGenericErrorDialog(context: context, error: e).ignore();
- }
- },
- ),
- ),
- ),
+ child: Column(
+ children: [
+ SizedBox(
+ width: double.infinity,
+ child: ButtonWidget(
+ labelText:
- "${S.of(context).deleteItemCount(fileCount)} (${formatBytes(totalSize)})",
++ "${AppLocalizations.of(context).deleteItemCount(fileCount)} (${formatBytes(totalSize)})",
+ buttonType: ButtonType.critical,
+ onTap: () async {
+ try {
+ await deleteDuplicates(totalSize);
+ } catch (e) {
+ log("Failed to delete duplicates", error: e);
+ showGenericErrorDialog(context: context, error: e)
+ .ignore();
+ }
+ },
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: ButtonWidget(
+ labelText: "Unselect all", // TODO: lau: extract string
+ buttonType: ButtonType.secondary,
+ onTap: () async {
+ setState(() {
+ selectedGrids.clear();
+ });
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ )
+ : const SizedBox.shrink(key: ValueKey('empty')),
);
}