Merge commit 'ec3455e34dbec87376f00d19d9cc944eef51dae7' into pipelines/run-20261111-1951-material-cleanup-terminal-and-chat-shell-1213
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
import '../ui/adaptive/platform.dart';
|
|
||||||
import '../ui/adaptive/window_margins.dart';
|
import '../ui/adaptive/window_margins.dart';
|
||||||
import '../ui/theme/app_font_controller.dart';
|
import '../ui/theme/app_font_controller.dart';
|
||||||
import '../ui/theme/app_theme.dart';
|
import '../ui/theme/app_theme.dart';
|
||||||
import '../ui/scale/ui_scale.dart';
|
import '../ui/scale/ui_scale.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../shell/adaptive_shell.dart';
|
import '../shell/adaptive_shell.dart';
|
||||||
@@ -35,6 +33,9 @@ class MyApp extends StatelessWidget {
|
|||||||
onDestinationSelected = null;
|
onDestinationSelected = null;
|
||||||
|
|
||||||
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
||||||
|
|
||||||
|
/// Retained for source compatibility with older callers; Material is the
|
||||||
|
/// only application host.
|
||||||
final bool? cupertino;
|
final bool? cupertino;
|
||||||
final AppDestination? destination;
|
final AppDestination? destination;
|
||||||
final ValueChanged<AppDestination>? onDestinationSelected;
|
final ValueChanged<AppDestination>? onDestinationSelected;
|
||||||
@@ -55,28 +56,6 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _host(String? fontFamily) {
|
Widget _host(String? fontFamily) {
|
||||||
final router = routerConfig;
|
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) {
|
if (router != null) {
|
||||||
return MaterialApp.router(
|
return MaterialApp.router(
|
||||||
title: 'Pipelines',
|
title: 'Pipelines',
|
||||||
@@ -101,8 +80,6 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get _platformIsCupertino => prefersCupertino();
|
|
||||||
|
|
||||||
static Widget _scaled(BuildContext context, Widget? child) => UiScaleHost(
|
static Widget _scaled(BuildContext context, Widget? child) => UiScaleHost(
|
||||||
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'app_route.dart';
|
import 'app_route.dart';
|
||||||
@@ -47,7 +46,7 @@ String routeLocation(Uri uri) {
|
|||||||
class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||||
AppRouterDelegate({
|
AppRouterDelegate({
|
||||||
required this.builder,
|
required this.builder,
|
||||||
required this.cupertino,
|
this.cupertino,
|
||||||
this.searchBuilder,
|
this.searchBuilder,
|
||||||
this.templatesBuilder,
|
this.templatesBuilder,
|
||||||
this.schedulesBuilder,
|
this.schedulesBuilder,
|
||||||
@@ -75,7 +74,9 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
|||||||
/// state and selection, and the standard navigation bar supplies Back.
|
/// state and selection, and the standard navigation bar supplies Back.
|
||||||
final Widget Function(BuildContext context)? searchBuilder;
|
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>();
|
final _navigatorKey = GlobalKey<NavigatorState>();
|
||||||
static const _pageKey = ValueKey<String>('pipelines-shell');
|
static const _pageKey = ValueKey<String>('pipelines-shell');
|
||||||
@@ -119,9 +120,7 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
|||||||
AppRoute get currentConfiguration => _route;
|
AppRoute get currentConfiguration => _route;
|
||||||
|
|
||||||
Page<void> _page(LocalKey key, Widget child, {bool dialog = false}) =>
|
Page<void> _page(LocalKey key, Widget child, {bool dialog = false}) =>
|
||||||
cupertino
|
MaterialPage<void>(key: key, child: child, fullscreenDialog: dialog);
|
||||||
? CupertinoPage<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
|
/// A page-based Navigator supplies the Overlay, overlay portals and route
|
||||||
/// context that native controls (action sheets, tooltips) require. The shell
|
/// 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/chat_runtime.dart';
|
||||||
import '../features/chat/screen.dart';
|
import '../features/chat/screen.dart';
|
||||||
import '../features/chat/windows/chat_windows.dart';
|
import '../features/chat/windows/chat_windows.dart';
|
||||||
import '../ui/adaptive/host.dart';
|
|
||||||
import '../ui/adaptive/top_bar_notices.dart';
|
import '../ui/adaptive/top_bar_notices.dart';
|
||||||
import 'app_session.dart';
|
import 'app_session.dart';
|
||||||
import 'connection_status.dart';
|
import 'connection_status.dart';
|
||||||
@@ -48,7 +47,6 @@ class ChatDestination extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => AnimatedBuilder(
|
Widget build(BuildContext context) => AnimatedBuilder(
|
||||||
animation: Listenable.merge([session, ?pool]),
|
animation: Listenable.merge([session, ?pool]),
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
// Saved machines connect independently; their state and sign-in live
|
// Saved machines connect independently; their state and sign-in live
|
||||||
// in Settings, so the chat itself carries no connection chrome.
|
// in Settings, so the chat itself carries no connection chrome.
|
||||||
if (pool != null && pool!.servers.catalog.servers.isNotEmpty) {
|
if (pool != null && pool!.servers.catalog.servers.isNotEmpty) {
|
||||||
@@ -56,28 +54,17 @@ class ChatDestination extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
if ((server.requiresConfiguration || server.error != null) &&
|
if ((server.requiresConfiguration || server.error != null) &&
|
||||||
session.endpoint == null) {
|
session.endpoint == null) {
|
||||||
return ConnectionGate(
|
return ConnectionGate(session: session, server: server);
|
||||||
session: session,
|
|
||||||
server: server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (!session.everConnected) {
|
if (!session.everConnected) {
|
||||||
if (session.connected) return _chatScreen();
|
if (session.connected) return _chatScreen();
|
||||||
return ConnectionGate(
|
return ConnectionGate(session: session, server: server);
|
||||||
session: session,
|
|
||||||
server: server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// The banner stays below the top bar; without it the chat screen
|
// 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
|
// reaches the top edge (an open chat beside the list draws its own bar
|
||||||
// there).
|
// there).
|
||||||
return TopBarNotices(
|
return TopBarNotices(
|
||||||
notices: [
|
notices: [if (!session.connected) ConnectionBanner(session: session)],
|
||||||
if (!session.connected)
|
|
||||||
ConnectionBanner(session: session, cupertino: cupertino),
|
|
||||||
],
|
|
||||||
child: _chatScreen(),
|
child: _chatScreen(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../core/transport/connection_state.dart';
|
import '../core/transport/connection_state.dart';
|
||||||
@@ -15,12 +14,12 @@ class ConnectionGate extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.session,
|
required this.session,
|
||||||
required this.server,
|
required this.server,
|
||||||
required this.cupertino,
|
this.cupertino,
|
||||||
});
|
});
|
||||||
|
|
||||||
final AppSession session;
|
final AppSession session;
|
||||||
final ServerEndpoint server;
|
final ServerEndpoint server;
|
||||||
final bool cupertino;
|
final bool? cupertino;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -75,18 +74,14 @@ class ConnectionGate extends StatelessWidget {
|
|||||||
if (progress)
|
if (progress)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 12),
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
child: cupertino
|
child: const CircularProgressIndicator(),
|
||||||
? const CupertinoActivityIndicator()
|
|
||||||
: const CircularProgressIndicator(),
|
|
||||||
),
|
),
|
||||||
Semantics(
|
Semantics(
|
||||||
liveRegion: true,
|
liveRegion: true,
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: cupertino
|
style: theme.textTheme.titleMedium,
|
||||||
? CupertinoTheme.of(context).textTheme.navTitleTextStyle
|
|
||||||
: theme.textTheme.titleMedium,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (detail.isNotEmpty) ...[
|
if (detail.isNotEmpty) ...[
|
||||||
@@ -94,15 +89,12 @@ class ConnectionGate extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
detail,
|
detail,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: cupertino ? null : theme.textTheme.bodyMedium,
|
style: theme.textTheme.bodyMedium,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
if (onRetry != null) ...[
|
if (onRetry != null) ...[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
if (cupertino)
|
FilledButton(onPressed: onRetry, child: const Text('Retry')),
|
||||||
CupertinoButton(onPressed: onRetry, child: const Text('Retry'))
|
|
||||||
else
|
|
||||||
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.
|
/// A compact status bar above retained content after the first connection.
|
||||||
class ConnectionBanner extends StatelessWidget {
|
class ConnectionBanner extends StatelessWidget {
|
||||||
const ConnectionBanner({
|
const ConnectionBanner({super.key, required this.session, this.cupertino});
|
||||||
super.key,
|
|
||||||
required this.session,
|
|
||||||
required this.cupertino,
|
|
||||||
});
|
|
||||||
|
|
||||||
final AppSession session;
|
final AppSession session;
|
||||||
final bool cupertino;
|
final bool? cupertino;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -145,25 +133,19 @@ class ConnectionBanner extends StatelessWidget {
|
|||||||
detail = 'Check that the Pipelines server is running.';
|
detail = 'Check that the Pipelines server is running.';
|
||||||
onRetry = session.retry;
|
onRetry = session.retry;
|
||||||
}
|
}
|
||||||
final textStyle = cupertino
|
final textStyle = Theme.of(context).textTheme.bodyMedium;
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
|
||||||
: Theme.of(context).textTheme.bodyMedium;
|
|
||||||
return ColoredBox(
|
return ColoredBox(
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
? CupertinoDynamicColor.resolve(CupertinoColors.systemGrey5, context)
|
|
||||||
: Theme.of(context).colorScheme.surfaceContainerHighest,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (reconnecting) ...[
|
if (reconnecting) ...[
|
||||||
cupertino
|
const SizedBox(
|
||||||
? const CupertinoActivityIndicator(radius: 7)
|
width: 14,
|
||||||
: const SizedBox(
|
height: 14,
|
||||||
width: 14,
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
height: 14,
|
),
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
],
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -179,14 +161,7 @@ class ConnectionBanner extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
if (cupertino)
|
TextButton(onPressed: onRetry, child: const Text('Retry')),
|
||||||
CupertinoButton(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
onPressed: onRetry,
|
|
||||||
child: const Text('Retry'),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
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/server_context.dart';
|
||||||
import '../core/servers/elevation/elevation_dialog.dart';
|
import '../core/servers/elevation/elevation_dialog.dart';
|
||||||
import '../core/servers/elevation/machine_elevation.dart';
|
import '../core/servers/elevation/machine_elevation.dart';
|
||||||
import '../ui/adaptive/platform.dart';
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@@ -338,7 +337,8 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
type: RouteInformationReportingType.neglect,
|
type: RouteInformationReportingType.neglect,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_cupertino = widget.cupertino ?? _platformIsCupertino;
|
// Kept as a compatibility field on the widget; composition is Material-only.
|
||||||
|
_cupertino = false;
|
||||||
_notifications.onOpenRun = (id) {
|
_notifications.onOpenRun = (id) {
|
||||||
if (mounted) _delegate.goTo(AppRoute.run(id));
|
if (mounted) _delegate.goTo(AppRoute.run(id));
|
||||||
};
|
};
|
||||||
@@ -954,6 +954,4 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
AppDestination.search => AppRoute.search,
|
AppDestination.search => AppRoute.search,
|
||||||
AppDestination.settings => AppRoute.settings,
|
AppDestination.settings => AppRoute.settings,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool get _platformIsCupertino => prefersCupertino();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import '../core/servers/server_scope.dart';
|
import '../core/servers/server_scope.dart';
|
||||||
|
|
||||||
import '../features/pipelines/screen.dart';
|
import '../features/pipelines/screen.dart';
|
||||||
import '../ui/adaptive/host.dart';
|
|
||||||
import '../ui/adaptive/top_bar_notices.dart';
|
import '../ui/adaptive/top_bar_notices.dart';
|
||||||
import 'app_session.dart';
|
import 'app_session.dart';
|
||||||
import 'connection_status.dart';
|
import 'connection_status.dart';
|
||||||
@@ -64,30 +63,18 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => AnimatedBuilder(
|
Widget build(BuildContext context) => AnimatedBuilder(
|
||||||
animation: session,
|
animation: session,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
if ((server.requiresConfiguration || server.error != null) &&
|
if ((server.requiresConfiguration || server.error != null) &&
|
||||||
session.endpoint == null) {
|
session.endpoint == null) {
|
||||||
return ConnectionGate(
|
return ConnectionGate(session: session, server: server);
|
||||||
session: session,
|
|
||||||
server: server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (!session.everConnected) {
|
if (!session.everConnected) {
|
||||||
if (session.connected) return _pipelinesScreen();
|
if (session.connected) return _pipelinesScreen();
|
||||||
return ConnectionGate(
|
return ConnectionGate(session: session, server: server);
|
||||||
session: session,
|
|
||||||
server: server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// The banner stays below the top bar; without it the pipelines reach
|
// The banner stays below the top bar; without it the pipelines reach
|
||||||
// the top edge and scroll behind the bar.
|
// the top edge and scroll behind the bar.
|
||||||
return TopBarNotices(
|
return TopBarNotices(
|
||||||
notices: [
|
notices: [if (!session.connected) ConnectionBanner(session: session)],
|
||||||
if (!session.connected)
|
|
||||||
ConnectionBanner(session: session, cupertino: cupertino),
|
|
||||||
],
|
|
||||||
child: _pipelinesScreen(),
|
child: _pipelinesScreen(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import '../core/servers/chat/chat_server_pool.dart';
|
import '../core/servers/chat/chat_server_pool.dart';
|
||||||
import '../ui/adaptive/platform.dart';
|
|
||||||
import '../ui/adaptive/window_margins.dart';
|
import '../ui/adaptive/window_margins.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
@@ -307,8 +305,6 @@ class _PipelinesRootState extends State<PipelinesRoot> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get _cupertino => prefersCupertino();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_booting) {
|
if (_booting) {
|
||||||
@@ -318,15 +314,10 @@ class _PipelinesRootState extends State<PipelinesRoot> {
|
|||||||
view: View.of(context),
|
view: View.of(context),
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: _cupertino
|
child: Theme(
|
||||||
? const CupertinoTheme(
|
data: appLightTheme(),
|
||||||
data: appCupertinoTheme,
|
child: const Center(child: CircularProgressIndicator()),
|
||||||
child: Center(child: CupertinoActivityIndicator()),
|
),
|
||||||
)
|
|
||||||
: Theme(
|
|
||||||
data: appLightTheme(),
|
|
||||||
child: const Center(child: CircularProgressIndicator()),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -368,26 +359,16 @@ class _PipelinesRootState extends State<PipelinesRoot> {
|
|||||||
final fonts = AppFontController.instance;
|
final fonts = AppFontController.instance;
|
||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
listenable: fonts,
|
listenable: fonts,
|
||||||
builder: (context, _) => _cupertino
|
builder: (context, _) => MaterialApp(
|
||||||
? CupertinoApp(
|
title: 'Pipelines',
|
||||||
title: 'Pipelines',
|
builder: (context, child) => UiScaleHost(
|
||||||
builder: (context, child) => UiScaleHost(
|
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
||||||
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
),
|
||||||
),
|
theme: appLightTheme(fontFamily: fonts.family),
|
||||||
theme: appCupertinoThemeWith(fontFamily: fonts.family),
|
darkTheme: appDarkTheme(fontFamily: fonts.family),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
home: flow,
|
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,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import '../features/attention/notify/notification_controller.dart';
|
|||||||
import '../features/attention/runtime/attention_controller.dart';
|
import '../features/attention/runtime/attention_controller.dart';
|
||||||
import '../features/runs/screen.dart';
|
import '../features/runs/screen.dart';
|
||||||
import '../features/runs/ui/run_pipeline_link.dart';
|
import '../features/runs/ui/run_pipeline_link.dart';
|
||||||
import '../ui/adaptive/host.dart';
|
|
||||||
import '../ui/adaptive/top_bar_notices.dart';
|
import '../ui/adaptive/top_bar_notices.dart';
|
||||||
import 'app_session.dart';
|
import 'app_session.dart';
|
||||||
import 'connection_status.dart';
|
import 'connection_status.dart';
|
||||||
@@ -69,22 +68,13 @@ class RunsDestination extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => AnimatedBuilder(
|
Widget build(BuildContext context) => AnimatedBuilder(
|
||||||
animation: session,
|
animation: session,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
if ((server.requiresConfiguration || server.error != null) &&
|
if ((server.requiresConfiguration || server.error != null) &&
|
||||||
session.endpoint == null) {
|
session.endpoint == null) {
|
||||||
return ConnectionGate(
|
return ConnectionGate(session: session, server: server);
|
||||||
session: session,
|
|
||||||
server: server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (!session.everConnected) {
|
if (!session.everConnected) {
|
||||||
if (session.connected) return _runsScreen();
|
if (session.connected) return _runsScreen();
|
||||||
return ConnectionGate(
|
return ConnectionGate(session: session, server: server);
|
||||||
session: session,
|
|
||||||
server: server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// The banner stays below the top bar; without it the runs reach the top
|
// The banner stays below the top bar; without it the runs reach the top
|
||||||
// edge and scroll behind the bar.
|
// edge and scroll behind the bar.
|
||||||
@@ -92,7 +82,7 @@ class RunsDestination extends StatelessWidget {
|
|||||||
notices: [
|
notices: [
|
||||||
if (!session.connected ||
|
if (!session.connected ||
|
||||||
session.subscription == RunSubscriptionState.refused)
|
session.subscription == RunSubscriptionState.refused)
|
||||||
ConnectionBanner(session: session, cupertino: cupertino),
|
ConnectionBanner(session: session),
|
||||||
],
|
],
|
||||||
child: _runsScreen(),
|
child: _runsScreen(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import '../ui/adaptive/segmented_bar.dart';
|
import '../ui/adaptive/segmented_bar.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../features/schedules/data/schedules_repository.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'
|
import '../features/schedules/ui/list/schedule_list_toolbar.dart'
|
||||||
show ScheduleRefreshAction;
|
show ScheduleRefreshAction;
|
||||||
import '../features/schedules/ui/list/schedule_list_view.dart';
|
import '../features/schedules/ui/list/schedule_list_view.dart';
|
||||||
import '../ui/adaptive/host.dart';
|
|
||||||
import 'app_session.dart';
|
import 'app_session.dart';
|
||||||
import 'server_endpoint.dart';
|
import 'server_endpoint.dart';
|
||||||
|
|
||||||
@@ -94,24 +92,23 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
// The page is built inside the builder from the session's connection and
|
// 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
|
// the list controller's state; the list view itself does not listen, so a
|
||||||
// finished read would otherwise stay on `Loading schedules…`.
|
// finished read would otherwise stay on `Loading schedules…`.
|
||||||
return AnimatedBuilder(
|
return AnimatedBuilder(
|
||||||
animation: Listenable.merge([widget.session, _controller]),
|
animation: Listenable.merge([widget.session, _controller]),
|
||||||
builder: (context, _) => _page(cupertino),
|
builder: (context, _) => _page(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _page(bool cupertino) {
|
Widget _page() {
|
||||||
final body = _body(cupertino);
|
final body = _body();
|
||||||
// The round Back closes the page; Refresh sits in the actions pill.
|
// The round Back closes the page; Refresh sits in the actions pill.
|
||||||
final bar = SegmentedBar(
|
final bar = SegmentedBar(
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
leading: SegmentedBackButton(
|
leading: SegmentedBackButton(
|
||||||
key: schedulesPageBackKey,
|
key: schedulesPageBackKey,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onPressed: widget.onBack,
|
onPressed: widget.onBack,
|
||||||
),
|
),
|
||||||
title: 'Schedules',
|
title: 'Schedules',
|
||||||
@@ -119,23 +116,17 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
|||||||
if (widget.session.everConnected)
|
if (widget.session.everConnected)
|
||||||
ScheduleRefreshAction(
|
ScheduleRefreshAction(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onRefresh: () => unawaited(_controller.refresh()),
|
onRefresh: () => unawaited(_controller.refresh()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
// The page reaches its top edge: the search strip floats under the bar
|
// The page reaches its top edge: the search strip floats under the bar
|
||||||
// and the list scrolls behind both.
|
// 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);
|
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _body(bool cupertino) {
|
Widget _body() {
|
||||||
if (!widget.session.everConnected) {
|
if (!widget.session.everConnected) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Text('Connect to the server to see schedules.'),
|
child: Text('Connect to the server to see schedules.'),
|
||||||
@@ -145,7 +136,7 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
|||||||
controller: _controller,
|
controller: _controller,
|
||||||
searchController: _search,
|
searchController: _search,
|
||||||
scrollController: _scroll,
|
scrollController: _scroll,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onOpen: (schedule) {
|
onOpen: (schedule) {
|
||||||
final id = schedule.pipelineId;
|
final id = schedule.pipelineId;
|
||||||
if (id != null) widget.onOpenPipeline(id);
|
if (id != null) widget.onOpenPipeline(id);
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../ui/adaptive/segmented_bar.dart';
|
import '../ui/adaptive/segmented_bar.dart';
|
||||||
import '../core/api_gateway.dart';
|
import '../core/api_gateway.dart';
|
||||||
import '../features/search/search_screen.dart';
|
import '../features/search/search_screen.dart';
|
||||||
import '../ui/adaptive/host.dart';
|
|
||||||
import 'app_session.dart';
|
import 'app_session.dart';
|
||||||
import 'connection_status.dart';
|
import 'connection_status.dart';
|
||||||
import 'server_endpoint.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
|
/// 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
|
/// 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
|
/// returns to the previous destination. The screen mounts immediately so the
|
||||||
/// mounted once the route's entrance has completed: during that transition a
|
/// search field retains normal focus and keyboard behavior during navigation.
|
||||||
/// focus request is dropped, so mounting earlier would open Search with no
|
|
||||||
/// keyboard or caret. Material mounts it immediately as usual.
|
|
||||||
class SearchDestination extends StatefulWidget {
|
class SearchDestination extends StatefulWidget {
|
||||||
const SearchDestination({
|
const SearchDestination({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -38,72 +34,21 @@ class SearchDestination extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SearchDestinationState extends State<SearchDestination> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) => AnimatedBuilder(
|
Widget build(BuildContext context) => AnimatedBuilder(
|
||||||
animation: widget.session,
|
animation: widget.session,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
if (!widget.session.everConnected) {
|
||||||
if (!widget.session.everConnected || !_entered) {
|
|
||||||
if (widget.embedded) {
|
if (widget.embedded) {
|
||||||
return _entered
|
return ConnectionGate(session: widget.session, server: widget.server);
|
||||||
? ConnectionGate(
|
|
||||||
session: widget.session,
|
|
||||||
server: widget.server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink();
|
|
||||||
}
|
}
|
||||||
return _SearchPage(
|
return _SearchPage(
|
||||||
cupertino: cupertino,
|
child: ConnectionGate(session: widget.session, server: widget.server),
|
||||||
child: _entered
|
|
||||||
? ConnectionGate(
|
|
||||||
session: widget.session,
|
|
||||||
server: widget.server,
|
|
||||||
cupertino: cupertino,
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return SearchScreen(
|
return SearchScreen(
|
||||||
gateway: widget.session.gateway,
|
gateway: widget.session.gateway,
|
||||||
onOpen: widget.onOpen,
|
onOpen: widget.onOpen,
|
||||||
cupertino: cupertino,
|
|
||||||
embedded: widget.embedded,
|
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.
|
/// The native title bar that owns Back while Search has no screen yet.
|
||||||
class _SearchPage extends StatelessWidget {
|
class _SearchPage extends StatelessWidget {
|
||||||
const _SearchPage({required this.cupertino, required this.child});
|
const _SearchPage({required this.child});
|
||||||
|
|
||||||
final bool cupertino;
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => cupertino
|
Widget build(BuildContext context) => Scaffold(
|
||||||
? CupertinoPageScaffold(
|
extendBodyBehindAppBar: true,
|
||||||
navigationBar: const SegmentedBar(cupertino: true, title: 'Search'),
|
appBar: const SegmentedBar(cupertino: false, title: 'Search'),
|
||||||
child: SafeArea(child: child),
|
body: SafeArea(child: child),
|
||||||
)
|
);
|
||||||
: 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.
|
/// 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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../core/api_gateway.dart';
|
import '../core/api_gateway.dart';
|
||||||
@@ -7,11 +6,9 @@ import '../features/templates/ui/template_detail.dart'
|
|||||||
show templateDetailBackKey;
|
show templateDetailBackKey;
|
||||||
import '../shell/destination.dart';
|
import '../shell/destination.dart';
|
||||||
import '../shell/shell_bar.dart';
|
import '../shell/shell_bar.dart';
|
||||||
import '../ui/adaptive/host.dart';
|
|
||||||
import '../ui/adaptive/floating_bar_layout.dart';
|
import '../ui/adaptive/floating_bar_layout.dart';
|
||||||
import '../ui/adaptive/segmented_bar.dart';
|
import '../ui/adaptive/segmented_bar.dart';
|
||||||
import '../ui/adaptive/top_bar_notices.dart';
|
import '../ui/adaptive/top_bar_notices.dart';
|
||||||
import '../ui/theme/app_theme.dart';
|
|
||||||
import 'app_session.dart';
|
import 'app_session.dart';
|
||||||
import 'connection_status.dart';
|
import 'connection_status.dart';
|
||||||
import 'server_endpoint.dart';
|
import 'server_endpoint.dart';
|
||||||
@@ -66,52 +63,42 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final body = ShellBarScope(
|
final body = ShellBarScope(
|
||||||
registry: _bar,
|
registry: _bar,
|
||||||
destination: AppDestination.settings,
|
destination: AppDestination.settings,
|
||||||
child: AnimatedBuilder(
|
child: AnimatedBuilder(
|
||||||
animation: widget.session,
|
animation: widget.session,
|
||||||
builder: (context, _) => _body(cupertino),
|
builder: (context, _) => _body(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final bar = ListenableBuilder(
|
final bar = ListenableBuilder(
|
||||||
listenable: _bar,
|
listenable: _bar,
|
||||||
builder: (context, _) => _segmentedBar(cupertino),
|
builder: (context, _) => _segmentedBar(),
|
||||||
);
|
);
|
||||||
// The page reaches its top edge: the gallery and an open template scroll
|
// The page reaches its top edge: the gallery and an open template scroll
|
||||||
// behind the bar and pad their own content by its height.
|
// behind the bar and pad their own content by its height.
|
||||||
final page = SafeArea(top: false, bottom: false, child: body);
|
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(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: _BarSlot(cupertino: false, child: bar),
|
appBar: _BarSlot(child: bar),
|
||||||
body: page,
|
body: page,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SegmentedBar _segmentedBar(bool cupertino) {
|
SegmentedBar _segmentedBar() {
|
||||||
final spec = _bar.specFor(AppDestination.settings);
|
final spec = _bar.specFor(AppDestination.settings);
|
||||||
final onDetailBack = spec?.onBack;
|
final onDetailBack = spec?.onBack;
|
||||||
return SegmentedBar(
|
return SegmentedBar(
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
leading: onDetailBack != null
|
leading: onDetailBack != null
|
||||||
? SegmentedBackButton(
|
? SegmentedBackButton(
|
||||||
key: templateDetailBackKey,
|
key: templateDetailBackKey,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onPressed: onDetailBack,
|
onPressed: onDetailBack,
|
||||||
)
|
)
|
||||||
: SegmentedBackButton(
|
: SegmentedBackButton(
|
||||||
key: templatesPageBackKey,
|
key: templatesPageBackKey,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onPressed: widget.onBack,
|
onPressed: widget.onBack,
|
||||||
),
|
),
|
||||||
title: spec?.title ?? 'Templates',
|
title: spec?.title ?? 'Templates',
|
||||||
@@ -120,14 +107,14 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _body(bool cupertino) {
|
Widget _body() {
|
||||||
final session = widget.session;
|
final session = widget.session;
|
||||||
if (!session.everConnected) {
|
if (!session.everConnected) {
|
||||||
return BelowTopBar(
|
return BelowTopBar(
|
||||||
child: ConnectionGate(
|
child: ConnectionGate(
|
||||||
session: session,
|
session: session,
|
||||||
server: widget.server,
|
server: widget.server,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -135,7 +122,7 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
|||||||
return TopBarNotices(
|
return TopBarNotices(
|
||||||
notices: [
|
notices: [
|
||||||
if (!session.connected)
|
if (!session.connected)
|
||||||
ConnectionBanner(session: session, cupertino: cupertino),
|
ConnectionBanner(session: session, cupertino: false),
|
||||||
],
|
],
|
||||||
child: TemplatesScreen(
|
child: TemplatesScreen(
|
||||||
gateway: session.gateway,
|
gateway: session.gateway,
|
||||||
@@ -149,19 +136,14 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
|
|||||||
|
|
||||||
/// Gives the scaffold a [SegmentedBar]'s size and obstruction while the bar
|
/// Gives the scaffold a [SegmentedBar]'s size and obstruction while the bar
|
||||||
/// itself is rebuilt from the published controls.
|
/// itself is rebuilt from the published controls.
|
||||||
class _BarSlot extends StatelessWidget
|
class _BarSlot extends StatelessWidget implements PreferredSizeWidget {
|
||||||
implements ObstructingPreferredSizeWidget {
|
const _BarSlot({required this.child});
|
||||||
const _BarSlot({required this.cupertino, required this.child});
|
|
||||||
|
|
||||||
final bool cupertino;
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Size get preferredSize =>
|
Size get preferredSize =>
|
||||||
SegmentedBar(cupertino: cupertino, title: '').preferredSize;
|
const SegmentedBar(cupertino: false, title: '').preferredSize;
|
||||||
|
|
||||||
@override
|
|
||||||
bool shouldFullyObstruct(BuildContext context) => false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => child;
|
Widget build(BuildContext context) => child;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/glass_bar.dart';
|
import '../../../ui/adaptive/glass_bar.dart';
|
||||||
@@ -200,7 +199,6 @@ class _IconActions extends StatelessWidget {
|
|||||||
key: const Key('artifact-download'),
|
key: const Key('artifact-download'),
|
||||||
label: 'Download',
|
label: 'Download',
|
||||||
icon: Icons.download_outlined,
|
icon: Icons.download_outlined,
|
||||||
cupertinoIcon: CupertinoIcons.arrow_down_to_line,
|
|
||||||
busy: busy,
|
busy: busy,
|
||||||
onPressed: busy ? null : controller.download,
|
onPressed: busy ? null : controller.download,
|
||||||
),
|
),
|
||||||
@@ -209,7 +207,6 @@ class _IconActions extends StatelessWidget {
|
|||||||
key: const Key('artifact-share'),
|
key: const Key('artifact-share'),
|
||||||
label: 'Share',
|
label: 'Share',
|
||||||
icon: Icons.share_outlined,
|
icon: Icons.share_outlined,
|
||||||
cupertinoIcon: CupertinoIcons.share,
|
|
||||||
onPressed: busy ? null : controller.share,
|
onPressed: busy ? null : controller.share,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -223,7 +220,6 @@ class ArtifactIconAction extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.label,
|
required this.label,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.cupertinoIcon,
|
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.busy = false,
|
this.busy = false,
|
||||||
});
|
});
|
||||||
@@ -231,9 +227,6 @@ class ArtifactIconAction extends StatelessWidget {
|
|||||||
final String label;
|
final String label;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
|
||||||
/// Retained for callers that still pass the Cupertino glyph; the Material
|
|
||||||
/// action always draws [icon].
|
|
||||||
final IconData cupertinoIcon;
|
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final bool busy;
|
final bool busy;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ class ArtifactFullscreenScope extends InheritedWidget {
|
|||||||
/// [cupertino] is retained for callers that still pass it; the route is always
|
/// [cupertino] is retained for callers that still pass it; the route is always
|
||||||
/// the Material one.
|
/// the Material one.
|
||||||
Route<void> artifactFullscreenRoute({
|
Route<void> artifactFullscreenRoute({
|
||||||
required bool cupertino,
|
bool? cupertino,
|
||||||
required WidgetBuilder builder,
|
required WidgetBuilder builder,
|
||||||
}) => MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
}) => MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||||
|
|
||||||
@@ -74,7 +73,6 @@ List<Widget> artifactHtmlZoomActions(ValueNotifier<double> zoom) {
|
|||||||
Key key,
|
Key key,
|
||||||
String label,
|
String label,
|
||||||
IconData icon,
|
IconData icon,
|
||||||
IconData cupertinoIcon,
|
|
||||||
VoidCallback? onPressed,
|
VoidCallback? onPressed,
|
||||||
) => SegmentedOverflowAction(
|
) => SegmentedOverflowAction(
|
||||||
key: key,
|
key: key,
|
||||||
@@ -83,12 +81,7 @@ List<Widget> artifactHtmlZoomActions(ValueNotifier<double> zoom) {
|
|||||||
icon: icon,
|
icon: icon,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
),
|
),
|
||||||
child: ArtifactIconAction(
|
child: ArtifactIconAction(label: label, icon: icon, onPressed: onPressed),
|
||||||
label: label,
|
|
||||||
icon: icon,
|
|
||||||
cupertinoIcon: cupertinoIcon,
|
|
||||||
onPressed: onPressed,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
final value = zoom.value;
|
final value = zoom.value;
|
||||||
return [
|
return [
|
||||||
@@ -96,21 +89,18 @@ List<Widget> artifactHtmlZoomActions(ValueNotifier<double> zoom) {
|
|||||||
artifactZoomOutKey,
|
artifactZoomOutKey,
|
||||||
'Zoom out',
|
'Zoom out',
|
||||||
Icons.zoom_out,
|
Icons.zoom_out,
|
||||||
CupertinoIcons.zoom_out,
|
|
||||||
value > artifactHtmlZoomSteps.first + 0.001 ? () => step(-1) : null,
|
value > artifactHtmlZoomSteps.first + 0.001 ? () => step(-1) : null,
|
||||||
),
|
),
|
||||||
action(
|
action(
|
||||||
artifactZoomResetKey,
|
artifactZoomResetKey,
|
||||||
'Actual size ($percent)',
|
'Actual size ($percent)',
|
||||||
Icons.restart_alt,
|
Icons.restart_alt,
|
||||||
CupertinoIcons.arrow_counterclockwise,
|
|
||||||
(value - 1).abs() > 0.001 ? () => zoom.value = 1 : null,
|
(value - 1).abs() > 0.001 ? () => zoom.value = 1 : null,
|
||||||
),
|
),
|
||||||
action(
|
action(
|
||||||
artifactZoomInKey,
|
artifactZoomInKey,
|
||||||
'Zoom in',
|
'Zoom in',
|
||||||
Icons.zoom_in,
|
Icons.zoom_in,
|
||||||
CupertinoIcons.zoom_in,
|
|
||||||
value < artifactHtmlZoomSteps.last - 0.001 ? () => step(1) : null,
|
value < artifactHtmlZoomSteps.last - 0.001 ? () => step(1) : null,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/glass_bar.dart';
|
import '../../../ui/adaptive/glass_bar.dart';
|
||||||
@@ -131,14 +130,12 @@ class ArtifactViewerBar extends StatelessWidget {
|
|||||||
key: const Key('artifact-open'),
|
key: const Key('artifact-open'),
|
||||||
label: 'Open in browser',
|
label: 'Open in browser',
|
||||||
icon: Icons.open_in_new,
|
icon: Icons.open_in_new,
|
||||||
cupertinoIcon: CupertinoIcons.arrow_up_right_square,
|
|
||||||
onPressed: onOpen,
|
onPressed: onOpen,
|
||||||
),
|
),
|
||||||
ArtifactIconAction(
|
ArtifactIconAction(
|
||||||
key: const Key('artifact-copy-link'),
|
key: const Key('artifact-copy-link'),
|
||||||
label: 'Copy link',
|
label: 'Copy link',
|
||||||
icon: Icons.link,
|
icon: Icons.link,
|
||||||
cupertinoIcon: CupertinoIcons.link,
|
|
||||||
onPressed: onCopy,
|
onPressed: onCopy,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -147,9 +144,6 @@ class ArtifactViewerBar extends StatelessWidget {
|
|||||||
key: artifactFullscreenKey,
|
key: artifactFullscreenKey,
|
||||||
label: fullscreen ? 'Exit full screen' : 'Full screen',
|
label: fullscreen ? 'Exit full screen' : 'Full screen',
|
||||||
icon: fullscreen ? Icons.fullscreen_exit : Icons.fullscreen,
|
icon: fullscreen ? Icons.fullscreen_exit : Icons.fullscreen,
|
||||||
cupertinoIcon: fullscreen
|
|
||||||
? CupertinoIcons.fullscreen_exit
|
|
||||||
: CupertinoIcons.fullscreen,
|
|
||||||
onPressed: toggle,
|
onPressed: toggle,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||||
@@ -187,7 +186,6 @@ class ArtifactViewerInfoAction extends StatelessWidget {
|
|||||||
key: const Key('artifact-info'),
|
key: const Key('artifact-info'),
|
||||||
label: 'Details',
|
label: 'Details',
|
||||||
icon: Icons.info_outline,
|
icon: Icons.info_outline,
|
||||||
cupertinoIcon: CupertinoIcons.info,
|
|
||||||
onPressed: () => _show(context),
|
onPressed: () => _show(context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../core/error_reason.dart';
|
import '../../../core/error_reason.dart';
|
||||||
import '../../../ui/adaptive/app_menu_anchor.dart';
|
import '../../../ui/adaptive/app_popups.dart';
|
||||||
import 'chat_bar_control_style.dart';
|
import 'chat_bar_control_style.dart';
|
||||||
import 'chat_efforts.dart';
|
import 'chat_efforts.dart';
|
||||||
import 'chat_models.dart';
|
import 'chat_models.dart';
|
||||||
@@ -92,9 +92,13 @@ class _ChatEffortControlState extends State<ChatEffortControl> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _chooseFromMenu(ChatEffortLevel level) async {
|
Future<void> _chooseFromMenu(ChatEffortLevel level) async {
|
||||||
if (level.id == _state.effort) return;
|
if (level.id == _state.effort || level.id == _state.current) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await _choose(level);
|
await _choose(level);
|
||||||
|
if (mounted) Navigator.of(context).pop();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
ScaffoldMessenger.maybeOf(context)?.showSnackBar(
|
ScaffoldMessenger.maybeOf(context)?.showSnackBar(
|
||||||
@@ -128,57 +132,62 @@ class _ChatEffortControlState extends State<ChatEffortControl> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
const key = Key('chat-effort');
|
const key = Key('chat-effort');
|
||||||
return AppMenuAnchor(
|
return Semantics(
|
||||||
menuChildren: [
|
container: true,
|
||||||
Padding(
|
button: true,
|
||||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 4),
|
label: 'Change thinking level, currently ${_state.currentName}',
|
||||||
child: ConstrainedBox(
|
onTap: _open,
|
||||||
constraints: const BoxConstraints(maxWidth: 280),
|
child: ExcludeSemantics(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Change thinking level (currently ${_state.currentName})',
|
||||||
|
child: TextButton(
|
||||||
|
key: key,
|
||||||
|
style: chatBarTextButtonStyle(context, compact: iconOnly),
|
||||||
|
onPressed: _open,
|
||||||
|
child: content,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _open() async {
|
||||||
|
await showAppChoiceMenu<void>(
|
||||||
|
context,
|
||||||
|
width: 320,
|
||||||
|
semanticLabel: 'Change thinking level',
|
||||||
|
builder: (_) => ListView(
|
||||||
|
key: const Key('chat-effort-menu'),
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||||
child: Text(
|
child: Text(
|
||||||
chatEffortNote(running: widget.running),
|
chatEffortNote(running: widget.running),
|
||||||
key: const Key('chat-effort-note'),
|
key: const Key('chat-effort-note'),
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
for (final level in _state.levels)
|
||||||
for (final level in _state.levels)
|
AppChoiceMenuItem(
|
||||||
MenuItemButton(
|
key: ValueKey<String>('chat-effort-option-${level.id}'),
|
||||||
key: ValueKey<String>('chat-effort-option-${level.id}'),
|
selected: level.id == _state.current,
|
||||||
trailingIcon: level.id == _state.current
|
onTap: () => unawaited(_chooseFromMenu(level)),
|
||||||
? const Icon(Icons.check)
|
child: level.description.isEmpty
|
||||||
: null,
|
? Text(level.name)
|
||||||
onPressed: () => unawaited(_chooseFromMenu(level)),
|
: Column(
|
||||||
child: level.description.isEmpty
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
? Text(level.name)
|
mainAxisSize: MainAxisSize.min,
|
||||||
: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Text(level.name),
|
||||||
mainAxisSize: MainAxisSize.min,
|
Text(
|
||||||
children: [
|
level.description,
|
||||||
Text(level.name),
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
Text(
|
),
|
||||||
level.description,
|
],
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
builder: (context, menu, _) => Semantics(
|
|
||||||
container: true,
|
|
||||||
button: true,
|
|
||||||
label: 'Change thinking level, currently ${_state.currentName}',
|
|
||||||
onTap: () => menu.isOpen ? menu.close() : menu.open(),
|
|
||||||
child: ExcludeSemantics(
|
|
||||||
child: Tooltip(
|
|
||||||
message: 'Change thinking level (currently ${_state.currentName})',
|
|
||||||
child: TextButton(
|
|
||||||
key: key,
|
|
||||||
style: chatBarTextButtonStyle(context),
|
|
||||||
onPressed: () => menu.isOpen ? menu.close() : menu.open(),
|
|
||||||
child: content,
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,17 +249,23 @@ class _ChatModePickerState extends State<_ChatModePicker> {
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
for (final mode in modes)
|
for (final mode in modes)
|
||||||
ListTile(
|
AppChoiceMenuItem(
|
||||||
key: ValueKey<String>('chat-mode-option-${mode.id}'),
|
key: ValueKey<String>('chat-mode-option-${mode.id}'),
|
||||||
enabled: !_busy,
|
selected: mode.id == _current,
|
||||||
title: Text(mode.name),
|
onTap: _busy ? null : () => _choose(mode),
|
||||||
subtitle: mode.description.isEmpty
|
child: mode.description.isEmpty
|
||||||
? null
|
? Text(mode.name)
|
||||||
: Text(mode.description),
|
: Column(
|
||||||
trailing: mode.id == _current
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
? Icon(Icons.check, color: theme.colorScheme.primary)
|
mainAxisSize: MainAxisSize.min,
|
||||||
: null,
|
children: [
|
||||||
onTap: () => _choose(mode),
|
Text(mode.name),
|
||||||
|
Text(
|
||||||
|
mode.description,
|
||||||
|
style: theme.textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../core/error_reason.dart';
|
import '../../../core/error_reason.dart';
|
||||||
|
import '../../../ui/adaptive/app_popups.dart';
|
||||||
import '../data/chat_repository.dart';
|
import '../data/chat_repository.dart';
|
||||||
import 'chat_models.dart';
|
import 'chat_models.dart';
|
||||||
|
|
||||||
@@ -22,7 +23,6 @@ class ChatModelChooser extends StatefulWidget {
|
|||||||
required this.backend,
|
required this.backend,
|
||||||
required this.currentProvider,
|
required this.currentProvider,
|
||||||
required this.currentModel,
|
required this.currentModel,
|
||||||
required this.cupertino,
|
|
||||||
required this.onAccepted,
|
required this.onAccepted,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -31,7 +31,6 @@ class ChatModelChooser extends StatefulWidget {
|
|||||||
final String backend;
|
final String backend;
|
||||||
final String currentProvider;
|
final String currentProvider;
|
||||||
final String currentModel;
|
final String currentModel;
|
||||||
final bool cupertino;
|
|
||||||
final ValueChanged<ChatModelSelection> onAccepted;
|
final ValueChanged<ChatModelSelection> onAccepted;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -92,6 +91,10 @@ class _ChatModelChooserState extends State<ChatModelChooser> {
|
|||||||
|
|
||||||
Future<void> _choose(JsonMap model) async {
|
Future<void> _choose(JsonMap model) async {
|
||||||
if (_busy) return;
|
if (_busy) return;
|
||||||
|
if (_isCurrent(model)) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
_busy = true;
|
_busy = true;
|
||||||
_error = null;
|
_error = null;
|
||||||
@@ -147,95 +150,105 @@ class _ChatModelChooserState extends State<ChatModelChooser> {
|
|||||||
final secondary = theme.colorScheme.onSurfaceVariant;
|
final secondary = theme.colorScheme.onSurfaceVariant;
|
||||||
final matches = filterChatModels(_models, _search.text);
|
final matches = filterChatModels(_models, _search.text);
|
||||||
final needle = _search.text.trim();
|
final needle = _search.text.trim();
|
||||||
return SimpleDialog(
|
return SafeArea(
|
||||||
key: const Key('chat-model-chooser'),
|
child: SingleChildScrollView(
|
||||||
title: const Text('Change model'),
|
key: const Key('chat-model-chooser'),
|
||||||
children: [
|
child: Column(
|
||||||
Padding(
|
mainAxisSize: MainAxisSize.min,
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
children: [
|
||||||
child: Text(
|
const Padding(
|
||||||
chatModelSelectionNote(widget.backend),
|
padding: EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||||
style: theme.textTheme.bodySmall?.copyWith(color: secondary),
|
child: Text('Change model'),
|
||||||
),
|
|
||||||
),
|
|
||||||
if (_loading)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 8, 24, 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const CircularProgressIndicator(),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
const Expanded(child: Text('Loading models…')),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
|
||||||
else if (_error != null)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
|
||||||
child: Text(
|
|
||||||
_error!,
|
|
||||||
key: const Key('chat-model-error'),
|
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(
|
|
||||||
color: theme.colorScheme.error,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else if (_models.isEmpty)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
|
||||||
child: Text(
|
|
||||||
'No models are available for this chat.',
|
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(color: secondary),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else ...[
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
|
||||||
child: TextField(
|
|
||||||
key: const Key('chat-model-search'),
|
|
||||||
controller: _search,
|
|
||||||
onChanged: (_) => setState(() {}),
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
prefixIcon: Icon(Icons.search),
|
|
||||||
hintText: 'Search models',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
for (final model in matches)
|
|
||||||
SimpleDialogOption(
|
|
||||||
key: _optionKey(model),
|
|
||||||
onPressed: _busy ? null : () => _choose(model),
|
|
||||||
child: _optionRow(context, model),
|
|
||||||
),
|
|
||||||
if (matches.isEmpty && needle.isNotEmpty)
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||||
child: Text(
|
child: Text(
|
||||||
'No models match "$needle".',
|
chatModelSelectionNote(widget.backend),
|
||||||
key: const Key('chat-model-no-match'),
|
style: theme.textTheme.bodySmall?.copyWith(color: secondary),
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(color: secondary),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
if (_loading)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 8),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 8),
|
||||||
child: Align(
|
child: Row(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
children: [
|
||||||
child: TextButton(
|
const CircularProgressIndicator(),
|
||||||
key: const Key('chat-model-cancel'),
|
const SizedBox(width: 12),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
const Expanded(child: Text('Loading models…')),
|
||||||
child: const Text('Cancel'),
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_error != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||||
|
child: Text(
|
||||||
|
_error!,
|
||||||
|
key: const Key('chat-model-error'),
|
||||||
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: theme.colorScheme.error,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_models.isEmpty)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||||
|
child: Text(
|
||||||
|
'No models are available for this chat.',
|
||||||
|
style: theme.textTheme.bodyMedium?.copyWith(color: secondary),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else ...[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||||
|
child: TextField(
|
||||||
|
key: const Key('chat-model-search'),
|
||||||
|
controller: _search,
|
||||||
|
onChanged: (_) => setState(() {}),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
prefixIcon: Icon(Icons.search),
|
||||||
|
hintText: 'Search models',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
for (final model in matches)
|
||||||
|
AppChoiceMenuItem(
|
||||||
|
key: _optionKey(model),
|
||||||
|
selected: _isCurrent(model),
|
||||||
|
onTap: _busy ? null : () => _choose(model),
|
||||||
|
child: _optionRow(context, model),
|
||||||
|
),
|
||||||
|
if (matches.isEmpty && needle.isNotEmpty)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||||
|
child: Text(
|
||||||
|
'No models match "$needle".',
|
||||||
|
key: const Key('chat-model-no-match'),
|
||||||
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: secondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 8),
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
|
child: TextButton(
|
||||||
|
key: const Key('chat-model-cancel'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('Cancel'),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _optionRow(BuildContext context, JsonMap model) {
|
Widget _optionRow(BuildContext context, JsonMap model) {
|
||||||
final selected = _isCurrent(model);
|
final selected = _isCurrent(model);
|
||||||
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||||
final accent = Theme.of(context).colorScheme.primary;
|
|
||||||
final provider = '${model['provider'] ?? ''}'.trim();
|
final provider = '${model['provider'] ?? ''}'.trim();
|
||||||
return Semantics(
|
return Semantics(
|
||||||
selected: selected,
|
selected: selected,
|
||||||
@@ -252,7 +265,7 @@ class _ChatModelChooserState extends State<ChatModelChooser> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (selected) Icon(Icons.check, color: accent),
|
// The shared menu row supplies the check mark.
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
|
import '../../../ui/adaptive/app_popups.dart';
|
||||||
import 'chat_bar_control_style.dart';
|
import 'chat_bar_control_style.dart';
|
||||||
import 'chat_model_chooser.dart';
|
import 'chat_model_chooser.dart';
|
||||||
import 'chat_models.dart';
|
import 'chat_models.dart';
|
||||||
@@ -79,10 +80,14 @@ class _ChatModelControlState extends State<ChatModelControl> {
|
|||||||
backend: '${widget.session['backend'] ?? ''}'.trim(),
|
backend: '${widget.session['backend'] ?? ''}'.trim(),
|
||||||
currentProvider: _provider,
|
currentProvider: _provider,
|
||||||
currentModel: _model,
|
currentModel: _model,
|
||||||
cupertino: false,
|
|
||||||
onAccepted: _accept,
|
onAccepted: _accept,
|
||||||
);
|
);
|
||||||
await showDialog<void>(context: context, builder: (_) => chooser);
|
await showAppChoiceMenu<void>(
|
||||||
|
context,
|
||||||
|
width: 420,
|
||||||
|
semanticLabel: 'Change model',
|
||||||
|
builder: (_) => chooser,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _accept(ChatModelSelection applied) {
|
void _accept(ChatModelSelection applied) {
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ class ChatWindows {
|
|||||||
if (event is KeyDownEvent) tiling.floatActive();
|
if (event is KeyDownEvent) tiling.floatActive();
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
}
|
}
|
||||||
if (event is KeyDownEvent) manager.toggleGroup(chatWindowKind);
|
if (event is KeyDownEvent) manager.toggleOrRaiseGroup(chatWindowKind);
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import '../../../ui/input/keyboard_owner.dart';
|
|
||||||
|
|
||||||
/// Whether [event] shows or hides the floating chats: Alt+Y (Option+Y),
|
/// Whether [event] shows or hides the floating chats: Alt+Y (Option+Y),
|
||||||
/// Ctrl+Y, and Cmd+Y on Apple platforms, matching the terminal's Alt+T. It is
|
/// Ctrl+Y, and Cmd+Y on Apple platforms, matching the terminal's Alt+T. It is
|
||||||
/// a global key handler like the terminal's toggle, so it works while a
|
/// a global key handler like the terminal's toggle, so it works while a
|
||||||
/// composer or the terminal has the keyboard; a plain Y (or Shift+Y) always
|
/// composer or the terminal has the keyboard; a plain Y (or Shift+Y) always
|
||||||
/// types. Alt+Y is always the chord, as Alt+T is for the terminal. On Apple
|
/// types. Alt+Y is always the chord, as Alt+T is for the terminal. On Apple
|
||||||
/// platforms Ctrl+Y inside a terminal is left to the shell (yank), since Cmd+Y
|
/// platforms Ctrl+Y is also the chord, so it takes priority over the shell's
|
||||||
/// is there; elsewhere Ctrl+Y is the chord, so it takes priority over the
|
/// yank.
|
||||||
/// shell's yank.
|
|
||||||
///
|
///
|
||||||
/// A held chord's repeats match too (and are swallowed); only its first
|
/// A held chord's repeats match too (and are swallowed); only its first
|
||||||
/// press toggles.
|
/// press toggles.
|
||||||
@@ -31,7 +28,7 @@ bool chatFloatShortcut(
|
|||||||
if (alt) return !control && !meta;
|
if (alt) return !control && !meta;
|
||||||
if (control == meta) return false;
|
if (control == meta) return false;
|
||||||
if (!_apple(platform ?? defaultTargetPlatform)) return control;
|
if (!_apple(platform ?? defaultTargetPlatform)) return control;
|
||||||
return meta || !primaryFocusIsTypingSurface();
|
return control || meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _apple(TargetPlatform platform) =>
|
bool _apple(TargetPlatform platform) =>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../ui/input/app_search_field.dart';
|
import '../../../../ui/input/app_search_field.dart';
|
||||||
@@ -19,20 +18,19 @@ class ScheduleRefreshAction extends StatelessWidget {
|
|||||||
const ScheduleRefreshAction({
|
const ScheduleRefreshAction({
|
||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
required this.cupertino,
|
this.cupertino,
|
||||||
required this.onRefresh,
|
required this.onRefresh,
|
||||||
});
|
});
|
||||||
|
|
||||||
final SchedulesController controller;
|
final SchedulesController controller;
|
||||||
final bool cupertino;
|
final bool? cupertino;
|
||||||
final VoidCallback onRefresh;
|
final VoidCallback onRefresh;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => BarIconButton(
|
Widget build(BuildContext context) => BarIconButton(
|
||||||
key: controller.isLoading ? null : scheduleRefreshKey,
|
key: controller.isLoading ? null : scheduleRefreshKey,
|
||||||
cupertino: false,
|
|
||||||
icon: Icons.refresh,
|
icon: Icons.refresh,
|
||||||
cupertinoIcon: CupertinoIcons.refresh,
|
cupertinoIcon: Icons.refresh,
|
||||||
label: 'Refresh schedules',
|
label: 'Refresh schedules',
|
||||||
busy: controller.isLoading,
|
busy: controller.isLoading,
|
||||||
busyLabel: 'Refreshing schedules',
|
busyLabel: 'Refreshing schedules',
|
||||||
@@ -51,13 +49,13 @@ class ScheduleListToolbar extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
required this.searchController,
|
required this.searchController,
|
||||||
required this.cupertino,
|
this.cupertino,
|
||||||
this.onRefresh,
|
this.onRefresh,
|
||||||
});
|
});
|
||||||
|
|
||||||
final SchedulesController controller;
|
final SchedulesController controller;
|
||||||
final TextEditingController searchController;
|
final TextEditingController searchController;
|
||||||
final bool cupertino;
|
final bool? cupertino;
|
||||||
final VoidCallback? onRefresh;
|
final VoidCallback? onRefresh;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -69,7 +67,6 @@ class ScheduleListToolbar extends StatelessWidget {
|
|||||||
final refresh = switch (onRefresh) {
|
final refresh = switch (onRefresh) {
|
||||||
final refresh? => ScheduleRefreshAction(
|
final refresh? => ScheduleRefreshAction(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
cupertino: false,
|
|
||||||
onRefresh: refresh,
|
onRefresh: refresh,
|
||||||
),
|
),
|
||||||
null => null,
|
null => null,
|
||||||
@@ -119,7 +116,6 @@ class ScheduleListToolbar extends StatelessWidget {
|
|||||||
Widget _search(BuildContext context) => AppSearchField(
|
Widget _search(BuildContext context) => AppSearchField(
|
||||||
fieldKey: scheduleSearchFieldKey,
|
fieldKey: scheduleSearchFieldKey,
|
||||||
controller: searchController,
|
controller: searchController,
|
||||||
cupertino: false,
|
|
||||||
placeholder: 'Search schedules',
|
placeholder: 'Search schedules',
|
||||||
onChanged: controller.setQuery,
|
onChanged: controller.setQuery,
|
||||||
onCleared: controller.clearQuery,
|
onCleared: controller.clearQuery,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/input/app_search_field.dart';
|
import '../../../ui/input/app_search_field.dart';
|
||||||
@@ -21,7 +20,7 @@ const searchTokenHint =
|
|||||||
class SearchBarControls extends StatelessWidget {
|
class SearchBarControls extends StatelessWidget {
|
||||||
const SearchBarControls({
|
const SearchBarControls({
|
||||||
super.key,
|
super.key,
|
||||||
required this.cupertino,
|
this.cupertino,
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.kind,
|
required this.kind,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
@@ -32,7 +31,7 @@ class SearchBarControls extends StatelessWidget {
|
|||||||
this.focusNode,
|
this.focusNode,
|
||||||
});
|
});
|
||||||
|
|
||||||
final bool cupertino;
|
final bool? cupertino;
|
||||||
final TextEditingController text;
|
final TextEditingController text;
|
||||||
final SearchKind kind;
|
final SearchKind kind;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
@@ -59,7 +58,6 @@ class SearchBarControls extends StatelessWidget {
|
|||||||
autofocus: autofocus,
|
autofocus: autofocus,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
inBar: true,
|
inBar: true,
|
||||||
cupertino: false,
|
|
||||||
placeholder: 'Search pipelines, runs, artifacts and chats',
|
placeholder: 'Search pipelines, runs, artifacts and chats',
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
onSubmitted: (_) => onSubmitted(),
|
onSubmitted: (_) => onSubmitted(),
|
||||||
@@ -67,14 +65,13 @@ class SearchBarControls extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SearchKindButton(cupertino: false, kind: kind, onSelected: onKind),
|
SearchKindButton(kind: kind, onSelected: onKind),
|
||||||
BarIconButton(
|
BarIconButton(
|
||||||
key: searchHelpKey,
|
key: searchHelpKey,
|
||||||
cupertino: false,
|
|
||||||
icon: Icons.info_outline,
|
icon: Icons.info_outline,
|
||||||
cupertinoIcon: CupertinoIcons.info_circle,
|
cupertinoIcon: Icons.info_outline,
|
||||||
label: 'Search syntax',
|
label: 'Search syntax',
|
||||||
onPressed: () => showSearchHelp(context, cupertino: false),
|
onPressed: () => showSearchHelp(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -86,12 +83,12 @@ class SearchBarControls extends StatelessWidget {
|
|||||||
class SearchKindButton extends StatelessWidget {
|
class SearchKindButton extends StatelessWidget {
|
||||||
const SearchKindButton({
|
const SearchKindButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.cupertino,
|
this.cupertino,
|
||||||
required this.kind,
|
required this.kind,
|
||||||
required this.onSelected,
|
required this.onSelected,
|
||||||
});
|
});
|
||||||
|
|
||||||
final bool cupertino;
|
final bool? cupertino;
|
||||||
final SearchKind kind;
|
final SearchKind kind;
|
||||||
final ValueChanged<SearchKind> onSelected;
|
final ValueChanged<SearchKind> onSelected;
|
||||||
|
|
||||||
@@ -131,7 +128,7 @@ class SearchKindButton extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The query syntax, on demand instead of a paragraph above the results.
|
/// The query syntax, on demand instead of a paragraph above the results.
|
||||||
Future<void> showSearchHelp(BuildContext context, {required bool cupertino}) {
|
Future<void> showSearchHelp(BuildContext context, {bool? cupertino}) {
|
||||||
return showDialog<void>(
|
return showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../shell/shell_bar.dart';
|
import '../../../shell/shell_bar.dart';
|
||||||
@@ -88,7 +87,7 @@ class TemplatesFrame extends StatelessWidget {
|
|||||||
key: templatesRefreshKey,
|
key: templatesRefreshKey,
|
||||||
cupertino: false,
|
cupertino: false,
|
||||||
icon: Icons.refresh,
|
icon: Icons.refresh,
|
||||||
cupertinoIcon: CupertinoIcons.refresh,
|
cupertinoIcon: Icons.refresh,
|
||||||
label: 'Refresh',
|
label: 'Refresh',
|
||||||
onPressed: refreshing ? null : onRefresh,
|
onPressed: refreshing ? null : onRefresh,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ class AdaptiveShell extends StatefulWidget {
|
|||||||
|
|
||||||
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
||||||
|
|
||||||
/// Retained for callers that still pass it; the shell always draws the
|
/// Retained for callers that still pass it; the shell always draws Material.
|
||||||
/// Material controls and scaffold whether this is set or not.
|
|
||||||
final bool cupertino;
|
final bool cupertino;
|
||||||
|
|
||||||
/// The destination a route owner selected. When null the shell keeps its own
|
/// The destination a route owner selected. When null the shell keeps its own
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class AttentionDestinationIcon extends StatelessWidget {
|
|||||||
const AttentionDestinationIcon({
|
const AttentionDestinationIcon({
|
||||||
super.key,
|
super.key,
|
||||||
required this.count,
|
required this.count,
|
||||||
required this.cupertino,
|
this.cupertino = false,
|
||||||
required this.child,
|
required this.child,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class ActivityBadge extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.count,
|
required this.count,
|
||||||
required this.label,
|
required this.label,
|
||||||
required this.cupertino,
|
this.cupertino = false,
|
||||||
required this.child,
|
required this.child,
|
||||||
this.bottom = false,
|
this.bottom = false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
enum AppDestination { pipelines, runs, chat, search, settings }
|
enum AppDestination { pipelines, runs, chat, search, settings }
|
||||||
@@ -22,34 +21,32 @@ AppDestination shellTabFor(AppDestination destination) =>
|
|||||||
|
|
||||||
/// The label and icons for [value].
|
/// 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(
|
({String label, IconData icon, IconData cupertinoIcon}) destinationDetails(
|
||||||
AppDestination value,
|
AppDestination value,
|
||||||
) => switch (value) {
|
) => switch (value) {
|
||||||
AppDestination.pipelines => (
|
AppDestination.pipelines => (
|
||||||
label: 'Pipelines',
|
label: 'Pipelines',
|
||||||
icon: Icons.account_tree_outlined,
|
icon: Icons.account_tree_outlined,
|
||||||
cupertinoIcon: CupertinoIcons.arrow_branch,
|
cupertinoIcon: Icons.account_tree_outlined,
|
||||||
),
|
),
|
||||||
AppDestination.runs => (
|
AppDestination.runs => (
|
||||||
label: 'Runs',
|
label: 'Runs',
|
||||||
icon: Icons.play_circle_outline,
|
icon: Icons.play_circle_outline,
|
||||||
cupertinoIcon: CupertinoIcons.play_circle,
|
cupertinoIcon: Icons.play_circle_outline,
|
||||||
),
|
),
|
||||||
AppDestination.chat => (
|
AppDestination.chat => (
|
||||||
label: 'Chat',
|
label: 'Chat',
|
||||||
icon: Icons.chat_bubble_outline,
|
icon: Icons.chat_bubble_outline,
|
||||||
cupertinoIcon: CupertinoIcons.chat_bubble_2,
|
cupertinoIcon: Icons.chat_bubble_outline,
|
||||||
),
|
),
|
||||||
AppDestination.search => (
|
AppDestination.search => (
|
||||||
label: 'Search',
|
label: 'Search',
|
||||||
icon: Icons.search,
|
icon: Icons.search,
|
||||||
cupertinoIcon: CupertinoIcons.search,
|
cupertinoIcon: Icons.search,
|
||||||
),
|
),
|
||||||
AppDestination.settings => (
|
AppDestination.settings => (
|
||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
icon: Icons.settings_outlined,
|
icon: Icons.settings_outlined,
|
||||||
cupertinoIcon: CupertinoIcons.gear,
|
cupertinoIcon: Icons.settings_outlined,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -289,6 +289,20 @@ class WindowManager extends ChangeNotifier {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Hides the group when it is active; otherwise shows and raises its most
|
||||||
|
/// recently used window. A global shortcut should bring a group forward when
|
||||||
|
/// pressed from another window, rather than hide it behind that window.
|
||||||
|
bool toggleOrRaiseGroup(String groupId) {
|
||||||
|
final group = inGroup(groupId).toList();
|
||||||
|
if (group.isEmpty) return false;
|
||||||
|
if (group.any(isVisible) && active?.groupId == groupId) {
|
||||||
|
setGroupShown(groupId, false);
|
||||||
|
} else {
|
||||||
|
show(group.last.id);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// Brings the next ([step] 1) or previous (-1) visible window to the top.
|
/// Brings the next ([step] 1) or previous (-1) visible window to the top.
|
||||||
void cycle([int step = 1]) {
|
void cycle([int step = 1]) {
|
||||||
final visible = windows.where(isVisible).toList();
|
final visible = windows.where(isVisible).toList();
|
||||||
|
|||||||
@@ -57,6 +57,31 @@ Future<T?> showAppChoiceMenu<T>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A choice row shared by the app's anchored choice menus. Keeping the row
|
||||||
|
/// here makes checked state and tap affordances consistent across selectors.
|
||||||
|
class AppChoiceMenuItem extends StatelessWidget {
|
||||||
|
const AppChoiceMenuItem({
|
||||||
|
super.key,
|
||||||
|
required this.child,
|
||||||
|
required this.selected,
|
||||||
|
required this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
final Widget child;
|
||||||
|
final bool selected;
|
||||||
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => ListTile(
|
||||||
|
enabled: onTap != null,
|
||||||
|
title: child,
|
||||||
|
trailing: selected
|
||||||
|
? Icon(Icons.check, color: Theme.of(context).colorScheme.primary)
|
||||||
|
: null,
|
||||||
|
onTap: onTap,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Shows richer content (a chat's details, a file's details) built by
|
/// Shows richer content (a chat's details, a file's details) built by
|
||||||
/// [builder]: a dialog on a wide app, a bottom sheet on a phone, on the root
|
/// [builder]: a dialog on a wide app, a bottom sheet on a phone, on the root
|
||||||
/// navigator either way. The content sizes itself (a `Column` with
|
/// navigator either way. The content sizes itself (a `Column` with
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Chat selector menu unification
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
Model and thinking-level controls now use the same `showAppChoiceMenu` root
|
||||||
|
popup/bottom-sheet primitive and shared `AppChoiceMenuItem` rows as the
|
||||||
|
permission-mode selector. Their catalog/search, loading, next-turn, server
|
||||||
|
echo, refusal, retry and dismissal behavior remain in their respective
|
||||||
|
controls. The model chooser's obsolete Cupertino parameter was removed.
|
||||||
|
|
||||||
|
## Checks
|
||||||
|
|
||||||
|
- `tool/memwatch/full.sh 'test/features/chat/conversation/chat_mode_control_test.dart test/features/chat/conversation/chat_model_picker_test.dart test/features/chat/conversation/chat_effort_control_test.dart test/features/chat/conversation/chat_effort_header_test.dart'`
|
||||||
|
— 29 passed, 0 failed, including the current-model dismissal regression.
|
||||||
|
- `tool/analyze.sh` — clean.
|
||||||
|
|
||||||
|
Browser captures were not performed in this implementation stage; UI review
|
||||||
|
owns the requested full-app captures.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Chat terminal shortcut focus
|
||||||
|
|
||||||
|
Implemented the macOS Ctrl+Y floating-chat handoff. A chat shortcut now hides
|
||||||
|
the chat group only when chat is already the active window; from another
|
||||||
|
window it raises the most recently used chat. The existing window-host
|
||||||
|
post-frame lifecycle then focuses that chat's composer. Ctrl+Y now joins the
|
||||||
|
existing Option+Y and Cmd+Y aliases on Apple platforms; plain Y and repeat
|
||||||
|
events remain untouched.
|
||||||
|
|
||||||
|
Evidence:
|
||||||
|
|
||||||
|
- `tool/memwatch/full.sh 'test/features/chat/windows/chat_windows_test.dart test/features/chat/workspace/chat_float_shortcut_test.dart test/features/chat/chat_floating_pane_test.dart test/shell/windows/window_manager_test.dart'`
|
||||||
|
— PASS: 33 passed, 0 failed, 0 skipped; peak 1236 MB; 14s.
|
||||||
|
- `tool/analyze.sh` — clean; exit 0.
|
||||||
|
- The floating-pane regression uses a terminal-like `TypingSurface`, presses
|
||||||
|
macOS Ctrl+Y, verifies the chat composer has primary focus, types
|
||||||
|
`from terminal` without a click, and verifies the terminal did not receive
|
||||||
|
Y. The manager regression covers visible-behind-terminal, hidden, multiple
|
||||||
|
chats, and repeated toggles.
|
||||||
|
|
||||||
|
No browser fixture was run in this implementation stage; browser terminal
|
||||||
|
fixture support and full-app rendered evidence remain for the appropriate
|
||||||
|
review stage.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Material-only feature surface cleanup
|
||||||
|
|
||||||
|
- Removed Cupertino imports and alternate glyph metadata from artifact viewer
|
||||||
|
actions, fullscreen zoom controls, and viewer controls.
|
||||||
|
- Made search, schedule-toolbar, and artifact fullscreen compatibility flags
|
||||||
|
optional and ignored while retaining shared adaptive API arguments required
|
||||||
|
by other lanes. Material icons are used for those required compatibility
|
||||||
|
glyph parameters.
|
||||||
|
- Focused checks: `tool/memwatch/full.sh` ran artifact actions/fullscreen and
|
||||||
|
controls, search bar layout, schedule refresh, and template layout tests: 30
|
||||||
|
passed, 0 failed.
|
||||||
|
- `tool/analyze.sh`: clean.
|
||||||
|
- No rendered behavior was intentionally changed; controls remain the existing
|
||||||
|
Material widgets and layouts.
|
||||||
|
- Remaining shared compatibility metadata/flags are outside this focused edit
|
||||||
|
and should be removed only after all callers migrate during final integration.
|
||||||
@@ -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(
|
PipelinesApp(
|
||||||
server: webServer(),
|
server: webServer(),
|
||||||
client: client,
|
client: client,
|
||||||
|
// Navigation fixtures do not exercise native update plugins.
|
||||||
|
androidSupported: false,
|
||||||
cupertino: false,
|
cupertino: false,
|
||||||
routeInformationProvider: provider,
|
routeInformationProvider: provider,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ Future<void> pumpApp(
|
|||||||
PipelinesApp(
|
PipelinesApp(
|
||||||
server: webServer(),
|
server: webServer(),
|
||||||
client: client,
|
client: client,
|
||||||
|
// This fixture tests template routing, not native update plugins.
|
||||||
|
androidSupported: false,
|
||||||
cupertino: false,
|
cupertino: false,
|
||||||
routeInformationProvider: provider,
|
routeInformationProvider: provider,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import 'package:pipelines_app/shell/windows/window_host.dart';
|
|||||||
import 'package:pipelines_app/shell/windows/window_kind.dart';
|
import 'package:pipelines_app/shell/windows/window_kind.dart';
|
||||||
import 'package:pipelines_app/shell/windows/window_manager.dart';
|
import 'package:pipelines_app/shell/windows/window_manager.dart';
|
||||||
import 'package:pipelines_app/shell/windows/window_store.dart';
|
import 'package:pipelines_app/shell/windows/window_store.dart';
|
||||||
|
import 'package:pipelines_app/shell/windows/window_entry.dart';
|
||||||
import 'package:pipelines_app/ui/motion/fade_through_stack.dart';
|
import 'package:pipelines_app/ui/motion/fade_through_stack.dart';
|
||||||
|
import 'package:pipelines_app/ui/input/keyboard_owner.dart';
|
||||||
|
|
||||||
import 'conversation/chat_thread_fixtures.dart';
|
import 'conversation/chat_thread_fixtures.dart';
|
||||||
|
|
||||||
@@ -46,6 +48,19 @@ class _Store implements WindowStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _TerminalKind extends WindowKind {
|
||||||
|
@override
|
||||||
|
String get key => 'terminal';
|
||||||
|
@override
|
||||||
|
bool get serverScoped => false;
|
||||||
|
@override
|
||||||
|
IconData get icon => Icons.terminal;
|
||||||
|
@override
|
||||||
|
String title(BuildContext context, WindowEntry entry) => entry.contentId;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WindowEntry entry) => const SizedBox();
|
||||||
|
}
|
||||||
|
|
||||||
Finder _thread(String id) => find.byWidgetPredicate(
|
Finder _thread(String id) => find.byWidgetPredicate(
|
||||||
(widget) => widget is ChatThreadView && widget.sessionId == id,
|
(widget) => widget is ChatThreadView && widget.sessionId == id,
|
||||||
skipOffstage: false,
|
skipOffstage: false,
|
||||||
@@ -83,21 +98,21 @@ class _App {
|
|||||||
late final ChatRuntime runtime;
|
late final ChatRuntime runtime;
|
||||||
late final WindowManager manager;
|
late final WindowManager manager;
|
||||||
late final ChatWindows windows;
|
late final ChatWindows windows;
|
||||||
|
final terminalFocus = FocusNode(debugLabel: 'test terminal');
|
||||||
|
final terminalTyped = <LogicalKeyboardKey>[];
|
||||||
|
|
||||||
Future<void> start(
|
Future<void> start(
|
||||||
WidgetTester tester, {
|
WidgetTester tester, {
|
||||||
Size size = const Size(1800, 1000),
|
Size size = const Size(1800, 1000),
|
||||||
|
bool terminalSurface = false,
|
||||||
}) async {
|
}) async {
|
||||||
tester.view.physicalSize = size;
|
tester.view.physicalSize = size;
|
||||||
tester.view.devicePixelRatio = 1;
|
tester.view.devicePixelRatio = 1;
|
||||||
addTearDown(tester.view.reset);
|
addTearDown(tester.view.reset);
|
||||||
bindServerIdentity(gateway, 'server-a');
|
bindServerIdentity(gateway, 'server-a');
|
||||||
runtime = ChatRuntime(gateway: gateway, serverKey: 'server-a');
|
runtime = ChatRuntime(gateway: gateway, serverKey: 'server-a');
|
||||||
manager = WindowManager(
|
final kinds = WindowKinds()..register(_TerminalKind());
|
||||||
kinds: WindowKinds(),
|
manager = WindowManager(kinds: kinds, store: store, server: 'server-a');
|
||||||
store: store,
|
|
||||||
server: 'server-a',
|
|
||||||
);
|
|
||||||
windows = ChatWindows(
|
windows = ChatWindows(
|
||||||
manager: manager,
|
manager: manager,
|
||||||
runtime: runtime,
|
runtime: runtime,
|
||||||
@@ -131,6 +146,21 @@ class _App {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (terminalSurface)
|
||||||
|
Positioned.fill(
|
||||||
|
child: TypingSurface(
|
||||||
|
child: Focus(
|
||||||
|
focusNode: terminalFocus,
|
||||||
|
onKeyEvent: (node, event) {
|
||||||
|
if (event is KeyDownEvent) {
|
||||||
|
terminalTyped.add(event.logicalKey);
|
||||||
|
}
|
||||||
|
return KeyEventResult.handled;
|
||||||
|
},
|
||||||
|
child: const SizedBox(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Positioned.fill(child: WindowHost(manager: manager)),
|
Positioned.fill(child: WindowHost(manager: manager)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -147,6 +177,7 @@ class _App {
|
|||||||
manager.dispose();
|
manager.dispose();
|
||||||
destination.dispose();
|
destination.dispose();
|
||||||
chatBuilt.dispose();
|
chatBuilt.dispose();
|
||||||
|
terminalFocus.dispose();
|
||||||
gateway.close();
|
gateway.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +218,13 @@ Future<void> _chord(WidgetTester tester) async {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _controlChord(WidgetTester tester) async {
|
||||||
|
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
|
||||||
|
await tester.sendKeyEvent(LogicalKeyboardKey.keyY);
|
||||||
|
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Float and Dock move the live chat with its draft', (
|
testWidgets('Float and Dock move the live chat with its draft', (
|
||||||
tester,
|
tester,
|
||||||
@@ -391,6 +429,36 @@ void main() {
|
|||||||
await app.stop(tester);
|
await app.stop(tester);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets(
|
||||||
|
'Ctrl+Y from a terminal raises chat and focuses its composer',
|
||||||
|
(tester) async {
|
||||||
|
await _saved('a', 'b');
|
||||||
|
final app = _App(_Store());
|
||||||
|
await app.start(tester, terminalSurface: true);
|
||||||
|
await _menu(tester, 'b', 'Float (Option+Y)');
|
||||||
|
app.manager.open('terminal', 'terminal');
|
||||||
|
app.terminalFocus.requestFocus();
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
|
await _controlChord(tester);
|
||||||
|
final input = _input('b');
|
||||||
|
expect(_shown('Chat b'), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
tester.widget<EditableText>(input).focusNode.hasPrimaryFocus,
|
||||||
|
isTrue,
|
||||||
|
);
|
||||||
|
tester.testTextInput.enterText('from terminal');
|
||||||
|
await tester.pump();
|
||||||
|
expect(
|
||||||
|
tester.widget<EditableText>(input).controller.text,
|
||||||
|
'from terminal',
|
||||||
|
);
|
||||||
|
expect(app.terminalTyped, isEmpty);
|
||||||
|
await app.stop(tester);
|
||||||
|
},
|
||||||
|
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('floating chats saved by an older build come back as windows', (
|
testWidgets('floating chats saved by an older build come back as windows', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -135,6 +135,20 @@ void main() {
|
|||||||
expect(find.text('model-b'), findsOneWidget);
|
expect(find.text('model-b'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('choosing the current model only dismisses the chooser', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
final gateway = _ModelGateway()..modelsReply = _catalog;
|
||||||
|
await _openThread(tester, gateway);
|
||||||
|
await _openChooser(tester);
|
||||||
|
|
||||||
|
await tester.tap(find.text('Model Alpha'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(find.byKey(const Key('chat-model-chooser')), findsNothing);
|
||||||
|
expect(gateway.lastFields('chat_model'), isNull);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('a refusal keeps the previous model and shows the reason', (
|
testWidgets('a refusal keeps the previous model and shows the reason', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'on macOS Ctrl+Y in a terminal stays with it; Cmd+Y and Option+Y toggle',
|
'on macOS Ctrl+Y from a terminal raises chat; Cmd+Y and Option+Y toggle',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
await wide(tester);
|
await wide(tester);
|
||||||
final typing = FocusNode();
|
final typing = FocusNode();
|
||||||
@@ -256,12 +256,12 @@ void main() {
|
|||||||
typing.requestFocus();
|
typing.requestFocus();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await _chord(tester, LogicalKeyboardKey.controlLeft);
|
await _chord(tester, LogicalKeyboardKey.controlLeft);
|
||||||
expect(h.manager.groupShown(chatWindowKind), isTrue);
|
|
||||||
expect(typed, contains(LogicalKeyboardKey.keyY));
|
|
||||||
await _chord(tester, LogicalKeyboardKey.metaLeft);
|
|
||||||
expect(h.manager.groupShown(chatWindowKind), isFalse);
|
expect(h.manager.groupShown(chatWindowKind), isFalse);
|
||||||
await _chord(tester);
|
expect(typed, isNot(contains(LogicalKeyboardKey.keyY)));
|
||||||
|
await _chord(tester, LogicalKeyboardKey.metaLeft);
|
||||||
expect(h.manager.groupShown(chatWindowKind), isTrue);
|
expect(h.manager.groupShown(chatWindowKind), isTrue);
|
||||||
|
await _chord(tester);
|
||||||
|
expect(h.manager.groupShown(chatWindowKind), isFalse);
|
||||||
},
|
},
|
||||||
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
|
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ void main() {
|
|||||||
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.linux),
|
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.linux),
|
||||||
isTrue,
|
isTrue,
|
||||||
);
|
);
|
||||||
|
expect(
|
||||||
|
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.macOS),
|
||||||
|
isTrue,
|
||||||
|
);
|
||||||
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.linux), isFalse);
|
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.linux), isFalse);
|
||||||
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.macOS), isTrue);
|
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.macOS), isTrue);
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@@ -139,6 +139,25 @@ void main() {
|
|||||||
expect(manager.groupShown('chat'), isTrue);
|
expect(manager.groupShown('chat'), isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('toggleOrRaiseGroup brings a visible group over another window', () {
|
||||||
|
final a = manager.open('chat', 'a');
|
||||||
|
manager.open('chat', 'b');
|
||||||
|
final terminal = manager.open('terminal', 'terminal');
|
||||||
|
|
||||||
|
expect(manager.active?.id, terminal.id);
|
||||||
|
expect(manager.toggleOrRaiseGroup('chat'), isTrue);
|
||||||
|
expect(manager.active?.contentId, 'b');
|
||||||
|
expect(manager.groupShown('chat'), isTrue);
|
||||||
|
|
||||||
|
expect(manager.toggleOrRaiseGroup('chat'), isTrue);
|
||||||
|
expect(manager.groupShown('chat'), isFalse);
|
||||||
|
expect(manager.active?.contentId, 'terminal');
|
||||||
|
|
||||||
|
expect(manager.toggleOrRaiseGroup('chat'), isTrue);
|
||||||
|
expect(manager.active?.contentId, 'b');
|
||||||
|
expect(manager.byId(a.id), isNotNull);
|
||||||
|
});
|
||||||
|
|
||||||
test('close remembers the frame for the content and tells the kind', () {
|
test('close remembers the frame for the content and tells the kind', () {
|
||||||
final a = manager.open('chat', 'a');
|
final a = manager.open('chat', 'a');
|
||||||
manager.setFrame(a.id, const Rect.fromLTWH(300, 200, 500, 400));
|
manager.setFrame(a.id, const Rect.fromLTWH(300, 200, 500, 400));
|
||||||
|
|||||||
Reference in New Issue
Block a user