Browse Source

deselect all option for dedupe screen

ashilkn 2 years ago
parent
commit
b83411f0bb
1 changed files with 43 additions and 1 deletions
  1. 43 1
      lib/ui/tools/deduplicate_page.dart

+ 43 - 1
lib/ui/tools/deduplicate_page.dart

@@ -88,6 +88,48 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
       appBar: AppBar(
       appBar: AppBar(
         elevation: 0,
         elevation: 0,
         title: const Text("Deduplicate Files"),
         title: const Text("Deduplicate Files"),
+        actions: <Widget>[
+          PopupMenuButton(
+            color: Theme.of(context).colorScheme.defaultBackgroundColor,
+            constraints: const BoxConstraints(minWidth: 180),
+            shape: const RoundedRectangleBorder(
+              borderRadius: BorderRadius.all(
+                Radius.circular(8),
+              ),
+            ),
+            onSelected: (value) {
+              setState(() {
+                _selectedFiles.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(
+                        "Deselect all",
+                        style: Theme.of(context)
+                            .textTheme
+                            .subtitle1
+                            .copyWith(fontWeight: FontWeight.w600),
+                      ),
+                    ),
+                  ],
+                ),
+              )
+            ],
+          )
+        ],
       ),
       ),
       body: _getBody(),
       body: _getBody(),
     );
     );
@@ -141,7 +183,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
             shrinkWrap: true,
             shrinkWrap: true,
           ),
           ),
         ),
         ),
-        _selectedFiles.isEmpty ? Container() : _getDeleteButton(),
+        _selectedFiles.isEmpty ? const SizedBox.shrink() : _getDeleteButton(),
       ],
       ],
     );
     );
   }
   }