Skip to content

Commit

Permalink
Merge pull request #11 from arungovindm2001/hiddenFiles
Browse files Browse the repository at this point in the history
Adds hidden files toggle button using pop up menu and switch
  • Loading branch information
HrX03 authored Apr 17, 2022
2 parents 711d8c6 + bd819e2 commit 5e5d545
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion lib/widgets/workspace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,33 @@ class _FilesWorkspaceState extends State<FilesWorkspace> {
),
],
actions: [
PopupMenuButton<String>(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
offset: const Offset(0, 50),
onSelected: (value) {
if (value == 'showHidden') {
controller.showHidden = !controller.showHidden;
}
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'showHidden',
child: SwitchListTile(
title: const Text('Show hidden files'),
value: controller.showHidden,
onChanged: (value) {
setState(() {
controller.showHidden = value;
controller.currentDir = controller.currentDir;
Navigator.pop(context);
});
},
),
),
],
),
IconButton(
icon: const Icon(
Icons.create_new_folder_outlined,
Expand Down Expand Up @@ -335,6 +362,7 @@ class WorkspaceController with ChangeNotifier {
late String _currentDir;
final List<double> _columnWidths = [480, 180, 120, 120];
bool _ascending = true;
bool _showHidden = false;
int _columnIndex = 0;
final List<EntityInfo> _selectedItems = [];
List<EntityInfo>? _currentInfo;
Expand All @@ -354,7 +382,7 @@ class WorkspaceController with ChangeNotifier {
_loadingProgress = value;
notifyListeners();
},
showHidden: true,
showHidden: _showHidden,
ascending: _ascending,
columnIndex: _columnIndex,
onFileSystemException: (value) {},
Expand Down Expand Up @@ -384,6 +412,12 @@ class WorkspaceController with ChangeNotifier {
notifyListeners();
}

bool get showHidden => _showHidden;
set showHidden(bool value) {
_showHidden = value;
notifyListeners();
}

int get columnIndex => _columnIndex;
set columnIndex(int value) {
_columnIndex = value;
Expand Down

0 comments on commit 5e5d545

Please sign in to comment.