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'))], ); }