Files
noo/lib/widgets/noo/files/noo_file_tile.dart
T
ayushyaandClaude Opus 5.5 56784ef212 Rebuild UI on the Noo design system
Replaces the Material 3 screens with the Noo design system: warm
neutrals, one violet accent, pill controls, Schibsted Grotesk/
Instrument Sans, Lucide icons, no gradients/shadows.

- New lib/widgets/noo/ component kit (core, lists, files, media, nav,
  overlays) plus lib/theme/design_tokens.dart for the color/type/space/
  radius/motion tokens.
- Rebuilt the app shell (top/bottom bars, drawer, desktop sidebar and
  toolbar), every tab (Files/Offline, Photos, Favorites, Recent,
  Activity, Trash, Shares), Settings, the lock and login screens, the
  media viewer, search, the details/share sheets, and the share-upload
  and move/copy destination pickers.
- Added a design canvas (linked from DESIGN_SYSTEM.md) covering the
  screens the spec didn't already describe, with matching Android and
  iOS chrome; wrote up the approved recipes into DESIGN_SYSTEM.md §4.
- Removed now-dead legacy widgets (media_grid_tile, swipeable_item,
  sync_status_badge, selectable_thumbnail) and updated
  architecture.md/styling.md/standards.md to describe the new
  structure and component/testing conventions.
- Added widget tests for the noo/ component kit.

This is a UI-only rework: no provider/model/service behavior changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-26 01:51:58 -04:00

75 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import '../../../theme/design_tokens.dart';
import 'noo_file_kind.dart';
/// The four tile sizes from `DESIGN_SYSTEM.md` 1.2 - pick by context; the
/// icon is always half the tile.
enum NooFileTileSize {
/// 40px / r12 - mobile file rows.
row(40, 12),
/// 30px / r9 - desktop table rows.
desktop(30, 9),
/// 44px / r12 - share sheet/dialog header.
header(44, 12),
/// 32px / r10 - activity items.
activity(32, 10);
final double extent;
final double radius;
const NooFileTileSize(this.extent, this.radius);
double get iconSize => extent / 2;
}
/// Rounded-square file-type tile: the kind's soft tint with its Lucide icon
/// in the strong tint (`DESIGN_SYSTEM.md` 1.2). Pass [thumbnail] (e.g. an
/// `Image`) to show real content instead - it's clipped to the same shape
/// and cover-fit over the kind's tint, which shows while it loads.
class NooFileTile extends StatelessWidget {
final NooFileKind kind;
final NooFileTileSize size;
final Widget? thumbnail;
const NooFileTile({
super.key,
required this.kind,
this.size = NooFileTileSize.row,
this.thumbnail,
});
@override
Widget build(BuildContext context) {
final colors = context.nooColors;
final radius = BorderRadius.circular(size.radius);
return SizedBox.square(
dimension: size.extent,
child: thumbnail != null
? ClipRRect(
borderRadius: radius,
child: ColoredBox(
color: kind.background(colors),
child: SizedBox.expand(
child: FittedBox(fit: BoxFit.cover, child: thumbnail),
),
),
)
: DecoratedBox(
decoration: BoxDecoration(
color: kind.background(colors),
borderRadius: radius,
),
child: Center(
child: Icon(
kind.icon,
size: size.iconSize,
color: kind.foreground(colors),
),
),
),
);
}
}