folders actions #5
					 1 changed files with 59 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -108,6 +108,12 @@ class _FolderDrawerState extends State<FolderDrawer> {
 | 
			
		|||
                  Navigator.of(context).pop();
 | 
			
		||||
                },
 | 
			
		||||
                child: const Text("Rename"),
 | 
			
		||||
              ),
 | 
			
		||||
              TextButton(
 | 
			
		||||
                onPressed: () {
 | 
			
		||||
                  Navigator.of(context).pop();
 | 
			
		||||
                },
 | 
			
		||||
                child: const Text("Cancel"),
 | 
			
		||||
              )
 | 
			
		||||
            ],
 | 
			
		||||
          );
 | 
			
		||||
| 
						 | 
				
			
			@ -116,6 +122,30 @@ class _FolderDrawerState extends State<FolderDrawer> {
 | 
			
		|||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<void> doubleCheckDelete(String folderTobeDeleted) async {
 | 
			
		||||
    return showDialog<void>(
 | 
			
		||||
        context: context,
 | 
			
		||||
        barrierDismissible: false,
 | 
			
		||||
        builder: (BuildContext context) {
 | 
			
		||||
          return AlertDialog(
 | 
			
		||||
            title: Text("Confirm delete of: $folderTobeDeleted"),
 | 
			
		||||
            actions: [
 | 
			
		||||
              TextButton(
 | 
			
		||||
                  onPressed: () {
 | 
			
		||||
                    ApiService().deleteFolder(folderTobeDeleted);
 | 
			
		||||
                    Navigator.of(context).pop();
 | 
			
		||||
                  },
 | 
			
		||||
                  child: Text("Yes")),
 | 
			
		||||
              TextButton(
 | 
			
		||||
                  onPressed: () {
 | 
			
		||||
                    Navigator.of(context).pop();
 | 
			
		||||
                  },
 | 
			
		||||
                  child: Text("No")),
 | 
			
		||||
            ],
 | 
			
		||||
          );
 | 
			
		||||
        });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void _showOptions(BuildContext context, String folderName) async {
 | 
			
		||||
    final RenderBox overlay =
 | 
			
		||||
        Overlay.of(context).context.findRenderObject() as RenderBox;
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +173,8 @@ class _FolderDrawerState extends State<FolderDrawer> {
 | 
			
		|||
      } else if (value == 'Delete') {
 | 
			
		||||
        // Logic for deleting the folder
 | 
			
		||||
        print("Deleting $folderName");
 | 
			
		||||
        ApiService().deleteFolder(folderName);
 | 
			
		||||
        doubleCheckDelete(folderName);
 | 
			
		||||
        // ApiService().deleteFolder(folderName);
 | 
			
		||||
        print('Deleted folder');
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			@ -179,6 +210,12 @@ class NewMailbox extends StatelessWidget {
 | 
			
		|||
          },
 | 
			
		||||
          child: const Text("Approve"),
 | 
			
		||||
        ),
 | 
			
		||||
        TextButton(
 | 
			
		||||
          onPressed: () {
 | 
			
		||||
            Navigator.of(context).pop();
 | 
			
		||||
          },
 | 
			
		||||
          child: const Text("Cancel"),
 | 
			
		||||
        )
 | 
			
		||||
      ],
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue