Present background tasks as adaptive status cards
This commit is contained in:
@@ -2,10 +2,9 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../domain/chat_shells.dart';
|
||||
import '../ui/sessions/chat_adaptive.dart';
|
||||
import 'chat_background_tasks_controller.dart';
|
||||
import 'chat_background_tasks_panel.dart';
|
||||
import 'chat_background_tasks_dialog.dart';
|
||||
|
||||
/// Compact live task count: a quiet control inside the composer beside Send,
|
||||
/// shown only while tasks run. Details live only in its modal.
|
||||
@@ -58,35 +57,14 @@ class _ChatBackgroundTasksState extends State<ChatBackgroundTasks> {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
final cupertino =
|
||||
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
||||
Widget dialog(BuildContext context) {
|
||||
final content = ChatBackgroundTasksPanel(controller: controller);
|
||||
void close() => Navigator.of(context).pop();
|
||||
return cupertino
|
||||
? CupertinoAlertDialog(
|
||||
key: const Key('chat-background-tasks-modal'),
|
||||
title: const Text(backgroundTasksTitle),
|
||||
content: content,
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: close,
|
||||
child: const Text('Done'),
|
||||
),
|
||||
],
|
||||
)
|
||||
: AlertDialog(
|
||||
key: const Key('chat-background-tasks-modal'),
|
||||
title: const Text(backgroundTasksTitle),
|
||||
scrollable: true,
|
||||
content: content,
|
||||
actions: [
|
||||
TextButton(onPressed: close, child: const Text('Done')),
|
||||
],
|
||||
);
|
||||
}
|
||||
Widget dialog(BuildContext context) => ChatBackgroundTasksDialog(
|
||||
key: const Key('chat-background-tasks-modal'),
|
||||
controller: controller,
|
||||
onClose: () => Navigator.of(context, rootNavigator: true).pop(),
|
||||
);
|
||||
|
||||
final TransitionRoute<void> route = cupertino
|
||||
? CupertinoDialogRoute<void>(
|
||||
context: context,
|
||||
? CupertinoModalPopupRoute<void>(
|
||||
barrierDismissible: true,
|
||||
builder: dialog,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user