]> git.proxmox.com Git - flutter/proxmox_login_manager.git/commitdiff
add delete account button
authorTim Marx <t.marx@proxmox.com>
Tue, 25 Aug 2020 09:43:21 +0000 (11:43 +0200)
committerTim Marx <t.marx@proxmox.com>
Tue, 25 Aug 2020 09:43:21 +0000 (11:43 +0200)
Signed-off-by: Tim Marx <t.marx@proxmox.com>
lib/proxmox_login_selector.dart

index 8cd02ff1c40706eff175cb3a29613b7e919a12be..12a3995c942a86fbad9bea79fe1bffda0b2911f5 100644 (file)
@@ -55,13 +55,25 @@ class _ProxmoxLoginSelectorState extends State<ProxmoxLoginSelector> {
                               title: Text(l.origin.host),
                               subtitle: Text(l.fullUsername),
                               trailing: Icon(Icons.navigate_next),
+                              leading: PopupMenuButton(
+                                  itemBuilder: (context) => [
+                                        PopupMenuItem(
+                                          child: ListTile(
+                                            dense: true,
+                                            leading: Icon(Icons.delete),
+                                            title: Text('Delete'),
+                                            onTap: () {
+                                              snapshot.data
+                                                  .rebuild(
+                                                      (b) => b.logins.remove(l))
+                                                  .saveToDisk();
+                                              refreshFromStorage();
+                                              Navigator.of(context).pop();
+                                            },
+                                          ),
+                                        )
+                                      ]),
                               onTap: () => _login(user: l),
-                              onLongPress: () {
-                                snapshot.data
-                                    .rebuild((b) => b.logins.remove(l))
-                                    .saveToDisk();
-                                refreshFromStorage();
-                              },
                             ))
                         ?.toList() ??
                     [],