96de9f5bea
Keep the Material-only conversation implementation while preserving public Cupertino parameters for callers. Narrow affected tests to Material hosts so the dead platform paths are no longer exercised.
31 lines
920 B
Dart
31 lines
920 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Selects a retained pane when the window cannot show every chat at once.
|
|
Future<void> showChatPanePicker(
|
|
BuildContext context, {
|
|
required List<({String id, String title})> panes,
|
|
required String? activeId,
|
|
required ValueChanged<String> onSelected,
|
|
String title = 'Open chats',
|
|
}) async {
|
|
final selected = await showDialog<String>(
|
|
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);
|
|
}
|