fix(app): a stage's tabs always end at the bottom of the screen, also on wide screens
This commit is contained in:
@@ -71,61 +71,64 @@ class _RunVisitPaneState extends State<RunVisitPane> {
|
||||
final facts = detailVisitFacts(widget.step);
|
||||
final verdict = detailVisitVerdict(widget.step);
|
||||
final diagnostic = detailVisitDiagnostic(widget.step);
|
||||
return Column(
|
||||
key: const Key('run-visit-pane'),
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
fit: FlexFit.loose,
|
||||
child: SingleChildScrollView(
|
||||
key: const Key('run-visit-facts'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_bar(style),
|
||||
_FactGrid(facts: facts, style: style),
|
||||
if (verdict != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Verdict', style: style.heading),
|
||||
if (verdict.option != null) Text(verdict.option!),
|
||||
if (verdict.reason != null)
|
||||
Text(verdict.reason!, style: style.value),
|
||||
// The facts take what they need, up to 40% of the height (then scroll);
|
||||
// the section fills everything else, so the tabs always end at the
|
||||
// bottom of the screen however short the facts or the section are.
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => Column(
|
||||
key: const Key('run-visit-pane'),
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: constraints.maxHeight * 0.4),
|
||||
child: SingleChildScrollView(
|
||||
key: const Key('run-visit-facts'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_bar(style),
|
||||
_FactGrid(facts: facts, style: style),
|
||||
if (verdict != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Verdict', style: style.heading),
|
||||
if (verdict.option != null) Text(verdict.option!),
|
||||
if (verdict.reason != null)
|
||||
Text(verdict.reason!, style: style.value),
|
||||
],
|
||||
if (diagnostic != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Diagnostic', style: style.heading),
|
||||
Text(diagnostic, style: style.value),
|
||||
],
|
||||
],
|
||||
if (diagnostic != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Diagnostic', style: style.heading),
|
||||
Text(diagnostic, style: style.value),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: runVisitSectionBody(
|
||||
section: _section,
|
||||
run: widget.run,
|
||||
step: widget.step,
|
||||
visitIndex: widget.visitIndex,
|
||||
stageKey: widget.visit.stage,
|
||||
runSteps: widget.runSteps,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.onRunChanged,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
cupertino: widget.cupertino,
|
||||
Expanded(
|
||||
child: runVisitSectionBody(
|
||||
section: _section,
|
||||
run: widget.run,
|
||||
step: widget.step,
|
||||
visitIndex: widget.visitIndex,
|
||||
stageKey: widget.visit.stage,
|
||||
runSteps: widget.runSteps,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.onRunChanged,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
cupertino: widget.cupertino,
|
||||
),
|
||||
),
|
||||
),
|
||||
// The sections are tabs at the bottom, under what they show.
|
||||
SafeArea(
|
||||
top: false,
|
||||
child: RunVisitSectionStrip(
|
||||
selected: _section,
|
||||
onSelected: (section) => setState(() => _section = section),
|
||||
// The sections are tabs at the bottom, under what they show.
|
||||
SafeArea(
|
||||
top: false,
|
||||
child: RunVisitSectionStrip(
|
||||
selected: _section,
|
||||
onSelected: (section) => setState(() => _section = section),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,4 +196,24 @@ void main() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (final platform in RunDetailTestPlatform.values) {
|
||||
for (final size in const [
|
||||
Size(390, 844),
|
||||
Size(884, 832),
|
||||
Size(1000, 700),
|
||||
]) {
|
||||
testWidgets(
|
||||
'${platform.name} stage tabs end at the bottom at ${size.width}x${size.height}',
|
||||
(tester) async {
|
||||
await openVisit(tester, platform, size: size);
|
||||
for (final section in shownVisitSections) {
|
||||
await openVisitTab(tester, section);
|
||||
final strip = tester.getRect(find.byType(RunVisitSectionStrip));
|
||||
expect(strip.bottom, size.height, reason: section.name);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user