b6aa820378
Keep the Material-only chat conversation implementation while preserving public Cupertino parameters for downstream compatibility. Narrow the matching tests to the Material path.
74 lines
2.4 KiB
Dart
74 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../domain/chat_shells.dart';
|
|
import 'chat_background_tasks_controller.dart';
|
|
import 'chat_background_tasks_panel.dart';
|
|
|
|
/// A task inspector needs a reading surface, rather than alert-sized content.
|
|
class ChatBackgroundTasksDialog extends StatelessWidget {
|
|
const ChatBackgroundTasksDialog({
|
|
super.key,
|
|
required this.controller,
|
|
required this.onClose,
|
|
});
|
|
final ChatBackgroundTasksController controller;
|
|
final VoidCallback onClose;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => ListenableBuilder(
|
|
listenable: controller,
|
|
builder: (context, _) => _dialog(context),
|
|
);
|
|
|
|
Widget _dialog(BuildContext context) {
|
|
final title = (controller.automationStatus.count ?? 0) > 0
|
|
? (controller.running.isEmpty ? 'Automations' : 'Tasks and automations')
|
|
: backgroundTasksTitle;
|
|
final panel = Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: ChatBackgroundTasksPanel(controller: controller),
|
|
);
|
|
return Dialog(
|
|
constraints: const BoxConstraints(maxWidth: 840),
|
|
insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
maxHeight: MediaQuery.sizeOf(context).height * 0.88,
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24, 20, 12, 0),
|
|
child: Wrap(
|
|
alignment: WrapAlignment.spaceBetween,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
spacing: 12,
|
|
runSpacing: 8,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Icon(Icons.layers_outlined),
|
|
const SizedBox(width: 12),
|
|
Flexible(
|
|
child: Text(
|
|
title,
|
|
style: Theme.of(context).textTheme.titleLarge,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
TextButton(onPressed: onClose, child: const Text('Done')),
|
|
],
|
|
),
|
|
),
|
|
Flexible(child: SingleChildScrollView(child: panel)),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|