StatusbarHost laid every item at intrinsic width, so once the focused-pane context line grew long (a model/mode/context/skills summary) the row's content exceeded the bar width and overflowed instead of letting the slot shrink. Add an opt-in flex factor to StatusItemContribution; the host wraps flex>0 items in Flexible(loose) so they yield width when the bar is tight, and the marquee then receives a bounded viewport and scrolls. Drops the fixed maxWidth cap on the pane-context item. T-160. Co-Authored-By: Claude <noreply@anthropic.com>
43 lines
1.6 KiB
Dart
43 lines
1.6 KiB
Dart
/// Status-bar item that shows the *focused* pane's status widget
|
|
/// (T-150). The content comes from whichever pane is focused — each pane
|
|
/// surfaces its own [ClidePane.statusWidget] via [FocusTracker], so this
|
|
/// item is generic: it just renders `focus.activeStatusWidget`, clamped
|
|
/// to a fixed height and marquee-scrolled when it overflows. Nothing
|
|
/// (and no space) when no focused pane has a status — so it clears on
|
|
/// focus change.
|
|
library;
|
|
|
|
import 'package:clide/kernel/kernel.dart';
|
|
import 'package:clide/widgets/widgets.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
/// Fixed slot height — panes can render anything, but not blow up the bar.
|
|
const double _slotHeight = 16;
|
|
|
|
class PaneContextStatusItem extends StatelessWidget {
|
|
const PaneContextStatusItem({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final focus = ClideKernel.of(context).focus;
|
|
return ListenableBuilder(
|
|
listenable: focus,
|
|
builder: (ctx, _) {
|
|
final widget = focus.activeStatusWidget;
|
|
if (widget == null) return const SizedBox.shrink();
|
|
// The parent StatusbarHost wraps this item in Flexible(loose) so the
|
|
// Row hands us a bounded maxWidth (T-160). ClideMarquee receives that
|
|
// constraint via LayoutBuilder and scrolls when content exceeds it —
|
|
// no ConstrainedBox(maxWidth) cap needed here.
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
child: SizedBox(
|
|
height: _slotHeight,
|
|
child: ClideMarquee(child: widget),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|