Files
noo/lib/widgets/manage_synced_folders_sheet.dart
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

88 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import '../providers/sync_status_controller.dart';
import '../theme/design_tokens.dart';
import 'noo/lists/noo_grouped_list.dart';
import 'noo/lists/noo_settings_row.dart';
import 'noo/overlays/noo_sheet.dart';
/// The configured sync targets (folders/files) with a "stop syncing"
/// action per target - what used to be Settings' Device Sync card's own
/// inline list, moved into a sheet here so the main Offline view can look
/// like a plain Files-style browser instead of always showing this
/// management UI up top.
class ManageSyncedFoldersSheet extends StatelessWidget {
final SyncStatusController sync;
const ManageSyncedFoldersSheet({super.key, required this.sync});
static void show(BuildContext context) {
final sync = context.read<SyncStatusController>();
showNooSheet(context, children: [ManageSyncedFoldersSheet(sync: sync)]);
}
void _remove(BuildContext context, String path) {
sync.removeSyncedPath(path);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Removed from device sync'),
behavior: SnackBarBehavior.floating,
),
);
}
@override
Widget build(BuildContext context) {
final colors = context.nooColors;
// AnimatedBuilder, not a one-shot read: removing a target should update
// this list in place without closing the sheet, and showNooSheet's
// `children` is built once by the caller - this widget owns its own
// rebuild instead.
return AnimatedBuilder(
animation: sync,
builder: (context, _) {
final everything = sync.syncEverything;
final targets = sync.syncedPaths;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Synced to this device',
style: NooText.cardTitle.copyWith(color: colors.fg1),
),
const SizedBox(height: NooSpace.sm),
if (everything)
Text(
'Every folder in this account is being synced to this device.',
style: NooText.body.copyWith(color: colors.fg3),
)
else if (targets.isEmpty)
Text(
'Nothing synced yet. Select a folder or file in Files and '
'use "Sync to device" to mirror it here for offline access.',
style: NooText.body.copyWith(color: colors.fg3),
)
else
NooGroupedList(
children: [
for (final target in targets)
NooSettingsRow(
icon: LucideIcons.folderSync,
label: Text(target),
trailing: IconButton(
icon: Icon(LucideIcons.x, size: 18, color: colors.fg3),
tooltip: 'Stop syncing',
onPressed: () => _remove(context, target),
),
),
],
),
],
);
},
);
}
}