Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Update select all button's state checking if all are selected or not on each select/unselect operation

ashilkn1b993a617a79
diff --git a/mobile/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 53d835fce4..8f58c1f04f 100644
--- a/mobile/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -112,14 +112,14 @@ class _SelectAllButtonState extends State<SelectAllButton> {
bool _selectAll = false;
@override
Widget build(BuildContext context) {
+ final selectionState = SelectionState.of(context);
return GestureDetector(
onTap: () {
setState(() {
- final selectionState = SelectionState.of(context);
if (_selectAll) {
- selectionState?.selectedFiles.clearAll();
+ selectionState.selectedFiles.clearAll();
} else {
- selectionState?.selectedFiles
+ selectionState.selectedFiles
.selectAll(selectionState.allGalleryFiles!.toSet());
}
_selectAll = !_selectAll;
@@ -133,10 +133,22 @@ class _SelectAllButtonState extends State<SelectAllButton> {
mainAxisSize: MainAxisSize.min,
children: [
const Text("All"),
- Icon(
- _selectAll ? Icons.check_circle : Icons.check_circle_outline,
- color:
- _selectAll ? getEnteColorScheme(context).strokeMuted : null,
+ ListenableBuilder(
+ listenable: selectionState.selectedFiles,
+ builder: (context, _) {
+ if (selectionState.selectedFiles.files.length ==
+ selectionState.allGalleryFiles!.length) {
+ _selectAll = true;
+ } else {
+ _selectAll = false;
+ }
+ return Icon(
+ _selectAll ? Icons.check_circle : Icons.check_circle_outline,
+ color: _selectAll
+ ? getEnteColorScheme(context).strokeMuted
+ : null,
+ );
+ },
),
],
),