close all tabs prompt

This commit is contained in:
Fabian Freund
2025-07-25 22:17:07 +02:00
parent a1b859d8be
commit 9ae21190f4
@@ -186,11 +186,39 @@ class _TabSheetHeader extends HookConsumerWidget {
TextButton.icon(
onPressed: () async {
final container = ref.read(selectedContainerProvider);
final result = await showDialog<bool?>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Close All Tabs'),
content: Text(
(container != null)
? 'Are you sure you want to close all container tabs?'
: 'Are you sure you want to close all unassigned tabs?',
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(context, false);
},
child: const Text('Cancel'),
),
TextButton(
onPressed: () {
Navigator.pop(context, true);
},
child: const Text('Close'),
),
],
);
},
);
if (result == true) {
await ref
.read(tabDataRepositoryProvider.notifier)
.closeAllTabsByContainer(container);
onClose();
}
},
icon: const Icon(MdiIcons.closeBoxMultiple),
label: const Text('Close All'),