Files
pipelines/app/lib/features/chat/files/files_upload_notice.dart
T
alan f21365f609 Remove Cupertino chat file branches
Keep the Material-only file explorer path while preserving public APIs used by callers. Remove unreachable Cupertino widgets, hosts, routes, and tests so the app remains behaviorally unchanged on Material screens.
2026-11-11 01:23:59 +00:00

61 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'files_controller.dart';
/// The Files panel's operation feedback: a progress strip while files are
/// being stored or an entry is being renamed, moved or deleted, and the
/// server's refusal (exists, sign in, too large, not empty, outside home)
/// until the operator dismisses it. These are separate from the folder error,
/// whose Retry reloads the listing.
class FilesUploadNotice extends StatelessWidget {
const FilesUploadNotice({super.key, required this.controller});
final FilesController controller;
@override
Widget build(BuildContext context) {
final progress = controller.uploading > 0
? controller.uploadLabel
: controller.mutationLabel;
return Column(
children: [
if (progress != null)
Semantics(
label: progress,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
child: Row(
children: [
const Expanded(child: LinearProgressIndicator()),
const SizedBox(width: 12),
Text(progress),
],
),
),
),
if (controller.uploadError != null)
_Refusal(
message: controller.uploadError!,
onDismiss: controller.dismissUploadError,
),
if (controller.mutationError != null)
_Refusal(
message: controller.mutationError!,
onDismiss: controller.dismissMutationError,
),
],
);
}
}
class _Refusal extends StatelessWidget {
const _Refusal({required this.message, required this.onDismiss});
final String message;
final VoidCallback onDismiss;
@override
Widget build(BuildContext context) => MaterialBanner(
content: Text(message),
actions: [TextButton(onPressed: onDismiss, child: const Text('Dismiss'))],
);
}