import 'package:flutter/material.dart'; /// Selects a retained pane when the window cannot show every chat at once. Future showChatPanePicker( BuildContext context, { required List<({String id, String title})> panes, required String? activeId, required ValueChanged onSelected, String title = 'Open chats', }) async { final selected = await showDialog( context: context, builder: (context) => SimpleDialog( title: Text(title), children: [ for (final pane in panes) SimpleDialogOption( onPressed: () => Navigator.pop(context, pane.id), child: Row( children: [ Expanded(child: Text(pane.title)), if (pane.id == activeId) const Icon(Icons.check), ], ), ), ], ), ); if (selected != null && context.mounted) onSelected(selected); }