Consolidate startup and shell on Material
Remove alternate application hosts, page scaffolds, connection controls and icon metadata while preserving Material routing. Isolate navigation fixtures from native update plugins and retain separate startup-update regressions.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import '../ui/adaptive/platform.dart';
|
||||
import '../ui/adaptive/window_margins.dart';
|
||||
import '../ui/theme/app_font_controller.dart';
|
||||
import '../ui/theme/app_theme.dart';
|
||||
import '../ui/scale/ui_scale.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../shell/adaptive_shell.dart';
|
||||
@@ -35,6 +33,9 @@ class MyApp extends StatelessWidget {
|
||||
onDestinationSelected = null;
|
||||
|
||||
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
||||
|
||||
/// Retained for source compatibility with older callers; Material is the
|
||||
/// only application host.
|
||||
final bool? cupertino;
|
||||
final AppDestination? destination;
|
||||
final ValueChanged<AppDestination>? onDestinationSelected;
|
||||
@@ -55,28 +56,6 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
Widget _host(String? fontFamily) {
|
||||
final router = routerConfig;
|
||||
if (cupertino ?? _platformIsCupertino) {
|
||||
final theme = appCupertinoThemeWith(fontFamily: fontFamily);
|
||||
if (router != null) {
|
||||
return CupertinoApp.router(
|
||||
title: 'Pipelines',
|
||||
builder: _scaled,
|
||||
theme: theme,
|
||||
routerConfig: router,
|
||||
);
|
||||
}
|
||||
return CupertinoApp(
|
||||
title: 'Pipelines',
|
||||
builder: _scaled,
|
||||
theme: theme,
|
||||
home: AdaptiveShell(
|
||||
destinationBodies: destinationBodies,
|
||||
cupertino: true,
|
||||
destination: destination,
|
||||
onDestinationSelected: onDestinationSelected,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (router != null) {
|
||||
return MaterialApp.router(
|
||||
title: 'Pipelines',
|
||||
@@ -101,8 +80,6 @@ class MyApp extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
bool get _platformIsCupertino => prefersCupertino();
|
||||
|
||||
static Widget _scaled(BuildContext context, Widget? child) => UiScaleHost(
|
||||
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'app_route.dart';
|
||||
@@ -47,7 +46,7 @@ String routeLocation(Uri uri) {
|
||||
class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
AppRouterDelegate({
|
||||
required this.builder,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
this.searchBuilder,
|
||||
this.templatesBuilder,
|
||||
this.schedulesBuilder,
|
||||
@@ -75,7 +74,9 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
/// state and selection, and the standard navigation bar supplies Back.
|
||||
final Widget Function(BuildContext context)? searchBuilder;
|
||||
|
||||
final bool cupertino;
|
||||
/// Retained for compatibility with older composition callers. Routes use
|
||||
/// Material pages on every platform.
|
||||
final bool? cupertino;
|
||||
|
||||
final _navigatorKey = GlobalKey<NavigatorState>();
|
||||
static const _pageKey = ValueKey<String>('pipelines-shell');
|
||||
@@ -119,9 +120,7 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
AppRoute get currentConfiguration => _route;
|
||||
|
||||
Page<void> _page(LocalKey key, Widget child, {bool dialog = false}) =>
|
||||
cupertino
|
||||
? CupertinoPage<void>(key: key, child: child, fullscreenDialog: dialog)
|
||||
: MaterialPage<void>(key: key, child: child, fullscreenDialog: dialog);
|
||||
MaterialPage<void>(key: key, child: child, fullscreenDialog: dialog);
|
||||
|
||||
/// A page-based Navigator supplies the Overlay, overlay portals and route
|
||||
/// context that native controls (action sheets, tooltips) require. The shell
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import '../features/chat/chat_runtime.dart';
|
||||
import '../features/chat/screen.dart';
|
||||
import '../features/chat/windows/chat_windows.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
import '../ui/adaptive/top_bar_notices.dart';
|
||||
import 'app_session.dart';
|
||||
import 'connection_status.dart';
|
||||
@@ -48,7 +47,6 @@ class ChatDestination extends StatelessWidget {
|
||||
Widget build(BuildContext context) => AnimatedBuilder(
|
||||
animation: Listenable.merge([session, ?pool]),
|
||||
builder: (context, _) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
// Saved machines connect independently; their state and sign-in live
|
||||
// in Settings, so the chat itself carries no connection chrome.
|
||||
if (pool != null && pool!.servers.catalog.servers.isNotEmpty) {
|
||||
@@ -56,28 +54,17 @@ class ChatDestination extends StatelessWidget {
|
||||
}
|
||||
if ((server.requiresConfiguration || server.error != null) &&
|
||||
session.endpoint == null) {
|
||||
return ConnectionGate(
|
||||
session: session,
|
||||
server: server,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
return ConnectionGate(session: session, server: server);
|
||||
}
|
||||
if (!session.everConnected) {
|
||||
if (session.connected) return _chatScreen();
|
||||
return ConnectionGate(
|
||||
session: session,
|
||||
server: server,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
return ConnectionGate(session: session, server: server);
|
||||
}
|
||||
// The banner stays below the top bar; without it the chat screen
|
||||
// reaches the top edge (an open chat beside the list draws its own bar
|
||||
// there).
|
||||
return TopBarNotices(
|
||||
notices: [
|
||||
if (!session.connected)
|
||||
ConnectionBanner(session: session, cupertino: cupertino),
|
||||
],
|
||||
notices: [if (!session.connected) ConnectionBanner(session: session)],
|
||||
child: _chatScreen(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../core/transport/connection_state.dart';
|
||||
@@ -15,12 +14,12 @@ class ConnectionGate extends StatelessWidget {
|
||||
super.key,
|
||||
required this.session,
|
||||
required this.server,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
});
|
||||
|
||||
final AppSession session;
|
||||
final ServerEndpoint server;
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -75,18 +74,14 @@ class ConnectionGate extends StatelessWidget {
|
||||
if (progress)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: cupertino
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
child: const CircularProgressIndicator(),
|
||||
),
|
||||
Semantics(
|
||||
liveRegion: true,
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: cupertino
|
||||
? CupertinoTheme.of(context).textTheme.navTitleTextStyle
|
||||
: theme.textTheme.titleMedium,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
if (detail.isNotEmpty) ...[
|
||||
@@ -94,15 +89,12 @@ class ConnectionGate extends StatelessWidget {
|
||||
Text(
|
||||
detail,
|
||||
textAlign: TextAlign.center,
|
||||
style: cupertino ? null : theme.textTheme.bodyMedium,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
],
|
||||
if (onRetry != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
if (cupertino)
|
||||
CupertinoButton(onPressed: onRetry, child: const Text('Retry'))
|
||||
else
|
||||
FilledButton(onPressed: onRetry, child: const Text('Retry')),
|
||||
FilledButton(onPressed: onRetry, child: const Text('Retry')),
|
||||
],
|
||||
],
|
||||
),
|
||||
@@ -113,14 +105,10 @@ class ConnectionGate extends StatelessWidget {
|
||||
|
||||
/// A compact status bar above retained content after the first connection.
|
||||
class ConnectionBanner extends StatelessWidget {
|
||||
const ConnectionBanner({
|
||||
super.key,
|
||||
required this.session,
|
||||
required this.cupertino,
|
||||
});
|
||||
const ConnectionBanner({super.key, required this.session, this.cupertino});
|
||||
|
||||
final AppSession session;
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -145,25 +133,19 @@ class ConnectionBanner extends StatelessWidget {
|
||||
detail = 'Check that the Pipelines server is running.';
|
||||
onRetry = session.retry;
|
||||
}
|
||||
final textStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium;
|
||||
final textStyle = Theme.of(context).textTheme.bodyMedium;
|
||||
return ColoredBox(
|
||||
color: cupertino
|
||||
? CupertinoDynamicColor.resolve(CupertinoColors.systemGrey5, context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
if (reconnecting) ...[
|
||||
cupertino
|
||||
? const CupertinoActivityIndicator(radius: 7)
|
||||
: const SizedBox(
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
Expanded(
|
||||
@@ -179,14 +161,7 @@ class ConnectionBanner extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
if (cupertino)
|
||||
CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onRetry,
|
||||
child: const Text('Retry'),
|
||||
)
|
||||
else
|
||||
TextButton(onPressed: onRetry, child: const Text('Retry')),
|
||||
TextButton(onPressed: onRetry, child: const Text('Retry')),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,7 +2,6 @@ import '../core/servers/chat/chat_server_pool.dart';
|
||||
import '../core/servers/server_context.dart';
|
||||
import '../core/servers/elevation/elevation_dialog.dart';
|
||||
import '../core/servers/elevation/machine_elevation.dart';
|
||||
import '../ui/adaptive/platform.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -338,7 +337,8 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
type: RouteInformationReportingType.neglect,
|
||||
);
|
||||
}
|
||||
_cupertino = widget.cupertino ?? _platformIsCupertino;
|
||||
// Kept as a compatibility field on the widget; composition is Material-only.
|
||||
_cupertino = false;
|
||||
_notifications.onOpenRun = (id) {
|
||||
if (mounted) _delegate.goTo(AppRoute.run(id));
|
||||
};
|
||||
@@ -954,6 +954,4 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
AppDestination.search => AppRoute.search,
|
||||
AppDestination.settings => AppRoute.settings,
|
||||
};
|
||||
|
||||
bool get _platformIsCupertino => prefersCupertino();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import '../core/servers/server_scope.dart';
|
||||
|
||||
import '../features/pipelines/screen.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
import '../ui/adaptive/top_bar_notices.dart';
|
||||
import 'app_session.dart';
|
||||
import 'connection_status.dart';
|
||||
@@ -64,30 +63,18 @@ class PipelinesDestination extends StatelessWidget {
|
||||
Widget build(BuildContext context) => AnimatedBuilder(
|
||||
animation: session,
|
||||
builder: (context, _) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
if ((server.requiresConfiguration || server.error != null) &&
|
||||
session.endpoint == null) {
|
||||
return ConnectionGate(
|
||||
session: session,
|
||||
server: server,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
return ConnectionGate(session: session, server: server);
|
||||
}
|
||||
if (!session.everConnected) {
|
||||
if (session.connected) return _pipelinesScreen();
|
||||
return ConnectionGate(
|
||||
session: session,
|
||||
server: server,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
return ConnectionGate(session: session, server: server);
|
||||
}
|
||||
// The banner stays below the top bar; without it the pipelines reach
|
||||
// the top edge and scroll behind the bar.
|
||||
return TopBarNotices(
|
||||
notices: [
|
||||
if (!session.connected)
|
||||
ConnectionBanner(session: session, cupertino: cupertino),
|
||||
],
|
||||
notices: [if (!session.connected) ConnectionBanner(session: session)],
|
||||
child: _pipelinesScreen(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'dart:async';
|
||||
import '../core/servers/chat/chat_server_pool.dart';
|
||||
import '../ui/adaptive/platform.dart';
|
||||
import '../ui/adaptive/window_margins.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -307,8 +305,6 @@ class _PipelinesRootState extends State<PipelinesRoot> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
bool get _cupertino => prefersCupertino();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_booting) {
|
||||
@@ -318,15 +314,10 @@ class _PipelinesRootState extends State<PipelinesRoot> {
|
||||
view: View.of(context),
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: _cupertino
|
||||
? const CupertinoTheme(
|
||||
data: appCupertinoTheme,
|
||||
child: Center(child: CupertinoActivityIndicator()),
|
||||
)
|
||||
: Theme(
|
||||
data: appLightTheme(),
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
child: Theme(
|
||||
data: appLightTheme(),
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -368,26 +359,16 @@ class _PipelinesRootState extends State<PipelinesRoot> {
|
||||
final fonts = AppFontController.instance;
|
||||
return ListenableBuilder(
|
||||
listenable: fonts,
|
||||
builder: (context, _) => _cupertino
|
||||
? CupertinoApp(
|
||||
title: 'Pipelines',
|
||||
builder: (context, child) => UiScaleHost(
|
||||
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
||||
),
|
||||
theme: appCupertinoThemeWith(fontFamily: fonts.family),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: flow,
|
||||
)
|
||||
: MaterialApp(
|
||||
title: 'Pipelines',
|
||||
builder: (context, child) => UiScaleHost(
|
||||
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
||||
),
|
||||
theme: appLightTheme(fontFamily: fonts.family),
|
||||
darkTheme: appDarkTheme(fontFamily: fonts.family),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: flow,
|
||||
),
|
||||
builder: (context, _) => MaterialApp(
|
||||
title: 'Pipelines',
|
||||
builder: (context, child) => UiScaleHost(
|
||||
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
||||
),
|
||||
theme: appLightTheme(fontFamily: fonts.family),
|
||||
darkTheme: appDarkTheme(fontFamily: fonts.family),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: flow,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import '../features/attention/notify/notification_controller.dart';
|
||||
import '../features/attention/runtime/attention_controller.dart';
|
||||
import '../features/runs/screen.dart';
|
||||
import '../features/runs/ui/run_pipeline_link.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
import '../ui/adaptive/top_bar_notices.dart';
|
||||
import 'app_session.dart';
|
||||
import 'connection_status.dart';
|
||||
@@ -69,22 +68,13 @@ class RunsDestination extends StatelessWidget {
|
||||
Widget build(BuildContext context) => AnimatedBuilder(
|
||||
animation: session,
|
||||
builder: (context, _) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
if ((server.requiresConfiguration || server.error != null) &&
|
||||
session.endpoint == null) {
|
||||
return ConnectionGate(
|
||||
session: session,
|
||||
server: server,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
return ConnectionGate(session: session, server: server);
|
||||
}
|
||||
if (!session.everConnected) {
|
||||
if (session.connected) return _runsScreen();
|
||||
return ConnectionGate(
|
||||
session: session,
|
||||
server: server,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
return ConnectionGate(session: session, server: server);
|
||||
}
|
||||
// The banner stays below the top bar; without it the runs reach the top
|
||||
// edge and scroll behind the bar.
|
||||
@@ -92,7 +82,7 @@ class RunsDestination extends StatelessWidget {
|
||||
notices: [
|
||||
if (!session.connected ||
|
||||
session.subscription == RunSubscriptionState.refused)
|
||||
ConnectionBanner(session: session, cupertino: cupertino),
|
||||
ConnectionBanner(session: session),
|
||||
],
|
||||
child: _runsScreen(),
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import '../ui/adaptive/segmented_bar.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../features/schedules/data/schedules_repository.dart';
|
||||
@@ -9,7 +8,6 @@ import '../features/schedules/ui/list/schedule_list_controller.dart';
|
||||
import '../features/schedules/ui/list/schedule_list_toolbar.dart'
|
||||
show ScheduleRefreshAction;
|
||||
import '../features/schedules/ui/list/schedule_list_view.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
import 'app_session.dart';
|
||||
import 'server_endpoint.dart';
|
||||
|
||||
@@ -94,24 +92,23 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
// The page is built inside the builder from the session's connection and
|
||||
// the list controller's state; the list view itself does not listen, so a
|
||||
// finished read would otherwise stay on `Loading schedules…`.
|
||||
return AnimatedBuilder(
|
||||
animation: Listenable.merge([widget.session, _controller]),
|
||||
builder: (context, _) => _page(cupertino),
|
||||
builder: (context, _) => _page(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _page(bool cupertino) {
|
||||
final body = _body(cupertino);
|
||||
Widget _page() {
|
||||
final body = _body();
|
||||
// The round Back closes the page; Refresh sits in the actions pill.
|
||||
final bar = SegmentedBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
leading: SegmentedBackButton(
|
||||
key: schedulesPageBackKey,
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
onPressed: widget.onBack,
|
||||
),
|
||||
title: 'Schedules',
|
||||
@@ -119,23 +116,17 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
||||
if (widget.session.everConnected)
|
||||
ScheduleRefreshAction(
|
||||
controller: _controller,
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
onRefresh: () => unawaited(_controller.refresh()),
|
||||
),
|
||||
],
|
||||
);
|
||||
// The page reaches its top edge: the search strip floats under the bar
|
||||
// and the list scrolls behind both.
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: bar,
|
||||
child: SafeArea(top: false, bottom: false, child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
||||
}
|
||||
|
||||
Widget _body(bool cupertino) {
|
||||
Widget _body() {
|
||||
if (!widget.session.everConnected) {
|
||||
return const Center(
|
||||
child: Text('Connect to the server to see schedules.'),
|
||||
@@ -145,7 +136,7 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
||||
controller: _controller,
|
||||
searchController: _search,
|
||||
scrollController: _scroll,
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
onOpen: (schedule) {
|
||||
final id = schedule.pipelineId;
|
||||
if (id != null) widget.onOpenPipeline(id);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../ui/adaptive/segmented_bar.dart';
|
||||
import '../core/api_gateway.dart';
|
||||
import '../features/search/search_screen.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
import 'app_session.dart';
|
||||
import 'connection_status.dart';
|
||||
import 'server_endpoint.dart';
|
||||
@@ -13,10 +11,8 @@ import 'server_endpoint.dart';
|
||||
///
|
||||
/// 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. In a Cupertino host the screen is
|
||||
/// mounted once the route's entrance has completed: during that transition a
|
||||
/// focus request is dropped, so mounting earlier would open Search with no
|
||||
/// keyboard or caret. Material mounts it immediately as usual.
|
||||
/// 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,
|
||||
@@ -38,72 +34,21 @@ class SearchDestination extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SearchDestinationState extends State<SearchDestination> {
|
||||
Animation<double>? _animation;
|
||||
bool _entered = false;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
// Material's page transition keeps the autofocus request; only the
|
||||
// Cupertino push needs to wait for the route to become current.
|
||||
if (!usesCupertinoHost(context)) {
|
||||
_entered = true;
|
||||
return;
|
||||
}
|
||||
final animation = ModalRoute.of(context)?.animation;
|
||||
if (identical(animation, _animation)) return;
|
||||
_animation?.removeStatusListener(_onStatus);
|
||||
_animation = animation;
|
||||
if (animation == null || animation.status == AnimationStatus.completed) {
|
||||
_entered = true;
|
||||
} else {
|
||||
animation.addStatusListener(_onStatus);
|
||||
}
|
||||
}
|
||||
|
||||
void _onStatus(AnimationStatus status) {
|
||||
if (status != AnimationStatus.completed) return;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) setState(() => _entered = true);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animation?.removeStatusListener(_onStatus);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => AnimatedBuilder(
|
||||
animation: widget.session,
|
||||
builder: (context, _) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
if (!widget.session.everConnected || !_entered) {
|
||||
if (!widget.session.everConnected) {
|
||||
if (widget.embedded) {
|
||||
return _entered
|
||||
? ConnectionGate(
|
||||
session: widget.session,
|
||||
server: widget.server,
|
||||
cupertino: cupertino,
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
return ConnectionGate(session: widget.session, server: widget.server);
|
||||
}
|
||||
return _SearchPage(
|
||||
cupertino: cupertino,
|
||||
child: _entered
|
||||
? ConnectionGate(
|
||||
session: widget.session,
|
||||
server: widget.server,
|
||||
cupertino: cupertino,
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
child: ConnectionGate(session: widget.session, server: widget.server),
|
||||
);
|
||||
}
|
||||
return SearchScreen(
|
||||
gateway: widget.session.gateway,
|
||||
onOpen: widget.onOpen,
|
||||
cupertino: cupertino,
|
||||
embedded: widget.embedded,
|
||||
);
|
||||
},
|
||||
@@ -112,22 +57,16 @@ class _SearchDestinationState extends State<SearchDestination> {
|
||||
|
||||
/// The native title bar that owns Back while Search has no screen yet.
|
||||
class _SearchPage extends StatelessWidget {
|
||||
const _SearchPage({required this.cupertino, required this.child});
|
||||
const _SearchPage({required this.child});
|
||||
|
||||
final bool cupertino;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => cupertino
|
||||
? CupertinoPageScaffold(
|
||||
navigationBar: const SegmentedBar(cupertino: true, title: 'Search'),
|
||||
child: SafeArea(child: child),
|
||||
)
|
||||
: Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: const SegmentedBar(cupertino: false, title: 'Search'),
|
||||
body: SafeArea(child: child),
|
||||
);
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: const SegmentedBar(cupertino: false, title: 'Search'),
|
||||
body: SafeArea(child: child),
|
||||
);
|
||||
}
|
||||
|
||||
/// The run a result names, taken only from the server's own payload document.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../core/api_gateway.dart';
|
||||
@@ -7,11 +6,9 @@ import '../features/templates/ui/template_detail.dart'
|
||||
show templateDetailBackKey;
|
||||
import '../shell/destination.dart';
|
||||
import '../shell/shell_bar.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
import '../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../ui/adaptive/segmented_bar.dart';
|
||||
import '../ui/adaptive/top_bar_notices.dart';
|
||||
import '../ui/theme/app_theme.dart';
|
||||
import 'app_session.dart';
|
||||
import 'connection_status.dart';
|
||||
import 'server_endpoint.dart';
|
||||
@@ -66,52 +63,42 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final body = ShellBarScope(
|
||||
registry: _bar,
|
||||
destination: AppDestination.settings,
|
||||
child: AnimatedBuilder(
|
||||
animation: widget.session,
|
||||
builder: (context, _) => _body(cupertino),
|
||||
builder: (context, _) => _body(),
|
||||
),
|
||||
);
|
||||
final bar = ListenableBuilder(
|
||||
listenable: _bar,
|
||||
builder: (context, _) => _segmentedBar(cupertino),
|
||||
builder: (context, _) => _segmentedBar(),
|
||||
);
|
||||
// The page reaches its top edge: the gallery and an open template scroll
|
||||
// behind the bar and pad their own content by its height.
|
||||
final page = SafeArea(top: false, bottom: false, child: body);
|
||||
if (cupertino) {
|
||||
// Plain list rows on the page background, like the other lists; the
|
||||
// bar's scrim takes the same colour.
|
||||
return CupertinoPageScaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
navigationBar: _BarSlot(cupertino: true, child: bar),
|
||||
child: page,
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: _BarSlot(cupertino: false, child: bar),
|
||||
appBar: _BarSlot(child: bar),
|
||||
body: page,
|
||||
);
|
||||
}
|
||||
|
||||
SegmentedBar _segmentedBar(bool cupertino) {
|
||||
SegmentedBar _segmentedBar() {
|
||||
final spec = _bar.specFor(AppDestination.settings);
|
||||
final onDetailBack = spec?.onBack;
|
||||
return SegmentedBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
leading: onDetailBack != null
|
||||
? SegmentedBackButton(
|
||||
key: templateDetailBackKey,
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
onPressed: onDetailBack,
|
||||
)
|
||||
: SegmentedBackButton(
|
||||
key: templatesPageBackKey,
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
onPressed: widget.onBack,
|
||||
),
|
||||
title: spec?.title ?? 'Templates',
|
||||
@@ -120,14 +107,14 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _body(bool cupertino) {
|
||||
Widget _body() {
|
||||
final session = widget.session;
|
||||
if (!session.everConnected) {
|
||||
return BelowTopBar(
|
||||
child: ConnectionGate(
|
||||
session: session,
|
||||
server: widget.server,
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -135,7 +122,7 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
||||
return TopBarNotices(
|
||||
notices: [
|
||||
if (!session.connected)
|
||||
ConnectionBanner(session: session, cupertino: cupertino),
|
||||
ConnectionBanner(session: session, cupertino: false),
|
||||
],
|
||||
child: TemplatesScreen(
|
||||
gateway: session.gateway,
|
||||
@@ -149,19 +136,14 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
||||
|
||||
/// Gives the scaffold a [SegmentedBar]'s size and obstruction while the bar
|
||||
/// itself is rebuilt from the published controls.
|
||||
class _BarSlot extends StatelessWidget
|
||||
implements ObstructingPreferredSizeWidget {
|
||||
const _BarSlot({required this.cupertino, required this.child});
|
||||
class _BarSlot extends StatelessWidget implements PreferredSizeWidget {
|
||||
const _BarSlot({required this.child});
|
||||
|
||||
final bool cupertino;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Size get preferredSize =>
|
||||
SegmentedBar(cupertino: cupertino, title: '').preferredSize;
|
||||
|
||||
@override
|
||||
bool shouldFullyObstruct(BuildContext context) => false;
|
||||
const SegmentedBar(cupertino: false, title: '').preferredSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => child;
|
||||
|
||||
@@ -36,8 +36,7 @@ class AdaptiveShell extends StatefulWidget {
|
||||
|
||||
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
||||
|
||||
/// Retained for callers that still pass it; the shell always draws the
|
||||
/// Material controls and scaffold whether this is set or not.
|
||||
/// Retained for callers that still pass it; the shell always draws Material.
|
||||
final bool cupertino;
|
||||
|
||||
/// The destination a route owner selected. When null the shell keeps its own
|
||||
|
||||
@@ -14,7 +14,7 @@ class AttentionDestinationIcon extends StatelessWidget {
|
||||
const AttentionDestinationIcon({
|
||||
super.key,
|
||||
required this.count,
|
||||
required this.cupertino,
|
||||
this.cupertino = false,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ class ActivityBadge extends StatelessWidget {
|
||||
super.key,
|
||||
required this.count,
|
||||
required this.label,
|
||||
required this.cupertino,
|
||||
this.cupertino = false,
|
||||
required this.child,
|
||||
this.bottom = false,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum AppDestination { pipelines, runs, chat, search, settings }
|
||||
@@ -22,34 +21,32 @@ AppDestination shellTabFor(AppDestination destination) =>
|
||||
|
||||
/// The label and icons for [value].
|
||||
///
|
||||
/// [cupertinoIcon] is retained in the record for callers that still read it;
|
||||
/// the shell itself draws [icon] on its Material path.
|
||||
({String label, IconData icon, IconData cupertinoIcon}) destinationDetails(
|
||||
AppDestination value,
|
||||
) => switch (value) {
|
||||
AppDestination.pipelines => (
|
||||
label: 'Pipelines',
|
||||
icon: Icons.account_tree_outlined,
|
||||
cupertinoIcon: CupertinoIcons.arrow_branch,
|
||||
cupertinoIcon: Icons.account_tree_outlined,
|
||||
),
|
||||
AppDestination.runs => (
|
||||
label: 'Runs',
|
||||
icon: Icons.play_circle_outline,
|
||||
cupertinoIcon: CupertinoIcons.play_circle,
|
||||
cupertinoIcon: Icons.play_circle_outline,
|
||||
),
|
||||
AppDestination.chat => (
|
||||
label: 'Chat',
|
||||
icon: Icons.chat_bubble_outline,
|
||||
cupertinoIcon: CupertinoIcons.chat_bubble_2,
|
||||
cupertinoIcon: Icons.chat_bubble_outline,
|
||||
),
|
||||
AppDestination.search => (
|
||||
label: 'Search',
|
||||
icon: Icons.search,
|
||||
cupertinoIcon: CupertinoIcons.search,
|
||||
cupertinoIcon: Icons.search,
|
||||
),
|
||||
AppDestination.settings => (
|
||||
label: 'Settings',
|
||||
icon: Icons.settings_outlined,
|
||||
cupertinoIcon: CupertinoIcons.gear,
|
||||
cupertinoIcon: Icons.settings_outlined,
|
||||
),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Material startup and shell cleanup
|
||||
|
||||
- Consolidated application startup, onboarding, routing pages, connection
|
||||
states, Search, Templates, Schedules, and the navigation shell onto Material
|
||||
composition on every platform.
|
||||
- Kept legacy `cupertino` constructor arguments optional/ignored where callers
|
||||
still pass them; no Cupertino widgets or platform host selection remain in
|
||||
the changed application paths.
|
||||
- Focused watchdog command ran the mirrored application/routing/navigation and
|
||||
shell tests: 38 passed and 7 failed. The seven failures were teardown
|
||||
assertions for the pre-existing 15-second `LaunchUpdateChecker` timer in
|
||||
`PipelinesApp`; no Material cleanup assertion failed.
|
||||
- `tool/analyze.sh`: clean (exit 0).
|
||||
- No rendered capture was performed; this cleanup preserves the existing
|
||||
Material scaffold, bars, connection states, focus, and navigation semantics.
|
||||
|
||||
## Manager recovery
|
||||
|
||||
The navigation and template-wiring fixtures were inadvertently invoking native
|
||||
update plugins. They now explicitly disable updates, while dedicated startup
|
||||
update tests retain and exercise the real update-check behavior.
|
||||
|
||||
The focused routing, app, schedules, template-wiring, split-bar, startup-update
|
||||
check and startup-update-flow tests passed: 39 passed, zero failed. No production
|
||||
update behavior was changed to hide the teardown failures.
|
||||
@@ -37,6 +37,8 @@ Future<void> pumpApp(
|
||||
PipelinesApp(
|
||||
server: webServer(),
|
||||
client: client,
|
||||
// Navigation fixtures do not exercise native update plugins.
|
||||
androidSupported: false,
|
||||
cupertino: false,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
|
||||
@@ -78,6 +78,8 @@ Future<void> pumpApp(
|
||||
PipelinesApp(
|
||||
server: webServer(),
|
||||
client: client,
|
||||
// This fixture tests template routing, not native update plugins.
|
||||
androidSupported: false,
|
||||
cupertino: false,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user