close all tabs prompt
This commit is contained in:
+30
-2
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user