todo-app/lib/ui/images/attachment_strip.dart
Krzysztof kuhy Rudnicki 3a747c2e51
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Report errors and slow waits to the board
crdt_sync_flutter 0.9.0's installAppErrors in main(): uncaught errors and
every spinner shown over 1 s (WaitWatch: sync.run, mirror.test) upload to
RTDB /todo/errors/<device> with the versionCode, where the PC app-errors
ingest files board tickets (kuhyx/utils DOCS-app-errors.md).

The app moves to material_ui first: sync_settings_ui 0.8.x and
design_system 0.4.x sit on it, and Flutter 3.50 deprecates
flutter/material. Pins: crdt_sync 0.14.1, csf 0.9.0, ssui 0.8.3,
gda 0.5.1, design_system 0.4.1, image 4.13.1, mcp_dart 2.4.4.
file_picker stays 13.3.3, held by data_transfer_flutter 0.2.2
(allowlisted, self-clearing).

appRoute takes a route name so each report names its screen; the
release build passes APP_BUILD/APP_VERSION. Nothing new on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 23:07:58 +01:00

53 lines
2.0 KiB
Dart

import 'package:design_system/design_system.dart';
import 'package:material_ui/material_ui.dart';
import 'package:todo/images/attachment_links.dart';
import 'package:todo/ui/images/file_embed.dart';
import 'package:todo/ui/images/image_embed.dart';
/// Height of the thumbnail row under the editor.
const kAttachmentStripHeight = 88.0;
/// A row of tiles for every attachment [text] links to — thumbnails for
/// images, icon-and-name tiles for files — shown under the editing field so a
/// note's attachments are visible (and files openable) while writing it. The
/// editing modes show the links as text; without this the default (Raw)
/// mode would never show one at all. Empty when there are none.
class AttachmentStrip extends StatelessWidget {
/// Creates the strip for [text].
const AttachmentStrip({required this.text, super.key});
/// The note text being edited.
final String text;
@override
Widget build(BuildContext context) {
final attachments = attachmentsIn(text);
if (attachments.isEmpty) return const SizedBox.shrink();
// Same centred column as the editor above it (rule 21), so on the wide
// desktop window the thumbnails sit under the text, not at the far edge.
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: kProseMaxWidth,
maxHeight: kAttachmentStripHeight,
),
child: ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: attachments.length,
separatorBuilder: (_, _) => const SizedBox(width: 8),
itemBuilder: (context, i) => SizedBox(
width: kAttachmentStripHeight,
child: attachments[i].isImage
? ImageEmbed(ref: attachments[i].ref)
: FileEmbed(attachment: attachments[i], compact: true),
),
),
),
),
);
}
}