Commit 087633f

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2023-12-16 13:39:19
add custom column deletion
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent f597dee
Changed files (1)
lib
screens
subsettings
lib/screens/subsettings/export_import/export_column_management_screen.dart
@@ -39,13 +39,41 @@ class ExportColumnsManagementScreen extends StatelessWidget {
                   ListTile(
                     title: Text(column.userTitle(localizations)),
                     subtitle: Text(column.formatPattern.toString()),
-                    trailing: const Icon(Icons.edit),
-                    onTap: () async {
-                      final editedColumn = await showAddExportColumnDialoge(context, column);
-                      if (editedColumn != null) {
-                        columnsManager.addOrUpdate(editedColumn);
-                      } // TODO: deleting
-                    },
+                    trailing: Row(
+                      mainAxisSize: MainAxisSize.min,
+                      children: [
+                        IconButton(
+                          icon: const Icon(Icons.edit),
+                          onPressed: () async {
+                            final editedColumn = await showAddExportColumnDialoge(context, column);
+                            if (editedColumn != null) {
+                              columnsManager.addOrUpdate(editedColumn);
+                            }
+                          },
+                        ),
+                        IconButton(
+                          onPressed: () async {
+                            final confirmed = await showDialog<bool>(context: context,
+                              builder: (context) => AlertDialog(
+                                title: Text(AppLocalizations.of(context)!.confirmDelete),
+                                actions: [
+                                  ElevatedButton(
+                                    onPressed: () => Navigator.of(context).pop(false),
+                                    child: Text(AppLocalizations.of(context)!.btnCancel)),
+                                  ElevatedButton(
+                                    onPressed: () => Navigator.of(context).pop(true),
+                                    child: Text(AppLocalizations.of(context)!.btnConfirm)),
+                                ],
+                              )
+                            ) ?? false;
+                            if (confirmed) {
+                              columnsManager.deleteUserColumn(column.internalIdentifier);
+                            }
+                          },
+                          icon: const Icon(Icons.delete)
+                        )
+                      ],
+                    ),
                   ),
                 ListTile(
                   leading: const Icon(Icons.add),