Skip to content

Commit

Permalink
Add invert selection in file view
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Sep 11, 2024
1 parent 64a8d01 commit bff8a55
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 83 deletions.
8 changes: 4 additions & 4 deletions app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.971.0)
aws-sdk-core (3.203.0)
aws-partitions (1.973.0)
aws-sdk-core (3.204.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.89.0)
aws-sdk-kms (1.90.0)
aws-sdk-core (~> 3, >= 3.203.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.160.0)
aws-sdk-s3 (1.161.0)
aws-sdk-core (~> 3, >= 3.203.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down
4 changes: 2 additions & 2 deletions app/lib/views/files/entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void deleteEntities({
required BuildContext context,
required bool isMobile,
required DocumentFileSystem documentSystem,
required List<String> entities,
required Set<String> entities,
required VoidCallback onDelete,
}) {
final colorScheme = Theme.of(context).colorScheme;
Expand Down Expand Up @@ -140,7 +140,7 @@ class _FileEntityItemState extends State<FileEntityItem> {
context: context,
isMobile: widget.isMobile,
documentSystem: documentSystem,
entities: [widget.entity.location.path],
entities: {widget.entity.location.path},
onDelete: widget.onReload,
);

Expand Down
42 changes: 35 additions & 7 deletions app/lib/views/files/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FilesViewState extends State<FilesView> {
String _search = '';
late final SettingsCubit _settingsCubit;
Stream<FileSystemEntity<NoteData>?>? _filesStream;
final List<String> _selectedFiles = [];
final Set<String> _selectedFiles = {};

@override
void initState() {
Expand Down Expand Up @@ -501,12 +501,40 @@ class FilesViewState extends State<FilesView> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
icon: const PhosphorIcon(
PhosphorIconsLight.selectionSlash),
tooltip: AppLocalizations.of(context).deselect,
onPressed: () =>
setState(() => _selectedFiles.clear()),
Row(
children: [
IconButton(
icon: const PhosphorIcon(
PhosphorIconsLight.selectionSlash),
tooltip:
AppLocalizations.of(context).deselect,
onPressed: () =>
setState(() => _selectedFiles.clear()),
),
IconButton(
icon: const PhosphorIcon(
PhosphorIconsLight.selectionInverse),
tooltip: AppLocalizations.of(context)
.invertSelection,
onPressed: () async {
final directory = await _documentSystem
.getAsset(_locationController.text,
readData: false);
if (directory
is! FileSystemDirectory<NoteData>) {
return;
}
setState(() {
final all = _selectedFiles.toSet();
_selectedFiles.clear();
_selectedFiles.addAll(directory.assets
.map((e) => e.path)
.toSet()
.difference(all));
});
},
),
],
),
Builder(builder: (context) {
return IconButton(
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"remark-gemoji": "^8.0.0",
"remark-heading-id": "^1.0.1",
"sharp": "^0.33.5",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"packageManager": "[email protected]",
"devDependencies": {
Expand Down
Loading

0 comments on commit bff8a55

Please sign in to comment.