9551eceaed
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
94 lines
3.0 KiB
Dart
94 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../ui/adaptive/segmented_bar.dart';
|
|
import '../core/api_gateway.dart';
|
|
import '../features/search/search_screen.dart';
|
|
import 'app_session.dart';
|
|
import 'connection_status.dart';
|
|
import 'server_endpoint.dart';
|
|
|
|
/// The Search page above the shell: the landed screen over the shared gateway.
|
|
///
|
|
/// Before the first successful connection there is nothing to search, so the
|
|
/// native connection gate is shown inside the same title bar and Close still
|
|
/// returns to the previous destination. The screen mounts immediately so the
|
|
/// search field retains normal focus and keyboard behavior during navigation.
|
|
class SearchDestination extends StatefulWidget {
|
|
const SearchDestination({
|
|
super.key,
|
|
required this.session,
|
|
required this.server,
|
|
required this.onOpen,
|
|
this.embedded = false,
|
|
});
|
|
|
|
final AppSession session;
|
|
final ServerEndpoint server;
|
|
final ValueChanged<JsonMap> onOpen;
|
|
|
|
/// True as the shell's Search tab: no page chrome of its own.
|
|
final bool embedded;
|
|
|
|
@override
|
|
State<SearchDestination> createState() => _SearchDestinationState();
|
|
}
|
|
|
|
class _SearchDestinationState extends State<SearchDestination> {
|
|
@override
|
|
Widget build(BuildContext context) => AnimatedBuilder(
|
|
animation: widget.session,
|
|
builder: (context, _) {
|
|
if (!widget.session.everConnected) {
|
|
if (widget.embedded) {
|
|
return ConnectionGate(session: widget.session, server: widget.server);
|
|
}
|
|
return _SearchPage(
|
|
child: ConnectionGate(session: widget.session, server: widget.server),
|
|
);
|
|
}
|
|
return SearchScreen(
|
|
gateway: widget.session.gateway,
|
|
onOpen: widget.onOpen,
|
|
embedded: widget.embedded,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
/// The native title bar that owns Back while Search has no screen yet.
|
|
class _SearchPage extends StatelessWidget {
|
|
const _SearchPage({required this.child});
|
|
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Scaffold(
|
|
extendBodyBehindAppBar: true,
|
|
appBar: const SegmentedBar(title: 'Search'),
|
|
body: SafeArea(child: child),
|
|
);
|
|
}
|
|
|
|
/// The run a result names, taken only from the server's own payload document.
|
|
///
|
|
/// The browser opens run, step, field and artifact hits at their recorded
|
|
/// sequence/field; this app has only the run route, so the run id is the one
|
|
/// target it can honour. Pipeline/version hits return null: there is no
|
|
/// pipeline-detail route yet and a guessed one would be invented navigation.
|
|
int? searchHitRunId(JsonMap hit) {
|
|
final run = _positiveId(hit['run'], 'id');
|
|
if (run != null) return run;
|
|
for (final key in const ['step', 'field', 'artifact']) {
|
|
final id = _positiveId(hit[key], 'run_id');
|
|
if (id != null) return id;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
int? _positiveId(Object? payload, String key) {
|
|
if (payload is! Map) return null;
|
|
final value = payload[key];
|
|
final id = value is int ? value : int.tryParse('$value');
|
|
return id != null && id > 0 ? id : null;
|
|
}
|