close all tabs prompt
This commit is contained in:
+30
-2
@@ -186,11 +186,39 @@ class _TabSheetHeader extends HookConsumerWidget {
|
|||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final container = ref.read(selectedContainerProvider);
|
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
|
await ref
|
||||||
.read(tabDataRepositoryProvider.notifier)
|
.read(tabDataRepositoryProvider.notifier)
|
||||||
.closeAllTabsByContainer(container);
|
.closeAllTabsByContainer(container);
|
||||||
|
}
|
||||||
onClose();
|
|
||||||
},
|
},
|
||||||
icon: const Icon(MdiIcons.closeBoxMultiple),
|
icon: const Icon(MdiIcons.closeBoxMultiple),
|
||||||
label: const Text('Close All'),
|
label: const Text('Close All'),
|
||||||
|
|||||||
Reference in New Issue
Block a user