remove dead Scrollable plumbing from TerminalView
TerminalView's build tree doesn't wrap content in a Scrollable — scroll is handled by translating PointerScrollEvent into PgUp/PgDown keyInput. The ScrollController parameter, _scrollableKey, internal _scrollController, _scrollToBottom helper, and its five call sites were all dead: _scrollableKey.currentState was always null because no Scrollable in the tree carried the key, so _scrollToBottom's jumpTo never fired. Drops: - public scrollController parameter on TerminalView - _scrollableKey + _scrollController fields - the didUpdateWidget swap block and dispose call - _scrollToBottom + the five call sites - KeyboardVisibilty wrapper (its only callback was _scrollToBottom, now a no-op; the widget remains a reusable primitive under ui/ for future use) - the matching tests in terminal_view_test.dart Same shape as T-93 (dead onTapUp wiring) and T-95 (dead tertiary tap surface) — public API that no caller used + internal state that no path executed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,22 +43,19 @@ void main() {
|
||||
expect(state.renderTerminal, isA<RenderTerminal>());
|
||||
});
|
||||
|
||||
testWidgets('uses the supplied controller / focusNode / scrollController without disposing them', (tester) async {
|
||||
testWidgets('uses the supplied controller / focusNode without disposing them', (tester) async {
|
||||
final t = _OutputRecorder().build();
|
||||
final controller = TerminalController();
|
||||
final focus = FocusNode();
|
||||
final scroll = ScrollController();
|
||||
addTearDown(() {
|
||||
controller.dispose();
|
||||
focus.dispose();
|
||||
scroll.dispose();
|
||||
});
|
||||
|
||||
await tester.pumpWidget(_host(TerminalView(
|
||||
t,
|
||||
controller: controller,
|
||||
focusNode: focus,
|
||||
scrollController: scroll,
|
||||
)));
|
||||
// Tear down via removing the widget; supplied controllers should NOT
|
||||
// throw on later use (the state didn't dispose them).
|
||||
@@ -158,15 +155,6 @@ void main() {
|
||||
await tester.pumpWidget(_host(TerminalView(t, controller: external)));
|
||||
expect(find.byType(TerminalView), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('swapping scrollController disposes the old auto-created one', (tester) async {
|
||||
final t = _OutputRecorder().build();
|
||||
await tester.pumpWidget(_host(TerminalView(t)));
|
||||
final external = ScrollController();
|
||||
addTearDown(external.dispose);
|
||||
await tester.pumpWidget(_host(TerminalView(t, scrollController: external)));
|
||||
expect(find.byType(TerminalView), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('TerminalView — keyboard handle path', () {
|
||||
@@ -473,21 +461,4 @@ void main() {
|
||||
expect(r.outputs, isNotEmpty);
|
||||
});
|
||||
});
|
||||
|
||||
group('TerminalView — keyboard visibility', () {
|
||||
testWidgets('platform keyboard show fires _onKeyboardShow on the focused view', (tester) async {
|
||||
final t = _OutputRecorder().build();
|
||||
await tester.pumpWidget(_host(TerminalView(t, autofocus: true)));
|
||||
await tester.pump();
|
||||
// Simulate a virtual-keyboard appearance by raising the bottom view
|
||||
// insets and triggering a metrics-changed cycle.
|
||||
tester.view.viewInsets = const FakeViewPadding(bottom: 200, left: 0, right: 0, top: 0);
|
||||
addTearDown(tester.view.resetViewInsets);
|
||||
tester.binding.handleMetricsChanged();
|
||||
await tester.pump();
|
||||
// _onKeyboardShow only acts when the focus node has focus — verify by
|
||||
// tearing down without throwing.
|
||||
await tester.pumpWidget(_host(const SizedBox()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user