Polish adaptive app chrome

This commit is contained in:
2026-10-31 06:02:02 +00:00
parent 06f6eda360
commit 480f8843eb
14 changed files with 228 additions and 53 deletions
@@ -1,9 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/graph/viewport/graph_expanded_view.dart';
import 'package:pipelines_app/features/graph/viewport/graph_viewport.dart';
import 'package:pipelines_app/features/graph/viewport/graph_viewport_math.dart';
import 'package:pipelines_app/features/graph/widgets/definition_graph_view.dart';
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
@@ -103,7 +105,7 @@ void main() {
isTrue,
);
await tester.tap(find.byKey(const Key('graph-expanded-close')));
await tester.tap(find.byType(BackButton));
await tester.pumpAndSettle();
expect(find.byType(GraphExpandedView), findsNothing);
@@ -195,14 +197,18 @@ void main() {
await tester.tap(find.byKey(const Key('graph-expand')));
await tester.pumpAndSettle();
expect(find.byType(GraphExpandedView), findsOneWidget);
expect(_inExpanded(find.text(graphExpandedClose)), findsOneWidget);
expect(
_inExpanded(find.byType(CupertinoNavigationBarBackButton)),
findsOneWidget,
);
expect(_inExpanded(find.byKey(const Key('graph-fit'))), findsOneWidget);
expect(
tester.widget<GraphStageNode>(_inExpanded(_node('build'))).selected,
isTrue,
);
expect(tester.takeException(), isNull);
await tester.tap(find.byKey(const Key('graph-expanded-close')));
await tester.tap(find.byType(CupertinoNavigationBarBackButton));
await tester.pumpAndSettle();
expect(find.byType(GraphExpandedView), findsNothing);
expect(tester.widget<GraphStageNode>(_node('build')).selected, isTrue);
@@ -210,4 +216,43 @@ void main() {
expect(picked, isEmpty);
expect(tester.takeException(), isNull);
});
testWidgets('expanded Fit is an activatable labelled button on both hosts', (
tester,
) async {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
await tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(
child: DefinitionGraphView(
graph: linearGraph(),
selectedStage: 'build',
onSelected: (_) {},
),
),
)
: _materialHost(
graph: linearGraph(),
selected: 'build',
onSelected: (_) {},
),
);
await _settle(tester);
await tester.tap(find.byKey(const Key('graph-expand')));
await tester.pumpAndSettle();
final fit = tester
.getSemantics(_inExpanded(find.byKey(const Key('graph-fit'))))
.getSemanticsData();
expect(fit.label, graphFitLabel, reason: '$host Fit must be labelled');
expect(fit.flagsCollection.isButton, isTrue);
expect(
fit.hasAction(SemanticsAction.tap),
isTrue,
reason: '$host Fit must expose its tap action on the labelled node',
);
}
});
}
@@ -82,6 +82,16 @@ void main() {
expect(_text('error'), findsOneWidget);
});
testWidgets('the rendered/raw control remains compact', (tester) async {
tester.view.physicalSize = const Size(800, 700);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(_material(_view()));
final control = find.byKey(const Key('markdown-source-mode'));
expect(tester.getRect(control).width, lessThan(221));
});
testWidgets('the raw section keeps unknown fields exact and selectable', (
tester,
) async {