Fix sheet peek for async content, and rework several screens' details
showNooSheet's peek detection previously measured content once, right
after the first frame - Details' Versions/Activity tabs fetch their
data asynchronously, so that one-shot measurement only ever saw the
initial loading-spinner height, never the eventual (often long) list,
and the sheet still snapped to full height once data arrived. Replaced
it with a ScrollMetricsNotification-based check that keeps content
capped at the peek height from frame one and upgrades to a draggable
sheet whenever it actually overflows that cap, however and whenever
that happens - fixed for good this time, with a regression test that
mirrors the async-load shape.
Also, in the same pass:
- Upload/Move/Copy's bottom bar meta line now always reads as a count
("Uploading 3 items"), never a filename for the single-item case,
and is centered rather than left-aligned - matches the approved
design and removes a bespoke marquee/chip implementation that only
Upload had.
- Upload/Move/Copy now show the same FilesControlsRow (sort, filter,
List/Grid) Files itself uses, including a folder-grid rendering
path for when List/Grid is set to grid.
- Files' filter chip reads "Filters" instead of "All types" when idle.
- Trash's overflow button - whose only action is "Delete forever" -
is now a direct delete icon (mobile) / "Delete" danger pill
(desktop) instead of a generic "..." menu that hid a single action
behind an extra tap.
- The media viewer's floating chrome (top bar, bottom action bar,
video transport row) now follows the app's light/dark theme instead
of a fixed dark panel - a dark panel read as out of place over a
light-theme stage. Panel tint and icon/text colors come from the
theme's own surface/fg1 tokens (at a higher blur opacity to stay
legible over arbitrary photo/video brightness), and the edge scrim
gradients fade toward the panel's own tint instead of a fixed black.
Mirrored the same change into the design canvas's Main.dc.html/
MainAndroid.dc.html mockups (now with a theme prop) so they match.
This commit is contained in:
@@ -10,11 +10,12 @@ import '../services/share_intent_service.dart';
|
||||
import '../services/upload_service.dart';
|
||||
import '../theme/design_tokens.dart';
|
||||
import '../widgets/breadcrumbs.dart';
|
||||
import '../widgets/marquee_title.dart';
|
||||
import '../widgets/files_controls_row.dart';
|
||||
import '../widgets/noo/core/noo_button.dart';
|
||||
import '../widgets/noo/files/noo_file_kind.dart';
|
||||
import '../widgets/noo/files/noo_file_row.dart';
|
||||
import '../widgets/noo/files/noo_file_table.dart';
|
||||
import '../widgets/noo/media/noo_grid_card.dart';
|
||||
import '../widgets/noo/nav/noo_top_bar.dart';
|
||||
import '../widgets/noo/nav/noo_toolbar.dart';
|
||||
import '../widgets/noo/noo_layout.dart';
|
||||
@@ -51,7 +52,9 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
// Shared files have no relationship to wherever the user was last
|
||||
// browsing, so start the destination picker fresh at the root.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) context.read<FilesController>().navigateToAbsoluteFolder('/');
|
||||
if (mounted) {
|
||||
context.read<FilesController>().navigateToAbsoluteFolder('/');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,7 +97,12 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
|
||||
// Only folders are valid upload destinations, so the listing - unlike
|
||||
// Files' own - never shows plain files at all.
|
||||
Widget _buildRow(BuildContext context, NextcloudItem item, int index, int count) {
|
||||
Widget _buildRow(
|
||||
BuildContext context,
|
||||
NextcloudItem item,
|
||||
int index,
|
||||
int count,
|
||||
) {
|
||||
final colors = context.nooColors;
|
||||
final files = context.read<FilesController>();
|
||||
final row = NooFileRow(
|
||||
@@ -130,6 +138,20 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGridCard(BuildContext context, NextcloudItem item) {
|
||||
final colors = context.nooColors;
|
||||
final files = context.read<FilesController>();
|
||||
return NooGridCard(
|
||||
name: item.name,
|
||||
meta: 'Folder',
|
||||
placeholderColor: colors.accentSoft,
|
||||
icon: LucideIcons.folder,
|
||||
iconColor: colors.accentText,
|
||||
thumbnailHeight: NooLayout.isDesktop(context) ? 118 : 104,
|
||||
onTap: () => files.navigateToFolder(item.path),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = context.nooColors;
|
||||
@@ -147,16 +169,34 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
final slivers = <Widget>[
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(gutter, NooSpace.md, gutter, NooSpace.sm),
|
||||
child: hasBreadcrumbs
|
||||
? SizedBox(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
gutter,
|
||||
NooSpace.md,
|
||||
gutter,
|
||||
NooSpace.sm,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 44,
|
||||
child: FilesControlsRow(
|
||||
folderPath: currentPath,
|
||||
showStorageScope: false,
|
||||
),
|
||||
),
|
||||
if (hasBreadcrumbs) ...[
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
height: 32,
|
||||
child: Breadcrumbs(
|
||||
pathStack: files.pathStack,
|
||||
onTap: (index) => files.navigateToPathIndex(index),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (files.isLoading)
|
||||
@@ -167,6 +207,22 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
icon: LucideIcons.folder,
|
||||
message: 'No folders here',
|
||||
)
|
||||
else if (files.isGridView)
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: gutter),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: desktop ? 5 : 2,
|
||||
childAspectRatio: desktop ? 1.05 : 0.92,
|
||||
crossAxisSpacing: desktop ? 16 : 10,
|
||||
mainAxisSpacing: desktop ? 16 : 10,
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) => _buildGridCard(context, folders[index]),
|
||||
childCount: folders.length,
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (desktop)
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: gutter),
|
||||
@@ -223,12 +279,20 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
color: colors.accent,
|
||||
backgroundColor: colors.surface,
|
||||
onRefresh: files.refreshData,
|
||||
child: CustomScrollView(controller: _scrollController, slivers: slivers),
|
||||
child: CustomScrollView(
|
||||
controller: _scrollController,
|
||||
slivers: slivers,
|
||||
),
|
||||
),
|
||||
),
|
||||
// A flat surface bar with a top line, peeking up from the bottom edge -
|
||||
// the uploading-file summary (marqueed if it doesn't fit on one line)
|
||||
// sits directly above the destination button.
|
||||
// a centered item-count meta line sits directly above the destination
|
||||
// button (DESIGN_SYSTEM.md's "Upload / Move / Copy destination
|
||||
// picker" recipe: "a meta line ... above a full-width ... primary
|
||||
// CTA" - matches MoveCopyDestinationPicker's identical bar). A count,
|
||||
// not a filename: this is the one-file case just as much as the
|
||||
// many-files case, and a long filename has no good fixed-width
|
||||
// treatment the way a short count always does.
|
||||
bottomNavigationBar: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface,
|
||||
@@ -245,48 +309,12 @@ class _ShareUploadViewState extends State<ShareUploadView> {
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
// Sized to the text itself (like a real chip) up to the
|
||||
// row's available width - MarqueeTitle needs a concrete
|
||||
// (not just loose) width to know whether/how far to scroll,
|
||||
// so this measures the text once up front rather than
|
||||
// leaving the chip unconstrained.
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final uploadingText = widget.files.length == 1
|
||||
? 'Uploading ${widget.files.first.name}'
|
||||
: 'Uploading ${widget.files.length} files';
|
||||
final chipTextStyle = NooText.label.copyWith(
|
||||
color: colors.fg2,
|
||||
);
|
||||
const horizontalPadding = 28.0;
|
||||
final painter = TextPainter(
|
||||
text: TextSpan(text: uploadingText, style: chipTextStyle),
|
||||
maxLines: 1,
|
||||
textDirection: Directionality.of(context),
|
||||
)..layout(maxWidth: double.infinity);
|
||||
final chipWidth = (painter.width + horizontalPadding).clamp(
|
||||
0.0,
|
||||
constraints.maxWidth,
|
||||
);
|
||||
|
||||
return Container(
|
||||
width: chipWidth,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: NooSpace.smd,
|
||||
vertical: NooSpace.xs,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface2,
|
||||
borderRadius: BorderRadius.circular(NooRadii.pill),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 20,
|
||||
child: MarqueeTitle(text: uploadingText, style: chipTextStyle),
|
||||
),
|
||||
);
|
||||
},
|
||||
Text(
|
||||
'Uploading ${widget.files.length} item${widget.files.length == 1 ? '' : 's'}',
|
||||
textAlign: TextAlign.center,
|
||||
style: NooText.meta.copyWith(color: colors.fg3),
|
||||
),
|
||||
const SizedBox(height: NooSpace.sm),
|
||||
NooButton(
|
||||
|
||||
Reference in New Issue
Block a user