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>
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../theme/design_tokens.dart';
|
||||
|
||||
/// Day-bucketing shared by Recent (Today/Yesterday/This week/Earlier) and
|
||||
/// Activity (one group per calendar day) - see `DESIGN_SYSTEM.md` §4.
|
||||
|
||||
bool _isSameDay(DateTime a, DateTime b) =>
|
||||
a.year == b.year && a.month == b.month && a.day == b.day;
|
||||
|
||||
/// One labelled bucket of [items], already in their original (newest-first)
|
||||
/// order.
|
||||
class TabDayGroup<T> {
|
||||
final String label;
|
||||
final List<T> items;
|
||||
const TabDayGroup(this.label, this.items);
|
||||
}
|
||||
|
||||
/// Buckets newest-first [items] into Today / Yesterday / This week /
|
||||
/// Earlier. Empty buckets are omitted.
|
||||
List<TabDayGroup<T>> groupByRecentBucket<T>(
|
||||
List<T> items,
|
||||
DateTime Function(T item) dateOf,
|
||||
) {
|
||||
final now = DateTime.now();
|
||||
final today = DateTime(now.year, now.month, now.day);
|
||||
final yesterday = today.subtract(const Duration(days: 1));
|
||||
// "This week" reaches back 6 days before today (7 days inclusive) -
|
||||
// anything older falls to "Earlier".
|
||||
final weekStart = today.subtract(const Duration(days: 6));
|
||||
|
||||
final todayItems = <T>[];
|
||||
final yesterdayItems = <T>[];
|
||||
final weekItems = <T>[];
|
||||
final earlierItems = <T>[];
|
||||
|
||||
for (final item in items) {
|
||||
final d = dateOf(item);
|
||||
final day = DateTime(d.year, d.month, d.day);
|
||||
if (_isSameDay(day, today)) {
|
||||
todayItems.add(item);
|
||||
} else if (_isSameDay(day, yesterday)) {
|
||||
yesterdayItems.add(item);
|
||||
} else if (!day.isBefore(weekStart)) {
|
||||
weekItems.add(item);
|
||||
} else {
|
||||
earlierItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
if (todayItems.isNotEmpty) TabDayGroup('Today', todayItems),
|
||||
if (yesterdayItems.isNotEmpty) TabDayGroup('Yesterday', yesterdayItems),
|
||||
if (weekItems.isNotEmpty) TabDayGroup('This week', weekItems),
|
||||
if (earlierItems.isNotEmpty) TabDayGroup('Earlier', earlierItems),
|
||||
];
|
||||
}
|
||||
|
||||
/// Buckets newest-first [items] one group per calendar day (Activity's
|
||||
/// "feed grouped by day" - unlike [groupByRecentBucket], days past
|
||||
/// yesterday each keep their own header rather than folding into "This
|
||||
/// week"/"Earlier").
|
||||
List<TabDayGroup<T>> groupByCalendarDay<T>(
|
||||
List<T> items,
|
||||
DateTime Function(T item) dateOf,
|
||||
) {
|
||||
final now = DateTime.now();
|
||||
final today = DateTime(now.year, now.month, now.day);
|
||||
final yesterday = today.subtract(const Duration(days: 1));
|
||||
|
||||
final order = <DateTime>[];
|
||||
final groups = <DateTime, List<T>>{};
|
||||
for (final item in items) {
|
||||
final d = dateOf(item);
|
||||
final day = DateTime(d.year, d.month, d.day);
|
||||
final bucket = groups.putIfAbsent(day, () {
|
||||
order.add(day);
|
||||
return [];
|
||||
});
|
||||
bucket.add(item);
|
||||
}
|
||||
|
||||
String labelFor(DateTime day) {
|
||||
if (_isSameDay(day, today)) return 'Today';
|
||||
if (_isSameDay(day, yesterday)) return 'Yesterday';
|
||||
return DateFormat.yMMMd().format(day);
|
||||
}
|
||||
|
||||
return [for (final day in order) TabDayGroup(labelFor(day), groups[day]!)];
|
||||
}
|
||||
|
||||
/// The "Today"/"Yesterday"/... label above a day group - `DESIGN_SYSTEM.md`
|
||||
/// §2's grouped-list label style (13/600 fg-2, inset 8px). Standalone
|
||||
/// (rather than `NooGroupedList.label`) for Activity, whose items aren't a
|
||||
/// `NooGroupedList` card.
|
||||
class TabGroupLabel extends StatelessWidget {
|
||||
final String label;
|
||||
|
||||
const TabGroupLabel(this.label, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = context.nooColors;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
||||
child: Text(label, style: NooText.label.copyWith(color: colors.fg2)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/// Turns a full item path plus its own name into a display-friendly parent
|
||||
/// folder label - shared by Recent ("action + location") and Trash
|
||||
/// ("original location") per `DESIGN_SYSTEM.md` §4.
|
||||
String tabLocationLabel(String fullPath, String name) {
|
||||
final folder = fullPath.length >= name.length
|
||||
? fullPath.substring(0, fullPath.length - name.length)
|
||||
: fullPath;
|
||||
final trimmed = folder.replaceAll(RegExp(r'^/+|/+$'), '');
|
||||
return trimmed.isEmpty ? 'Home' : trimmed;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import '../../theme/design_tokens.dart';
|
||||
import '../noo/core/noo_button.dart';
|
||||
|
||||
/// Shared loading/error/empty slivers for Recent/Activity/Trash/Shares (and
|
||||
/// any future tab shaped like them: a `CustomScrollView` over one flat
|
||||
/// list), restyled with noo tokens instead of each screen hand-rolling the
|
||||
/// same centered column - see `FilesView`'s identical error/empty layout,
|
||||
/// which this mirrors.
|
||||
|
||||
/// Centered spinner for a tab's first load (list still empty).
|
||||
const Widget tabLoadingSliver = SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
|
||||
/// Centered error state: icon, title, message, and a Retry button.
|
||||
Widget tabErrorSliver(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
required String message,
|
||||
required VoidCallback onRetry,
|
||||
}) {
|
||||
final colors = context.nooColors;
|
||||
return SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(LucideIcons.circleAlert, size: 56, color: colors.danger),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: NooText.cardTitle.copyWith(color: colors.danger),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: NooText.body.copyWith(color: colors.fg3),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
NooButton(
|
||||
variant: NooButtonVariant.secondary,
|
||||
size: NooButtonSize.field,
|
||||
icon: LucideIcons.refreshCw,
|
||||
onTap: onRetry,
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Centered empty state: an icon over a message.
|
||||
Widget tabEmptySliver(
|
||||
BuildContext context, {
|
||||
required IconData icon,
|
||||
required String message,
|
||||
}) {
|
||||
final colors = context.nooColors;
|
||||
return SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(icon, size: 56, color: colors.fg3),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: NooText.cardTitle.copyWith(color: colors.fg2),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Bottom padding sliver so the last row/card clears the bottom nav/FAB -
|
||||
/// same trailing pair every rebuilt tab list ends on.
|
||||
const List<Widget> tabBottomInsetSlivers = [
|
||||
SliverToBoxAdapter(child: SizedBox(height: 100)),
|
||||
SliverFillRemaining(hasScrollBody: false, child: SizedBox()),
|
||||
];
|
||||
Reference in New Issue
Block a user