Merge commit '42cb6a6f2d0de09a5851b31ef1b866c876a32337' into pipelines/run-20261111-0141-perf-window-moves-do-not-rebuild-content-b294
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
|
|
||||||
/// Asks for one machine's own password. [signIn] returns null on success,
|
/// Asks for one machine's own password. [signIn] returns null on success,
|
||||||
/// otherwise the sentence to show; the dialog stays open for a retry.
|
/// otherwise the sentence to show; the dialog stays open for a retry.
|
||||||
Future<void> showMachineSignIn(
|
Future<void> showMachineSignIn(
|
||||||
@@ -11,9 +8,7 @@ Future<void> showMachineSignIn(
|
|||||||
required Future<String?> Function(String password) signIn,
|
required Future<String?> Function(String password) signIn,
|
||||||
}) {
|
}) {
|
||||||
final dialog = MachineSignInDialog(name: name, signIn: signIn);
|
final dialog = MachineSignInDialog(name: name, signIn: signIn);
|
||||||
return usesCupertinoHost(context)
|
return showDialog<void>(context: context, builder: (_) => dialog);
|
||||||
? showCupertinoDialog<void>(context: context, builder: (_) => dialog)
|
|
||||||
: showDialog<void>(context: context, builder: (_) => dialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MachineSignInDialog extends StatefulWidget {
|
class MachineSignInDialog extends StatefulWidget {
|
||||||
@@ -68,24 +63,14 @@ class _MachineSignInDialogState extends State<MachineSignInDialog> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
final field = TextField(
|
||||||
final field = cupertino
|
key: const Key('machine-password'),
|
||||||
? CupertinoTextField(
|
controller: password,
|
||||||
key: const Key('machine-password'),
|
obscureText: true,
|
||||||
controller: password,
|
autofocus: true,
|
||||||
obscureText: true,
|
decoration: const InputDecoration(labelText: 'Password'),
|
||||||
autofocus: true,
|
onSubmitted: busy ? null : (_) => submit(),
|
||||||
placeholder: 'Password',
|
);
|
||||||
onSubmitted: busy ? null : (_) => submit(),
|
|
||||||
)
|
|
||||||
: TextField(
|
|
||||||
key: const Key('machine-password'),
|
|
||||||
controller: password,
|
|
||||||
obscureText: true,
|
|
||||||
autofocus: true,
|
|
||||||
decoration: const InputDecoration(labelText: 'Password'),
|
|
||||||
onSubmitted: busy ? null : (_) => submit(),
|
|
||||||
);
|
|
||||||
final content = Column(
|
final content = Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@@ -103,36 +88,20 @@ class _MachineSignInDialogState extends State<MachineSignInDialog> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
final title = Text('Sign in to ${widget.name}');
|
final title = Text('Sign in to ${widget.name}');
|
||||||
return cupertino
|
return AlertDialog(
|
||||||
? CupertinoAlertDialog(
|
title: title,
|
||||||
title: title,
|
content: content,
|
||||||
content: content,
|
actions: [
|
||||||
actions: [
|
TextButton(
|
||||||
CupertinoDialogAction(
|
onPressed: busy ? null : () => Navigator.pop(context),
|
||||||
onPressed: busy ? null : () => Navigator.pop(context),
|
child: const Text('Cancel'),
|
||||||
child: const Text('Cancel'),
|
),
|
||||||
),
|
FilledButton(
|
||||||
CupertinoDialogAction(
|
key: const Key('machine-sign-in'),
|
||||||
key: const Key('machine-sign-in'),
|
onPressed: busy ? null : submit,
|
||||||
onPressed: busy ? null : submit,
|
child: Text(busy ? 'Signing in…' : 'Sign in'),
|
||||||
child: Text(busy ? 'Signing in…' : 'Sign in'),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
)
|
|
||||||
: AlertDialog(
|
|
||||||
title: title,
|
|
||||||
content: content,
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: busy ? null : () => Navigator.pop(context),
|
|
||||||
child: const Text('Cancel'),
|
|
||||||
),
|
|
||||||
FilledButton(
|
|
||||||
key: const Key('machine-sign-in'),
|
|
||||||
onPressed: busy ? null : submit,
|
|
||||||
child: Text(busy ? 'Signing in…' : 'Sign in'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import 'machine_elevation.dart';
|
import 'machine_elevation.dart';
|
||||||
|
|
||||||
/// The app's elevation prompt: the native password dialog over whatever
|
/// The app's elevation prompt: the native password dialog over whatever
|
||||||
@@ -21,12 +19,10 @@ Future<bool> showElevationDialog(
|
|||||||
MachineElevation machine,
|
MachineElevation machine,
|
||||||
) async {
|
) async {
|
||||||
final dialog = ElevationDialog(name: machine.name, submit: machine.submit);
|
final dialog = ElevationDialog(name: machine.name, submit: machine.submit);
|
||||||
final result = usesCupertinoHost(context)
|
final result = await showDialog<bool>(
|
||||||
? await showCupertinoDialog<bool>(
|
context: context,
|
||||||
context: context,
|
builder: (_) => dialog,
|
||||||
builder: (_) => dialog,
|
);
|
||||||
)
|
|
||||||
: await showDialog<bool>(context: context, builder: (_) => dialog);
|
|
||||||
return result ?? false;
|
return result ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,24 +70,14 @@ class _ElevationDialogState extends State<ElevationDialog> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
final field = TextField(
|
||||||
final field = cupertino
|
key: const Key('elevation-password'),
|
||||||
? CupertinoTextField(
|
controller: password,
|
||||||
key: const Key('elevation-password'),
|
obscureText: true,
|
||||||
controller: password,
|
autofocus: true,
|
||||||
obscureText: true,
|
decoration: const InputDecoration(labelText: 'Password'),
|
||||||
autofocus: true,
|
onSubmitted: busy ? null : (_) => confirm(),
|
||||||
placeholder: 'Password',
|
);
|
||||||
onSubmitted: busy ? null : (_) => confirm(),
|
|
||||||
)
|
|
||||||
: TextField(
|
|
||||||
key: const Key('elevation-password'),
|
|
||||||
controller: password,
|
|
||||||
obscureText: true,
|
|
||||||
autofocus: true,
|
|
||||||
decoration: const InputDecoration(labelText: 'Password'),
|
|
||||||
onSubmitted: busy ? null : (_) => confirm(),
|
|
||||||
);
|
|
||||||
final content = Column(
|
final content = Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@@ -111,37 +97,20 @@ class _ElevationDialogState extends State<ElevationDialog> {
|
|||||||
);
|
);
|
||||||
const title = Text('Confirm password');
|
const title = Text('Confirm password');
|
||||||
final confirmLabel = Text(busy ? 'Confirming…' : 'Confirm');
|
final confirmLabel = Text(busy ? 'Confirming…' : 'Confirm');
|
||||||
return cupertino
|
return AlertDialog(
|
||||||
? CupertinoAlertDialog(
|
title: title,
|
||||||
title: title,
|
content: content,
|
||||||
content: content,
|
actions: [
|
||||||
actions: [
|
TextButton(
|
||||||
CupertinoDialogAction(
|
onPressed: busy ? null : () => Navigator.pop(context, false),
|
||||||
onPressed: busy ? null : () => Navigator.pop(context, false),
|
child: const Text('Cancel'),
|
||||||
child: const Text('Cancel'),
|
),
|
||||||
),
|
FilledButton(
|
||||||
CupertinoDialogAction(
|
key: const Key('elevation-confirm'),
|
||||||
key: const Key('elevation-confirm'),
|
onPressed: busy ? null : confirm,
|
||||||
isDefaultAction: true,
|
child: confirmLabel,
|
||||||
onPressed: busy ? null : confirm,
|
),
|
||||||
child: confirmLabel,
|
],
|
||||||
),
|
);
|
||||||
],
|
|
||||||
)
|
|
||||||
: AlertDialog(
|
|
||||||
title: title,
|
|
||||||
content: content,
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: busy ? null : () => Navigator.pop(context, false),
|
|
||||||
child: const Text('Cancel'),
|
|
||||||
),
|
|
||||||
FilledButton(
|
|
||||||
key: const Key('elevation-confirm'),
|
|
||||||
onPressed: busy ? null : confirm,
|
|
||||||
child: confirmLabel,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,9 +338,7 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
|
|||||||
context,
|
context,
|
||||||
chatSessionColor(_rowFor(pane.sessionId)),
|
chatSessionColor(_rowFor(pane.sessionId)),
|
||||||
) ??
|
) ??
|
||||||
(chatControlsStyleOf(context) == ChatControlsStyle.cupertino
|
Theme.of(context).colorScheme.primary
|
||||||
? CupertinoTheme.of(context).primaryColor
|
|
||||||
: Theme.of(context).colorScheme.primary)
|
|
||||||
: Colors.transparent;
|
: Colors.transparent;
|
||||||
return Semantics(
|
return Semantics(
|
||||||
selected: active,
|
selected: active,
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
|
|
||||||
/// Covers a chat beside the stage too narrow to use: its colour and title,
|
/// Covers a chat beside the stage too narrow to use: its colour and title,
|
||||||
/// running down the column. A press brings that chat to center stage. The
|
/// running down the column. A press brings that chat to center stage. The
|
||||||
/// retained chat underneath keeps its state.
|
/// retained chat underneath keeps its state.
|
||||||
@@ -22,20 +19,13 @@ class ChatCenterStageStrip extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final scheme = Theme.of(context).colorScheme;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
final accent =
|
final accent = color ?? scheme.primary;
|
||||||
color ??
|
|
||||||
(cupertino ? CupertinoTheme.of(context).primaryColor : scheme.primary);
|
|
||||||
final background = Color.alphaBlend(
|
final background = Color.alphaBlend(
|
||||||
accent.withValues(alpha: .12),
|
accent.withValues(alpha: .12),
|
||||||
cupertino
|
scheme.surfaceContainer,
|
||||||
? CupertinoColors.secondarySystemBackground.resolveFrom(context)
|
|
||||||
: scheme.surfaceContainer,
|
|
||||||
);
|
);
|
||||||
final style = cupertino
|
final style = Theme.of(context).textTheme.titleSmall;
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
|
||||||
: Theme.of(context).textTheme.titleSmall;
|
|
||||||
final label = Padding(
|
final label = Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -62,25 +52,17 @@ class ChatCenterStageStrip extends StatelessWidget {
|
|||||||
label: 'Show $title on center stage',
|
label: 'Show $title on center stage',
|
||||||
excludeSemantics: true,
|
excludeSemantics: true,
|
||||||
onTap: onSelected,
|
onTap: onSelected,
|
||||||
child: cupertino
|
child: Tooltip(
|
||||||
? CupertinoButton(
|
message: title,
|
||||||
padding: EdgeInsets.zero,
|
excludeFromSemantics: true,
|
||||||
color: background,
|
child: Material(
|
||||||
borderRadius: BorderRadius.zero,
|
color: background,
|
||||||
onPressed: onSelected,
|
child: InkWell(
|
||||||
child: SizedBox.expand(child: label),
|
onTap: onSelected,
|
||||||
)
|
child: SizedBox.expand(child: label),
|
||||||
: Tooltip(
|
),
|
||||||
message: title,
|
),
|
||||||
excludeFromSemantics: true,
|
),
|
||||||
child: Material(
|
|
||||||
color: background,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: onSelected,
|
|
||||||
child: SizedBox.expand(child: label),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import 'chat_workspace_pane_scope.dart';
|
|||||||
|
|
||||||
/// "Move up/down/left/right" for a tiled pane's actions (More) menu. A move
|
/// "Move up/down/left/right" for a tiled pane's actions (More) menu. A move
|
||||||
/// swaps the pane with the one across that edge. A direction with no pane is
|
/// swaps the pane with the one across that edge. A direction with no pane is
|
||||||
/// disabled in the Material menu (and left out of a Cupertino action sheet).
|
/// disabled in the menu. Nothing is offered when the panes are not tiled (one
|
||||||
/// Nothing is offered when the panes are not tiled (one pane, or a phone).
|
/// pane, or a phone).
|
||||||
List<Widget> chatPaneMoveActions(
|
List<Widget> chatPaneMoveActions(
|
||||||
ChatWorkspacePaneScope? scope, {
|
ChatWorkspacePaneScope? scope, {
|
||||||
required void Function(String targetPaneId) onMove,
|
required void Function(String targetPaneId) onMove,
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
|
|
||||||
/// A named, explicit switch action above the inactive transcript. It occupies
|
/// A named, explicit switch action above the inactive transcript. It occupies
|
||||||
/// space rather than obscuring the small chat's readable content.
|
/// space rather than obscuring the small chat's readable content.
|
||||||
@@ -17,20 +15,11 @@ class ChatPeekHeader extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => LayoutBuilder(
|
Widget build(BuildContext context) => LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final compact = constraints.maxHeight < 44;
|
final compact = constraints.maxHeight < 44;
|
||||||
final cupertino = usesCupertinoHost(context);
|
final textStyle = compact
|
||||||
final textStyle = cupertino
|
? Theme.of(context).textTheme.labelMedium
|
||||||
? (compact
|
: Theme.of(context).textTheme.labelLarge;
|
||||||
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle
|
final foreground = Theme.of(context).colorScheme.onSurface;
|
||||||
: CupertinoTheme.of(context).textTheme.textStyle)
|
final background = Theme.of(context).colorScheme.surfaceContainer;
|
||||||
: (compact
|
|
||||||
? Theme.of(context).textTheme.labelMedium
|
|
||||||
: Theme.of(context).textTheme.labelLarge);
|
|
||||||
final foreground = cupertino
|
|
||||||
? CupertinoColors.label.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurface;
|
|
||||||
final background = cupertino
|
|
||||||
? CupertinoColors.secondarySystemBackground.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.surfaceContainer;
|
|
||||||
final content = Row(
|
final content = Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -44,34 +33,23 @@ class ChatPeekHeader extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text('Switch', style: textStyle?.copyWith(color: foreground)),
|
Text('Switch', style: textStyle?.copyWith(color: foreground)),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Icon(
|
Icon(Icons.arrow_upward, color: foreground, size: 18),
|
||||||
cupertino ? CupertinoIcons.arrow_up : Icons.arrow_upward,
|
|
||||||
color: foreground,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return ColoredBox(
|
return ColoredBox(
|
||||||
color: background,
|
color: background,
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: 'Switch to $title',
|
message: 'Switch to $title',
|
||||||
child: cupertino
|
child: TextButton(
|
||||||
? CupertinoButton(
|
style: TextButton.styleFrom(
|
||||||
minimumSize: const Size(0, 44),
|
minimumSize: const Size(0, 44),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
onPressed: onActivate,
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
child: content,
|
shape: const RoundedRectangleBorder(),
|
||||||
)
|
),
|
||||||
: TextButton(
|
onPressed: onActivate,
|
||||||
style: TextButton.styleFrom(
|
child: content,
|
||||||
minimumSize: const Size(0, 44),
|
),
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
shape: const RoundedRectangleBorder(),
|
|
||||||
),
|
|
||||||
onPressed: onActivate,
|
|
||||||
child: content,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/motion/quick_switch_effect.dart';
|
import '../../../ui/motion/quick_switch_effect.dart';
|
||||||
import 'chat_pane_switch_motion.dart';
|
import 'chat_pane_switch_motion.dart';
|
||||||
|
|
||||||
@@ -24,12 +22,8 @@ class ChatSwitchCard extends StatelessWidget {
|
|||||||
motion.isAnimating ? motion.progress : 1,
|
motion.isAnimating ? motion.progress : 1,
|
||||||
outgoing: outgoing,
|
outgoing: outgoing,
|
||||||
);
|
);
|
||||||
final shadow = usesCupertinoHost(context)
|
final shadow = Theme.of(context).shadowColor;
|
||||||
? CupertinoColors.black
|
final surface = Theme.of(context).colorScheme.surface;
|
||||||
: Theme.of(context).shadowColor;
|
|
||||||
final surface = usesCupertinoHost(context)
|
|
||||||
? CupertinoTheme.of(context).scaffoldBackgroundColor
|
|
||||||
: Theme.of(context).colorScheme.surface;
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) => Opacity(
|
builder: (context, constraints) => Opacity(
|
||||||
opacity: pose.opacity,
|
opacity: pose.opacity,
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/semantics.dart';
|
import 'package:flutter/semantics.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import 'chat_workspace_controller.dart';
|
import 'chat_workspace_controller.dart';
|
||||||
import '../../../ui/adaptive/resize_grip.dart';
|
import '../../../ui/adaptive/resize_grip.dart';
|
||||||
import 'chat_workspace_geometry.dart';
|
import 'chat_workspace_geometry.dart';
|
||||||
@@ -50,9 +48,7 @@ class _ChatWorkspaceDividerState extends State<ChatWorkspaceDivider> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final verticalLine = _horizontal;
|
final verticalLine = _horizontal;
|
||||||
final color = usesCupertinoHost(context)
|
final color = Theme.of(context).dividerColor;
|
||||||
? CupertinoColors.separator.resolveFrom(context)
|
|
||||||
: Theme.of(context).dividerColor;
|
|
||||||
return Semantics(
|
return Semantics(
|
||||||
identifier: 'chat-divider-${widget.geometry.split.id}',
|
identifier: 'chat-divider-${widget.geometry.split.id}',
|
||||||
label: 'Resize chat panes ${_horizontal ? 'horizontally' : 'vertically'}',
|
label: 'Resize chat panes ${_horizontal ? 'horizontally' : 'vertically'}',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import '../../../ui/motion/motion.dart';
|
import '../../../ui/motion/motion.dart';
|
||||||
import '../../../ui/motion/surface_visibility.dart';
|
import '../../../ui/motion/surface_visibility.dart';
|
||||||
@@ -78,23 +78,16 @@ class _ChatWorkspaceEntranceState extends State<ChatWorkspaceEntrance>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final transition = widget.cupertino
|
final transition = FadeTransition(
|
||||||
? CupertinoPageTransition(
|
opacity: _curve,
|
||||||
primaryRouteAnimation: _controller,
|
child: SlideTransition(
|
||||||
secondaryRouteAnimation: const AlwaysStoppedAnimation(0),
|
position: Tween<Offset>(
|
||||||
linearTransition: false,
|
begin: const Offset(0, 0.08),
|
||||||
child: content,
|
end: Offset.zero,
|
||||||
)
|
).animate(_curve),
|
||||||
: FadeTransition(
|
child: content,
|
||||||
opacity: _curve,
|
),
|
||||||
child: SlideTransition(
|
);
|
||||||
position: Tween<Offset>(
|
|
||||||
begin: const Offset(0, 0.08),
|
|
||||||
end: Offset.zero,
|
|
||||||
).animate(_curve),
|
|
||||||
child: content,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return AnimatedBuilder(
|
return AnimatedBuilder(
|
||||||
animation: _controller,
|
animation: _controller,
|
||||||
child: transition,
|
child: transition,
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import 'chat_center_stage_motion.dart';
|
import 'chat_center_stage_motion.dart';
|
||||||
import 'chat_center_stage_strip.dart';
|
import 'chat_center_stage_strip.dart';
|
||||||
import 'chat_mobile_panes.dart';
|
import 'chat_mobile_panes.dart';
|
||||||
@@ -130,11 +128,7 @@ Widget chatWorkspaceSurface({
|
|||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
children: [
|
children: [
|
||||||
if (mobile != null)
|
if (mobile != null)
|
||||||
ColoredBox(
|
ColoredBox(color: Theme.of(context).colorScheme.surface),
|
||||||
color: usesCupertinoHost(context)
|
|
||||||
? CupertinoTheme.of(context).scaffoldBackgroundColor
|
|
||||||
: Theme.of(context).colorScheme.surface,
|
|
||||||
),
|
|
||||||
picture,
|
picture,
|
||||||
for (final pane in livePanes)
|
for (final pane in livePanes)
|
||||||
if (motion.isTape ||
|
if (motion.isTape ||
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
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';
|
||||||
import '../settings_theme.dart';
|
|
||||||
import 'health_models.dart';
|
import 'health_models.dart';
|
||||||
import 'health_widgets.dart';
|
import 'health_widgets.dart';
|
||||||
|
|
||||||
@@ -46,12 +44,7 @@ class HealthHeader extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Semantics(
|
Semantics(
|
||||||
label: 'Auto-refresh',
|
label: 'Auto-refresh',
|
||||||
child: usesCupertinoControls(context)
|
child: Switch(value: autoRefresh, onChanged: onAutoRefresh),
|
||||||
? CupertinoSwitch(
|
|
||||||
value: autoRefresh,
|
|
||||||
onChanged: onAutoRefresh,
|
|
||||||
)
|
|
||||||
: Switch(value: autoRefresh, onChanged: onAutoRefresh),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
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';
|
||||||
import '../settings_page_body.dart';
|
import '../settings_page_body.dart';
|
||||||
import '../settings_theme.dart';
|
|
||||||
import 'health_controller.dart';
|
import 'health_controller.dart';
|
||||||
import 'health_models.dart';
|
import 'health_models.dart';
|
||||||
import 'health_sections.dart';
|
import 'health_sections.dart';
|
||||||
@@ -142,16 +140,9 @@ class _HealthScreenState extends State<HealthScreen>
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return usesCupertinoControls(context)
|
return Scaffold(
|
||||||
? CupertinoPageScaffold(
|
appBar: AppBar(title: const Text('Server health')),
|
||||||
navigationBar: const CupertinoNavigationBar(
|
body: content,
|
||||||
middle: Text('Server health'),
|
);
|
||||||
),
|
|
||||||
child: SafeArea(child: content),
|
|
||||||
)
|
|
||||||
: Scaffold(
|
|
||||||
appBar: AppBar(title: const Text('Server health')),
|
|
||||||
body: content,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../settings_theme.dart';
|
import '../settings_theme.dart';
|
||||||
import 'health_models.dart';
|
import 'health_models.dart';
|
||||||
@@ -20,22 +19,7 @@ class HealthCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (!usesCupertinoControls(context)) return Card(child: content);
|
return Card(child: content);
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
||||||
child: DecoratedBox(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: CupertinoColors.secondarySystemGroupedBackground.resolveFrom(
|
|
||||||
context,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: DefaultTextStyle(
|
|
||||||
style: settingsTextStyle(context),
|
|
||||||
child: content,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,23 +31,13 @@ class HealthMeter extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final scheme = Theme.of(context).colorScheme;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
final percent = value == null ? null : value! * 100;
|
final percent = value == null ? null : value! * 100;
|
||||||
final cupertino = usesCupertinoControls(context);
|
|
||||||
final normal = cupertino
|
|
||||||
? CupertinoTheme.of(context).primaryColor
|
|
||||||
: scheme.primary;
|
|
||||||
final high = cupertino
|
|
||||||
? CupertinoColors.systemOrange.resolveFrom(context)
|
|
||||||
: scheme.tertiary;
|
|
||||||
final critical = cupertino
|
|
||||||
? CupertinoColors.systemRed.resolveFrom(context)
|
|
||||||
: scheme.error;
|
|
||||||
final color = percent == null
|
final color = percent == null
|
||||||
? scheme.outline
|
? scheme.outline
|
||||||
: percent >= healthMeterCritical
|
: percent >= healthMeterCritical
|
||||||
? critical
|
? scheme.error
|
||||||
: percent >= healthMeterHigh
|
: percent >= healthMeterHigh
|
||||||
? high
|
? scheme.tertiary
|
||||||
: normal;
|
: scheme.primary;
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -111,7 +85,6 @@ class HealthAction extends StatelessWidget {
|
|||||||
final String label;
|
final String label;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => usesCupertinoControls(context)
|
Widget build(BuildContext context) =>
|
||||||
? CupertinoButton(onPressed: onPressed, child: Text(label))
|
TextButton(onPressed: onPressed, child: Text(label));
|
||||||
: TextButton(onPressed: onPressed, child: Text(label));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
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';
|
||||||
import '../settings_row.dart';
|
import '../settings_row.dart';
|
||||||
import '../settings_theme.dart';
|
|
||||||
import 'health_screen.dart';
|
import 'health_screen.dart';
|
||||||
|
|
||||||
class SettingsHealthSection extends StatelessWidget {
|
class SettingsHealthSection extends StatelessWidget {
|
||||||
@@ -10,21 +8,13 @@ class SettingsHealthSection extends StatelessWidget {
|
|||||||
final ApiGateway gateway;
|
final ApiGateway gateway;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => SettingsRow(
|
Widget build(BuildContext context) => SettingsRow(
|
||||||
leading: Icon(
|
leading: const Icon(Icons.monitor_heart_outlined),
|
||||||
usesCupertinoControls(context)
|
|
||||||
? CupertinoIcons.heart
|
|
||||||
: Icons.monitor_heart_outlined,
|
|
||||||
),
|
|
||||||
title: const Text('Server health'),
|
title: const Text('Server health'),
|
||||||
subtitle: const Text('CPU, memory, GPU, storage and process'),
|
subtitle: const Text('CPU, memory, GPU, storage and process'),
|
||||||
chevron: true,
|
chevron: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final page = HealthScreen(gateway: gateway);
|
final page = HealthScreen(gateway: gateway);
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => page));
|
||||||
usesCupertinoControls(context)
|
|
||||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
|
||||||
: MaterialPageRoute<void>(builder: (_) => page),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
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 '../../../core/session/server_session.dart';
|
import '../../../core/session/server_session.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import 'session_security_api.dart';
|
import 'session_security_api.dart';
|
||||||
|
|
||||||
/// The server's sign-in security: a warning when its password predates the
|
/// The server's sign-in security: a warning when its password predates the
|
||||||
@@ -72,28 +70,6 @@ class _SettingsSecuritySectionState extends State<SettingsSecuritySection> {
|
|||||||
'Every browser and device signed in to this server, this one '
|
'Every browser and device signed in to this server, this one '
|
||||||
'included, must sign in again. Open connections close now.',
|
'included, must sign in again. Open connections close now.',
|
||||||
);
|
);
|
||||||
if (usesCupertinoHost(context)) {
|
|
||||||
return await showCupertinoDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => CupertinoAlertDialog(
|
|
||||||
title: title,
|
|
||||||
content: body,
|
|
||||||
actions: [
|
|
||||||
CupertinoDialogAction(
|
|
||||||
onPressed: () => Navigator.pop(context, false),
|
|
||||||
child: const Text('Cancel'),
|
|
||||||
),
|
|
||||||
CupertinoDialogAction(
|
|
||||||
key: const Key('settings-revoke-all-confirm'),
|
|
||||||
isDestructiveAction: true,
|
|
||||||
onPressed: () => Navigator.pop(context, true),
|
|
||||||
child: const Text('Sign out everywhere'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
return await showDialog<bool>(
|
return await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
@@ -148,17 +124,11 @@ class _SettingsSecuritySectionState extends State<SettingsSecuritySection> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final security = _security;
|
final security = _security;
|
||||||
final button = usesCupertinoHost(context)
|
final button = OutlinedButton(
|
||||||
? CupertinoButton(
|
key: const Key('settings-revoke-all'),
|
||||||
key: const Key('settings-revoke-all'),
|
onPressed: _busy ? null : _revokeAll,
|
||||||
onPressed: _busy ? null : _revokeAll,
|
child: const Text('Sign out everywhere'),
|
||||||
child: const Text('Sign out everywhere'),
|
);
|
||||||
)
|
|
||||||
: OutlinedButton(
|
|
||||||
key: const Key('settings-revoke-all'),
|
|
||||||
onPressed: _busy ? null : _revokeAll,
|
|
||||||
child: const Text('Sign out everywhere'),
|
|
||||||
);
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
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';
|
||||||
import '../settings_row.dart';
|
import '../settings_row.dart';
|
||||||
import '../settings_theme.dart';
|
|
||||||
import 'storage_screen.dart';
|
import 'storage_screen.dart';
|
||||||
|
|
||||||
class SettingsStorageSection extends StatelessWidget {
|
class SettingsStorageSection extends StatelessWidget {
|
||||||
@@ -10,21 +8,13 @@ class SettingsStorageSection extends StatelessWidget {
|
|||||||
final ApiGateway gateway;
|
final ApiGateway gateway;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => SettingsRow(
|
Widget build(BuildContext context) => SettingsRow(
|
||||||
leading: Icon(
|
leading: const Icon(Icons.storage_outlined),
|
||||||
usesCupertinoControls(context)
|
|
||||||
? CupertinoIcons.archivebox
|
|
||||||
: Icons.storage_outlined,
|
|
||||||
),
|
|
||||||
title: const Text('Storage'),
|
title: const Text('Storage'),
|
||||||
subtitle: const Text('Usage, worktrees and retention policy'),
|
subtitle: const Text('Usage, worktrees and retention policy'),
|
||||||
chevron: true,
|
chevron: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final page = StorageScreen(gateway: gateway);
|
final page = StorageScreen(gateway: gateway);
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => page));
|
||||||
usesCupertinoControls(context)
|
|
||||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
|
||||||
: MaterialPageRoute<void>(builder: (_) => page),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../settings_theme.dart';
|
|
||||||
|
|
||||||
class StorageAction extends StatelessWidget {
|
class StorageAction extends StatelessWidget {
|
||||||
const StorageAction({
|
const StorageAction({
|
||||||
@@ -13,27 +11,15 @@ class StorageAction extends StatelessWidget {
|
|||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final bool destructive;
|
final bool destructive;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => usesCupertinoControls(context)
|
Widget build(BuildContext context) => TextButton(
|
||||||
? CupertinoButton(
|
onPressed: onPressed,
|
||||||
onPressed: onPressed,
|
style: destructive
|
||||||
child: Text(
|
? TextButton.styleFrom(
|
||||||
label,
|
foregroundColor: Theme.of(context).colorScheme.error,
|
||||||
style: destructive
|
)
|
||||||
? TextStyle(
|
: null,
|
||||||
color: CupertinoColors.destructiveRed.resolveFrom(context),
|
child: Text(label),
|
||||||
)
|
);
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: TextButton(
|
|
||||||
onPressed: onPressed,
|
|
||||||
style: destructive
|
|
||||||
? TextButton.styleFrom(
|
|
||||||
foregroundColor: Theme.of(context).colorScheme.error,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
child: Text(label),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class StorageSwitch extends StatelessWidget {
|
class StorageSwitch extends StatelessWidget {
|
||||||
@@ -52,9 +38,7 @@ class StorageSwitch extends StatelessWidget {
|
|||||||
Expanded(child: Text(label)),
|
Expanded(child: Text(label)),
|
||||||
Semantics(
|
Semantics(
|
||||||
label: label,
|
label: label,
|
||||||
child: usesCupertinoControls(context)
|
child: Switch(value: value, onChanged: onChanged),
|
||||||
? CupertinoSwitch(value: value, onChanged: onChanged)
|
|
||||||
: Switch(value: value, onChanged: onChanged),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -77,35 +61,17 @@ class StorageInput extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final keyboard = TextInputType.numberWithOptions(decimal: decimal);
|
final keyboard = TextInputType.numberWithOptions(decimal: decimal);
|
||||||
return usesCupertinoControls(context)
|
return TextField(
|
||||||
? Column(
|
controller: controller,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
enabled: enabled,
|
||||||
children: [
|
keyboardType: keyboard,
|
||||||
Text(label),
|
onChanged: onChanged,
|
||||||
const SizedBox(height: 8),
|
decoration: InputDecoration(
|
||||||
Semantics(
|
labelText: label,
|
||||||
label: label,
|
hintText: 'No limit',
|
||||||
child: CupertinoTextField(
|
border: const OutlineInputBorder(),
|
||||||
controller: controller,
|
),
|
||||||
enabled: enabled,
|
);
|
||||||
keyboardType: keyboard,
|
|
||||||
onChanged: onChanged,
|
|
||||||
placeholder: 'No limit',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: TextField(
|
|
||||||
controller: controller,
|
|
||||||
enabled: enabled,
|
|
||||||
keyboardType: keyboard,
|
|
||||||
onChanged: onChanged,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: label,
|
|
||||||
hintText: 'No limit',
|
|
||||||
border: const OutlineInputBorder(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
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';
|
||||||
import '../settings_page_body.dart';
|
import '../settings_page_body.dart';
|
||||||
import '../settings_theme.dart';
|
|
||||||
import 'storage_cleanup.dart';
|
import 'storage_cleanup.dart';
|
||||||
import 'storage_controller.dart';
|
import 'storage_controller.dart';
|
||||||
import 'storage_controls.dart';
|
import 'storage_controls.dart';
|
||||||
@@ -93,45 +91,23 @@ class _StorageScreenState extends State<StorageScreen> {
|
|||||||
final preview = _controller.preview!;
|
final preview = _controller.preview!;
|
||||||
final message =
|
final message =
|
||||||
'Permanently remove ${storageInt(preview['candidate_count'])} eligible items and reclaim up to ${storageBytes(storageInt(preview['reclaimable_bytes']))}? This cannot be undone.';
|
'Permanently remove ${storageInt(preview['candidate_count'])} eligible items and reclaim up to ${storageBytes(storageInt(preview['reclaimable_bytes']))}? This cannot be undone.';
|
||||||
final bool? confirmed;
|
final confirmed = await showDialog<bool>(
|
||||||
if (usesCupertinoControls(context)) {
|
context: context,
|
||||||
confirmed = await showCupertinoDialog<bool>(
|
builder: (context) => AlertDialog(
|
||||||
context: context,
|
title: const Text('Apply cleanup?'),
|
||||||
builder: (context) => CupertinoAlertDialog(
|
content: Text(message),
|
||||||
title: const Text('Apply cleanup?'),
|
actions: [
|
||||||
content: Text(message),
|
TextButton(
|
||||||
actions: [
|
onPressed: () => Navigator.pop(context, false),
|
||||||
CupertinoDialogAction(
|
child: const Text('Cancel'),
|
||||||
onPressed: () => Navigator.pop(context, false),
|
),
|
||||||
child: const Text('Cancel'),
|
TextButton(
|
||||||
),
|
onPressed: () => Navigator.pop(context, true),
|
||||||
CupertinoDialogAction(
|
child: const Text('Remove items'),
|
||||||
isDestructiveAction: true,
|
),
|
||||||
onPressed: () => Navigator.pop(context, true),
|
],
|
||||||
child: const Text('Remove items'),
|
),
|
||||||
),
|
);
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
confirmed = await showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
title: const Text('Apply cleanup?'),
|
|
||||||
content: Text(message),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.pop(context, false),
|
|
||||||
child: const Text('Cancel'),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.pop(context, true),
|
|
||||||
child: const Text('Remove items'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (confirmed == true && mounted) await _controller.apply(policy);
|
if (confirmed == true && mounted) await _controller.apply(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +121,6 @@ class _StorageScreenState extends State<StorageScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoControls(context);
|
|
||||||
final content = SettingsPageBody(
|
final content = SettingsPageBody(
|
||||||
children: [
|
children: [
|
||||||
if (_controller.busy)
|
if (_controller.busy)
|
||||||
@@ -196,16 +171,9 @@ class _StorageScreenState extends State<StorageScreen> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return cupertino
|
return Scaffold(
|
||||||
? CupertinoPageScaffold(
|
appBar: AppBar(title: const Text('Storage')),
|
||||||
navigationBar: const CupertinoNavigationBar(
|
body: content,
|
||||||
middle: Text('Storage'),
|
);
|
||||||
),
|
|
||||||
child: SafeArea(child: content),
|
|
||||||
)
|
|
||||||
: Scaffold(
|
|
||||||
appBar: AppBar(title: const Text('Storage')),
|
|
||||||
body: content,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import '../settings_group.dart';
|
import '../settings_group.dart';
|
||||||
import 'storage_controls.dart';
|
import 'storage_controls.dart';
|
||||||
import 'storage_models.dart';
|
import 'storage_models.dart';
|
||||||
@@ -67,10 +66,7 @@ class StorageUsage extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
MaterialLocalizations,
|
MaterialLocalizations,
|
||||||
);
|
);
|
||||||
if (material != null) {
|
if (material == null) return null;
|
||||||
return '${time.day} ${material.formatMonthYear(time)} · ${material.formatTimeOfDay(TimeOfDay.fromDateTime(time), alwaysUse24HourFormat: true)}';
|
return '${time.day} ${material.formatMonthYear(time)} · ${material.formatTimeOfDay(TimeOfDay.fromDateTime(time), alwaysUse24HourFormat: true)}';
|
||||||
}
|
|
||||||
final local = CupertinoLocalizations.of(context);
|
|
||||||
return '${time.day} ${local.datePickerMonth(time.month)} ${time.year} · ${time.hour.toString().padLeft(2, '0')}:${time.minute.toString().padLeft(2, '0')}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -15,7 +14,7 @@ void main() {
|
|||||||
final navigator = GlobalKey<NavigatorState>();
|
final navigator = GlobalKey<NavigatorState>();
|
||||||
Future<JsonMap>? pending;
|
Future<JsonMap>? pending;
|
||||||
|
|
||||||
Future<void> pump(WidgetTester tester, {bool cupertino = false}) async {
|
Future<void> pump(WidgetTester tester) async {
|
||||||
machine = FakeMachine();
|
machine = FakeMachine();
|
||||||
gateway = ElevatingGateway(
|
gateway = ElevatingGateway(
|
||||||
machine,
|
machine,
|
||||||
@@ -35,12 +34,10 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
cupertino
|
MaterialApp(
|
||||||
? CupertinoApp(navigatorKey: navigator, home: home)
|
navigatorKey: navigator,
|
||||||
: MaterialApp(
|
home: Scaffold(body: home),
|
||||||
navigatorKey: navigator,
|
),
|
||||||
home: Scaffold(body: home),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
await tester.tap(find.text('Run'));
|
await tester.tap(find.text('Run'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@@ -99,18 +96,6 @@ void main() {
|
|||||||
expect(machine.calls, ['chat_shell_run']);
|
expect(machine.calls, ['chat_shell_run']);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a Cupertino host gets the Cupertino dialog', (tester) async {
|
|
||||||
await pump(tester, cupertino: true);
|
|
||||||
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
|
|
||||||
await tester.enterText(
|
|
||||||
find.byKey(const Key('elevation-password')),
|
|
||||||
'right',
|
|
||||||
);
|
|
||||||
await tester.tap(find.byKey(const Key('elevation-confirm')));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect((await pending!)['type'], 'chat_shell_run_ok');
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('without a mounted navigator the refusal is reported', (
|
testWidgets('without a mounted navigator the refusal is reported', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
@@ -34,61 +33,53 @@ class _Gateway extends FakeChatGateway {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets(
|
||||||
testWidgets(
|
'a pushed phone chat stays read and preserves underlying list chrome',
|
||||||
'a pushed phone chat stays read and preserves underlying list chrome ($cupertino)',
|
(tester) async {
|
||||||
(tester) async {
|
tester.view.physicalSize = const Size(390, 844);
|
||||||
tester.view.physicalSize = const Size(390, 844);
|
tester.view.devicePixelRatio = 1;
|
||||||
tester.view.devicePixelRatio = 1;
|
addTearDown(tester.view.reset);
|
||||||
addTearDown(tester.view.reset);
|
SharedPreferences.setMockInitialValues({});
|
||||||
SharedPreferences.setMockInitialValues({});
|
final gateway = _Gateway()..history = (_) async => chatPage([]);
|
||||||
final gateway = _Gateway()..history = (_) async => chatPage([]);
|
addTearDown(gateway.close);
|
||||||
addTearDown(gateway.close);
|
final bar = ShellBarRegistry();
|
||||||
final bar = ShellBarRegistry();
|
addTearDown(bar.dispose);
|
||||||
addTearDown(bar.dispose);
|
final selected = ValueNotifier<String?>('s1');
|
||||||
final selected = ValueNotifier<String?>('s1');
|
addTearDown(selected.dispose);
|
||||||
addTearDown(selected.dispose);
|
final screen = ShellBarScope(
|
||||||
final screen = ShellBarScope(
|
registry: bar,
|
||||||
registry: bar,
|
destination: AppDestination.chat,
|
||||||
destination: AppDestination.chat,
|
child: ValueListenableBuilder<String?>(
|
||||||
child: ValueListenableBuilder<String?>(
|
valueListenable: selected,
|
||||||
valueListenable: selected,
|
builder: (_, id, _) => ChatScreen(
|
||||||
builder: (_, id, _) => ChatScreen(
|
gateway: gateway,
|
||||||
gateway: gateway,
|
initialSessionId: id,
|
||||||
initialSessionId: id,
|
onBack: () => selected.value = null,
|
||||||
onBack: () => selected.value = null,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
await tester.pumpWidget(
|
);
|
||||||
cupertino
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
|
||||||
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
|
await tester.pumpAndSettle();
|
||||||
: MaterialApp(home: Scaffold(body: screen)),
|
final list = tester.widget<ChatSessionsScreen>(
|
||||||
);
|
find.byType(ChatSessionsScreen, skipOffstage: false),
|
||||||
await tester.pumpAndSettle();
|
);
|
||||||
final list = tester.widget<ChatSessionsScreen>(
|
final controller = list.controller!;
|
||||||
find.byType(ChatSessionsScreen, skipOffstage: false),
|
expect(controller.activeSessionId, 's1');
|
||||||
);
|
expect(bar.specFor(AppDestination.chat)?.actions, isNotEmpty);
|
||||||
final controller = list.controller!;
|
gateway.emitEvent(chatTextFrame('New live answer', session: 's1'));
|
||||||
expect(controller.activeSessionId, 's1');
|
await tester.pumpAndSettle();
|
||||||
expect(bar.specFor(AppDestination.chat)?.actions, isNotEmpty);
|
expect(controller.sessions.where(controller.isUnseen), isEmpty);
|
||||||
gateway.emitEvent(chatTextFrame('New live answer', session: 's1'));
|
gateway.emitEvent(chatTextFrame('Different answer', session: 's2'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(controller.sessions.where(controller.isUnseen), isEmpty);
|
expect(
|
||||||
gateway.emitEvent(chatTextFrame('Different answer', session: 's2'));
|
controller.sessions.where(controller.isUnseen).map((row) => row['id']),
|
||||||
await tester.pumpAndSettle();
|
['s2'],
|
||||||
expect(
|
);
|
||||||
controller.sessions
|
await tester.binding.handlePopRoute();
|
||||||
.where(controller.isUnseen)
|
await tester.pumpAndSettle();
|
||||||
.map((row) => row['id']),
|
expect(controller.activeSessionId, isNull);
|
||||||
['s2'],
|
expect(find.text('Open conversation'), findsOneWidget);
|
||||||
);
|
await tester.pumpWidget(const SizedBox.shrink());
|
||||||
await tester.binding.handlePopRoute();
|
},
|
||||||
await tester.pumpAndSettle();
|
);
|
||||||
expect(controller.activeSessionId, isNull);
|
|
||||||
expect(find.text('Open conversation'), findsOneWidget);
|
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,13 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(widthOf(tester, 'three'), 950);
|
expect(widthOf(tester, 'three'), 950);
|
||||||
expect(find.byType(ChatCenterStageStrip), findsNWidgets(2));
|
expect(find.byType(ChatCenterStageStrip), findsNWidgets(2));
|
||||||
|
expect(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byType(ChatCenterStageStrip).first,
|
||||||
|
matching: find.byType(InkWell),
|
||||||
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
expect(find.text('draft'), findsOneWidget);
|
expect(find.text('draft'), findsOneWidget);
|
||||||
|
|
||||||
stage.value = false;
|
stage.value = false;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/features/chat/workspace/chat_mobile_panes.dart';
|
import 'package:pipelines_app/features/chat/workspace/chat_mobile_panes.dart';
|
||||||
@@ -36,54 +35,48 @@ class _ThreadState extends State<_Thread> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
for (final height in [32.0, 48.0]) {
|
||||||
for (final height in [32.0, 48.0]) {
|
testWidgets('peek title and switch fit $height height at 2x', (
|
||||||
testWidgets(
|
tester,
|
||||||
'peek title and switch fit $height height at 2x ($cupertino)',
|
) async {
|
||||||
(tester) async {
|
var activated = 0;
|
||||||
var activated = 0;
|
Size? bodySize;
|
||||||
Size? bodySize;
|
final viewport = MediaQuery(
|
||||||
final viewport = MediaQuery(
|
data: const MediaQueryData(textScaler: TextScaler.linear(2)),
|
||||||
data: const MediaQueryData(textScaler: TextScaler.linear(2)),
|
child: Align(
|
||||||
child: Align(
|
alignment: Alignment.topLeft,
|
||||||
alignment: Alignment.topLeft,
|
child: SizedBox(
|
||||||
child: SizedBox(
|
width: 320,
|
||||||
width: 320,
|
height: height,
|
||||||
height: height,
|
child: ChatMobilePaneViewport(
|
||||||
child: ChatMobilePaneViewport(
|
peek: true,
|
||||||
peek: true,
|
active: false,
|
||||||
active: false,
|
barReveal: const AlwaysStoppedAnimation(0),
|
||||||
barReveal: const AlwaysStoppedAnimation(0),
|
onActivate: () => activated++,
|
||||||
onActivate: () => activated++,
|
label: 'A long working project name',
|
||||||
label: 'A long working project name',
|
paneId: 'first',
|
||||||
paneId: 'first',
|
child: LayoutBuilder(
|
||||||
child: LayoutBuilder(
|
builder: (context, constraints) {
|
||||||
builder: (context, constraints) {
|
bodySize = constraints.biggest;
|
||||||
bodySize = constraints.biggest;
|
return const SizedBox.expand();
|
||||||
return const SizedBox.expand();
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
await tester.pumpWidget(
|
),
|
||||||
cupertino
|
|
||||||
? CupertinoApp(home: CupertinoPageScaffold(child: viewport))
|
|
||||||
: MaterialApp(home: Scaffold(body: viewport)),
|
|
||||||
);
|
|
||||||
expect(find.text('A long working project name'), findsOneWidget);
|
|
||||||
expect(find.text('Switch'), findsOneWidget);
|
|
||||||
final headerSize = tester.getSize(find.byType(ChatPeekHeader));
|
|
||||||
expect(headerSize.height, lessThanOrEqualTo(height));
|
|
||||||
expect(bodySize!.height, closeTo(height - headerSize.height, .01));
|
|
||||||
await tester.tap(find.text('Switch'));
|
|
||||||
await tester.pump();
|
|
||||||
expect(activated, 1);
|
|
||||||
expect(tester.takeException(), isNull);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: viewport)));
|
||||||
|
expect(find.text('A long working project name'), findsOneWidget);
|
||||||
|
expect(find.text('Switch'), findsOneWidget);
|
||||||
|
expect(find.byType(TextButton), findsOneWidget);
|
||||||
|
final headerSize = tester.getSize(find.byType(ChatPeekHeader));
|
||||||
|
expect(headerSize.height, lessThanOrEqualTo(height));
|
||||||
|
expect(bodySize!.height, closeTo(height - headerSize.height, .01));
|
||||||
|
await tester.tap(find.text('Switch'));
|
||||||
|
await tester.pump();
|
||||||
|
expect(activated, 1);
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
testWidgets('peek header reserves real body space and keeps reading state', (
|
testWidgets('peek header reserves real body space and keeps reading state', (
|
||||||
tester,
|
tester,
|
||||||
|
|||||||
@@ -3,56 +3,47 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace_entrance.dart';
|
import 'package:pipelines_app/features/chat/workspace/chat_workspace_entrance.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('retained entrance moves the same child', (tester) async {
|
||||||
testWidgets('retained entrance moves the same child ($cupertino)', (
|
tester.platformDispatcher.accessibilityFeaturesTestValue =
|
||||||
tester,
|
const FakeAccessibilityFeatures(disableAnimations: false);
|
||||||
) async {
|
addTearDown(tester.platformDispatcher.clearAccessibilityFeaturesTestValue);
|
||||||
tester.platformDispatcher.accessibilityFeaturesTestValue =
|
final childKey = GlobalKey();
|
||||||
const FakeAccessibilityFeatures(disableAnimations: false);
|
final child = TextField(key: childKey);
|
||||||
addTearDown(
|
Widget host(bool visible, {bool reduced = false}) => MaterialApp(
|
||||||
tester.platformDispatcher.clearAccessibilityFeaturesTestValue,
|
home: MediaQuery(
|
||||||
);
|
data: MediaQueryData(disableAnimations: reduced),
|
||||||
final childKey = GlobalKey();
|
child: SizedBox.expand(
|
||||||
final child = TextField(key: childKey);
|
child: ChatWorkspaceEntrance(
|
||||||
Widget host(bool visible, {bool reduced = false}) => MaterialApp(
|
visible: visible,
|
||||||
home: MediaQuery(
|
cupertino: false,
|
||||||
data: MediaQueryData(disableAnimations: reduced),
|
child: Material(child: child),
|
||||||
child: SizedBox.expand(
|
|
||||||
child: ChatWorkspaceEntrance(
|
|
||||||
visible: visible,
|
|
||||||
cupertino: cupertino,
|
|
||||||
child: Material(child: child),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
await tester.pumpWidget(host(false));
|
);
|
||||||
final element = childKey.currentContext;
|
await tester.pumpWidget(host(false));
|
||||||
final state = childKey.currentState;
|
final element = childKey.currentContext;
|
||||||
expect(find.byKey(childKey), findsNothing);
|
final state = childKey.currentState;
|
||||||
await tester.pumpWidget(host(true));
|
expect(find.byKey(childKey), findsNothing);
|
||||||
final start = tester.getTopLeft(find.byKey(childKey));
|
await tester.pumpWidget(host(true));
|
||||||
await tester.pump();
|
final start = tester.getTopLeft(find.byKey(childKey));
|
||||||
await tester.pump(const Duration(milliseconds: 80));
|
await tester.pump();
|
||||||
final middle = tester.getTopLeft(find.byKey(childKey));
|
await tester.pump(const Duration(milliseconds: 80));
|
||||||
await tester.pumpAndSettle();
|
final middle = tester.getTopLeft(find.byKey(childKey));
|
||||||
final end = tester.getTopLeft(find.byKey(childKey));
|
await tester.pumpAndSettle();
|
||||||
expect(cupertino ? middle.dx : middle.dy, greaterThan(0));
|
final end = tester.getTopLeft(find.byKey(childKey));
|
||||||
expect(
|
expect(middle.dy, greaterThan(0));
|
||||||
cupertino ? middle.dx : middle.dy,
|
expect(middle.dy, lessThan(start.dy));
|
||||||
lessThan(cupertino ? start.dx : start.dy),
|
expect(end, Offset.zero);
|
||||||
);
|
expect(childKey.currentContext, same(element));
|
||||||
expect(end, Offset.zero);
|
expect(childKey.currentState, same(state));
|
||||||
expect(childKey.currentContext, same(element));
|
await tester.enterText(find.byType(TextField), 'Retained draft');
|
||||||
expect(childKey.currentState, same(state));
|
await tester.pumpWidget(host(false));
|
||||||
await tester.enterText(find.byType(TextField), 'Retained draft');
|
await tester.pumpAndSettle();
|
||||||
await tester.pumpWidget(host(false));
|
await tester.pumpWidget(host(true, reduced: true));
|
||||||
await tester.pumpAndSettle();
|
expect(tester.getTopLeft(find.byKey(childKey)), Offset.zero);
|
||||||
await tester.pumpWidget(host(true, reduced: true));
|
expect(find.text('Retained draft'), findsOneWidget);
|
||||||
expect(tester.getTopLeft(find.byKey(childKey)), Offset.zero);
|
expect(childKey.currentState, same(state));
|
||||||
expect(find.text('Retained draft'), findsOneWidget);
|
expect(tester.takeException(), isNull);
|
||||||
expect(childKey.currentState, same(state));
|
});
|
||||||
expect(tester.takeException(), isNull);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/servers/machine_access.dart';
|
import 'package:pipelines_app/core/servers/machine_access.dart';
|
||||||
@@ -64,96 +63,90 @@ Future<void> addServer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('a new machine asks for its own password', (tester) async {
|
||||||
testWidgets('a new machine asks for its own password ($cupertino)', (
|
final connections = ServerConnections(
|
||||||
tester,
|
store: MemoryServerCatalogStore(
|
||||||
) async {
|
catalog: ServerCatalog(
|
||||||
final connections = ServerConnections(
|
servers: [
|
||||||
store: MemoryServerCatalogStore(
|
SavedServer.validated(
|
||||||
catalog: ServerCatalog(
|
id: 'mac',
|
||||||
servers: [
|
name: 'Mac',
|
||||||
SavedServer.validated(
|
endpoints: ['ws://10.0.0.75:8083/connect'],
|
||||||
id: 'mac',
|
),
|
||||||
name: 'Mac',
|
],
|
||||||
endpoints: ['ws://10.0.0.75:8083/connect'],
|
selectedId: 'mac',
|
||||||
),
|
|
||||||
],
|
|
||||||
selectedId: 'mac',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onSelected: (_) async {},
|
),
|
||||||
);
|
onSelected: (_) async {},
|
||||||
addTearDown(connections.dispose);
|
);
|
||||||
await connections.load();
|
addTearDown(connections.dispose);
|
||||||
final auth = FakeAuthenticator()
|
await connections.load();
|
||||||
..verdicts['mac'] = const MachineAccessResult(MachineAccess.connected);
|
final auth = FakeAuthenticator()
|
||||||
connections.authenticator = auth;
|
..verdicts['mac'] = const MachineAccessResult(MachineAccess.connected);
|
||||||
final body = SingleChildScrollView(
|
connections.authenticator = auth;
|
||||||
child: SavedServersSection(connections: connections),
|
final body = SingleChildScrollView(
|
||||||
);
|
child: SavedServersSection(connections: connections),
|
||||||
await tester.pumpWidget(
|
);
|
||||||
cupertino
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: body)));
|
||||||
? CupertinoApp(
|
expect(find.text('Connected'), findsOneWidget);
|
||||||
home: CupertinoPageScaffold(child: SafeArea(child: body)),
|
// The new machine is unknown to the authenticator until saved; a
|
||||||
)
|
// password verdict arrives for whatever id the editor assigned.
|
||||||
: MaterialApp(home: Scaffold(body: body)),
|
auth.verdicts.addAll({
|
||||||
);
|
for (final id in ['pending'])
|
||||||
expect(find.text('Connected'), findsOneWidget);
|
id: const MachineAccessResult(MachineAccess.needsPassword),
|
||||||
// The new machine is unknown to the authenticator until saved; a
|
|
||||||
// password verdict arrives for whatever id the editor assigned.
|
|
||||||
auth.verdicts.addAll({
|
|
||||||
for (final id in ['pending']) id: const MachineAccessResult(
|
|
||||||
MachineAccess.needsPassword,
|
|
||||||
),
|
|
||||||
});
|
|
||||||
await tester.tap(find.text('Add server'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
await tester.enterText(find.byKey(const Key('server-profile-name')), 'tank');
|
|
||||||
await tester.enterText(
|
|
||||||
find.byKey(const Key('server-profile-addresses')),
|
|
||||||
'ws://10.0.0.100:8082/connect',
|
|
||||||
);
|
|
||||||
// Whatever id the editor chose, that machine wants a password.
|
|
||||||
connections.addListener(() {
|
|
||||||
for (final server in connections.catalog.servers) {
|
|
||||||
auth.verdicts.putIfAbsent(
|
|
||||||
server.id,
|
|
||||||
() => const MachineAccessResult(MachineAccess.needsPassword),
|
|
||||||
);
|
|
||||||
auth.passwords.putIfAbsent(server.id, () => 'tank-secret');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await revealSave(tester);
|
|
||||||
await tester.tap(find.text('Save server'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
final tank = connections.catalog.servers.firstWhere((s) => s.name == 'tank');
|
|
||||||
expect(auth.probes, [tank.id]);
|
|
||||||
// Saved, and the editor now asks this machine's password; the first
|
|
||||||
// machine's sign-in is not reused.
|
|
||||||
expect(find.byKey(const Key('server-profile-password')), findsOneWidget);
|
|
||||||
expect(find.textContaining('asks for its own password'), findsOneWidget);
|
|
||||||
await tester.enterText(
|
|
||||||
find.byKey(const Key('server-profile-password')),
|
|
||||||
'wrong',
|
|
||||||
);
|
|
||||||
await tester.tap(find.byKey(const Key('server-profile-sign-in')));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.text('Wrong password.'), findsOneWidget);
|
|
||||||
expect(find.byKey(const Key('server-profile-password')), findsOneWidget);
|
|
||||||
await tester.enterText(
|
|
||||||
find.byKey(const Key('server-profile-password')),
|
|
||||||
'tank-secret',
|
|
||||||
);
|
|
||||||
await tester.tap(find.byKey(const Key('server-profile-sign-in')));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(auth.signIns, [(tank.id, 'wrong'), (tank.id, 'tank-secret')]);
|
|
||||||
// Back on the list: both machines connected, each on its own sign-in.
|
|
||||||
expect(find.byKey(const Key('server-profile-password')), findsNothing);
|
|
||||||
expect(find.text('Connected'), findsNWidgets(2));
|
|
||||||
expect(find.text('Address: ws://10.0.0.100:8082/connect'), findsOneWidget);
|
|
||||||
expect(connections.catalog.active?.id, 'mac');
|
|
||||||
});
|
});
|
||||||
}
|
await tester.tap(find.text('Add server'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.enterText(
|
||||||
|
find.byKey(const Key('server-profile-name')),
|
||||||
|
'tank',
|
||||||
|
);
|
||||||
|
await tester.enterText(
|
||||||
|
find.byKey(const Key('server-profile-addresses')),
|
||||||
|
'ws://10.0.0.100:8082/connect',
|
||||||
|
);
|
||||||
|
// Whatever id the editor chose, that machine wants a password.
|
||||||
|
connections.addListener(() {
|
||||||
|
for (final server in connections.catalog.servers) {
|
||||||
|
auth.verdicts.putIfAbsent(
|
||||||
|
server.id,
|
||||||
|
() => const MachineAccessResult(MachineAccess.needsPassword),
|
||||||
|
);
|
||||||
|
auth.passwords.putIfAbsent(server.id, () => 'tank-secret');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await revealSave(tester);
|
||||||
|
await tester.tap(find.text('Save server'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
final tank = connections.catalog.servers.firstWhere(
|
||||||
|
(s) => s.name == 'tank',
|
||||||
|
);
|
||||||
|
expect(auth.probes, [tank.id]);
|
||||||
|
// Saved, and the editor now asks this machine's password; the first
|
||||||
|
// machine's sign-in is not reused.
|
||||||
|
expect(find.byKey(const Key('server-profile-password')), findsOneWidget);
|
||||||
|
expect(find.textContaining('asks for its own password'), findsOneWidget);
|
||||||
|
await tester.enterText(
|
||||||
|
find.byKey(const Key('server-profile-password')),
|
||||||
|
'wrong',
|
||||||
|
);
|
||||||
|
await tester.tap(find.byKey(const Key('server-profile-sign-in')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.text('Wrong password.'), findsOneWidget);
|
||||||
|
expect(find.byKey(const Key('server-profile-password')), findsOneWidget);
|
||||||
|
await tester.enterText(
|
||||||
|
find.byKey(const Key('server-profile-password')),
|
||||||
|
'tank-secret',
|
||||||
|
);
|
||||||
|
await tester.tap(find.byKey(const Key('server-profile-sign-in')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(auth.signIns, [(tank.id, 'wrong'), (tank.id, 'tank-secret')]);
|
||||||
|
// Back on the list: both machines connected, each on its own sign-in.
|
||||||
|
expect(find.byKey(const Key('server-profile-password')), findsNothing);
|
||||||
|
expect(find.text('Connected'), findsNWidgets(2));
|
||||||
|
expect(find.text('Address: ws://10.0.0.100:8082/connect'), findsOneWidget);
|
||||||
|
expect(connections.catalog.active?.id, 'mac');
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('an unreachable machine stays saved with the reason shown', (
|
testWidgets('an unreachable machine stays saved with the reason shown', (
|
||||||
tester,
|
tester,
|
||||||
@@ -172,7 +165,8 @@ void main() {
|
|||||||
server.id,
|
server.id,
|
||||||
() => const MachineAccessResult(
|
() => const MachineAccessResult(
|
||||||
MachineAccess.unreachable,
|
MachineAccess.unreachable,
|
||||||
detail: 'The HTTPS certificate of 100.85.25.33:8443 does not '
|
detail:
|
||||||
|
'The HTTPS certificate of 100.85.25.33:8443 does not '
|
||||||
'cover an IP address.',
|
'cover an IP address.',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -198,7 +192,10 @@ void main() {
|
|||||||
await tester.tap(find.byKey(const Key('server-sign-in-later')));
|
await tester.tap(find.byKey(const Key('server-sign-in-later')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(connections.catalog.servers.single.name, 'Mac by IP');
|
expect(connections.catalog.servers.single.name, 'Mac by IP');
|
||||||
expect(find.textContaining('Unreachable: The HTTPS certificate'), findsOneWidget);
|
expect(
|
||||||
|
find.textContaining('Unreachable: The HTTPS certificate'),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a saved machine that wants a password offers Sign in', (
|
testWidgets('a saved machine that wants a password offers Sign in', (
|
||||||
@@ -218,7 +215,9 @@ void main() {
|
|||||||
addTearDown(connections.dispose);
|
addTearDown(connections.dispose);
|
||||||
await connections.load();
|
await connections.load();
|
||||||
final auth = FakeAuthenticator()
|
final auth = FakeAuthenticator()
|
||||||
..verdicts['tank'] = const MachineAccessResult(MachineAccess.needsPassword)
|
..verdicts['tank'] = const MachineAccessResult(
|
||||||
|
MachineAccess.needsPassword,
|
||||||
|
)
|
||||||
..passwords['tank'] = 'tank-secret';
|
..passwords['tank'] = 'tank-secret';
|
||||||
connections.authenticator = auth;
|
connections.authenticator = auth;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@@ -231,7 +230,10 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.text('Sign in to tank'));
|
await tester.tap(find.text('Sign in to tank'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.enterText(find.byKey(const Key('machine-password')), 'tank-secret');
|
await tester.enterText(
|
||||||
|
find.byKey(const Key('machine-password')),
|
||||||
|
'tank-secret',
|
||||||
|
);
|
||||||
await tester.tap(find.byKey(const Key('machine-sign-in')));
|
await tester.tap(find.byKey(const Key('machine-sign-in')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(auth.signIns, [('tank', 'tank-secret')]);
|
expect(auth.signIns, [('tank', 'tank-secret')]);
|
||||||
@@ -248,7 +250,9 @@ void main() {
|
|||||||
endpoints: ['ws://10.0.0.75:8083/connect'],
|
endpoints: ['ws://10.0.0.75:8083/connect'],
|
||||||
);
|
);
|
||||||
final auth = FakeAuthenticator()
|
final auth = FakeAuthenticator()
|
||||||
..verdicts['mac'] = const MachineAccessResult(MachineAccess.needsPassword);
|
..verdicts['mac'] = const MachineAccessResult(
|
||||||
|
MachineAccess.needsPassword,
|
||||||
|
);
|
||||||
SavedServer? saved;
|
SavedServer? saved;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@@ -269,7 +273,10 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.tap(find.text('Edit'));
|
await tester.tap(find.text('Edit'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.enterText(find.byKey(const Key('server-profile-name')), 'Studio');
|
await tester.enterText(
|
||||||
|
find.byKey(const Key('server-profile-name')),
|
||||||
|
'Studio',
|
||||||
|
);
|
||||||
await revealSave(tester);
|
await revealSave(tester);
|
||||||
await tester.tap(find.text('Save server'));
|
await tester.tap(find.text('Save server'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/features/settings/storage/storage_screen.dart';
|
import 'package:pipelines_app/features/settings/storage/storage_screen.dart';
|
||||||
@@ -7,8 +6,7 @@ import '../../../../tool/storage_probe_fixture.dart';
|
|||||||
|
|
||||||
Future<void> _mount(
|
Future<void> _mount(
|
||||||
WidgetTester tester,
|
WidgetTester tester,
|
||||||
StorageProbeGateway gateway,
|
StorageProbeGateway gateway, {
|
||||||
bool cupertino, {
|
|
||||||
double width = 900,
|
double width = 900,
|
||||||
double scale = 1,
|
double scale = 1,
|
||||||
}) async {
|
}) async {
|
||||||
@@ -20,11 +18,7 @@ Future<void> _mount(
|
|||||||
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(scale)),
|
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(scale)),
|
||||||
child: child!,
|
child: child!,
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(builder: builder, home: screen));
|
||||||
cupertino
|
|
||||||
? CupertinoApp(builder: builder, home: screen)
|
|
||||||
: MaterialApp(builder: builder, home: screen),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,83 +37,72 @@ Finder _field(String label) => find.descendant(
|
|||||||
matching: find.byType(EditableText),
|
matching: find.byType(EditableText),
|
||||||
);
|
);
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('usage and partial measurement remain honest at 2x narrow', (
|
||||||
final style = cupertino ? 'Cupertino' : 'Material';
|
tester,
|
||||||
testWidgets(
|
) async {
|
||||||
'$style usage and partial measurement remain honest at 2x narrow',
|
final gateway = StorageProbeGateway();
|
||||||
(tester) async {
|
await _mount(tester, gateway, width: 560, scale: 2);
|
||||||
final gateway = StorageProbeGateway();
|
expect(find.text('At least 15.0 GiB used'), findsOneWidget);
|
||||||
await _mount(tester, gateway, cupertino, width: 560, scale: 2);
|
expect(
|
||||||
expect(find.text('At least 15.0 GiB used'), findsOneWidget);
|
find.text('Measurement is incomplete. See details below.'),
|
||||||
expect(
|
findsOneWidget,
|
||||||
find.text('Measurement is incomplete. See details below.'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(find.text('Database'), findsOneWidget);
|
|
||||||
expect(find.textContaining('6 November 2026'), findsOneWidget);
|
|
||||||
expect(find.text('Worktrees'), findsOneWidget);
|
|
||||||
await _tap(tester, 'Preview cleanup');
|
|
||||||
expect(find.text('Cleanup preview'), findsOneWidget);
|
|
||||||
expect(
|
|
||||||
find.text('Protected · worktree active-item · 4.00 GiB'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(tester.takeException(), isNull);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
testWidgets(
|
expect(find.text('Database'), findsOneWidget);
|
||||||
'$style cleanup cancellation does not mutate and confirmation uses token',
|
expect(find.textContaining('6 November 2026'), findsOneWidget);
|
||||||
(tester) async {
|
expect(find.text('Worktrees'), findsOneWidget);
|
||||||
final gateway = StorageProbeGateway();
|
await _tap(tester, 'Preview cleanup');
|
||||||
await _mount(tester, gateway, cupertino);
|
expect(find.text('Cleanup preview'), findsOneWidget);
|
||||||
await _tap(tester, 'Preview cleanup');
|
expect(
|
||||||
await _tap(tester, 'Apply cleanup');
|
find.text('Protected · worktree active-item · 4.00 GiB'),
|
||||||
expect(find.text('Apply cleanup?'), findsOneWidget);
|
findsOneWidget,
|
||||||
await _tap(tester, 'Cancel');
|
|
||||||
expect(
|
|
||||||
gateway.calls.where((call) => call.type == 'apply_storage_cleanup'),
|
|
||||||
isEmpty,
|
|
||||||
);
|
|
||||||
await _tap(tester, 'Apply cleanup');
|
|
||||||
await _tap(tester, 'Remove items');
|
|
||||||
expect(
|
|
||||||
gateway.calls
|
|
||||||
.singleWhere((call) => call.type == 'apply_storage_cleanup')
|
|
||||||
.fields['storage_cleanup_token'],
|
|
||||||
'fixture-preview-token',
|
|
||||||
);
|
|
||||||
expect(find.text('Cleanup result'), findsOneWidget);
|
|
||||||
expect(
|
|
||||||
find.text('Worktree became active and was kept.'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(tester.takeException(), isNull);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
testWidgets('$style invalid limits do not send a policy', (tester) async {
|
expect(tester.takeException(), isNull);
|
||||||
|
});
|
||||||
|
testWidgets(
|
||||||
|
'cleanup cancellation does not mutate and confirmation uses token',
|
||||||
|
(tester) async {
|
||||||
final gateway = StorageProbeGateway();
|
final gateway = StorageProbeGateway();
|
||||||
await _mount(tester, gateway, cupertino);
|
await _mount(tester, gateway);
|
||||||
await tester.ensureVisible(_field('Retain data for days'));
|
await _tap(tester, 'Preview cleanup');
|
||||||
await tester.enterText(_field('Retain data for days'), '-1');
|
await _tap(tester, 'Apply cleanup');
|
||||||
await _tap(tester, 'Save policy');
|
expect(find.text('Apply cleanup?'), findsOneWidget);
|
||||||
|
await _tap(tester, 'Cancel');
|
||||||
expect(
|
expect(
|
||||||
find.textContaining('Enter a whole number of days'),
|
gateway.calls.where((call) => call.type == 'apply_storage_cleanup'),
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
gateway.calls.where((call) => call.type == 'set_storage_policy'),
|
|
||||||
isEmpty,
|
isEmpty,
|
||||||
);
|
);
|
||||||
});
|
await _tap(tester, 'Apply cleanup');
|
||||||
testWidgets(
|
await _tap(tester, 'Remove items');
|
||||||
'$style unsupported server has an actionable error and no fake usage',
|
expect(
|
||||||
(tester) async {
|
gateway.calls
|
||||||
final gateway = StorageProbeGateway()..unsupported = true;
|
.singleWhere((call) => call.type == 'apply_storage_cleanup')
|
||||||
await _mount(tester, gateway, cupertino);
|
.fields['storage_cleanup_token'],
|
||||||
expect(find.text('Unknown command: get_storage'), findsOneWidget);
|
'fixture-preview-token',
|
||||||
expect(find.text('Server storage'), findsNothing);
|
);
|
||||||
expect(find.text('Refresh storage'), findsOneWidget);
|
expect(find.text('Cleanup result'), findsOneWidget);
|
||||||
},
|
expect(find.text('Worktree became active and was kept.'), findsOneWidget);
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
testWidgets('invalid limits do not send a policy', (tester) async {
|
||||||
|
final gateway = StorageProbeGateway();
|
||||||
|
await _mount(tester, gateway);
|
||||||
|
await tester.ensureVisible(_field('Retain data for days'));
|
||||||
|
await tester.enterText(_field('Retain data for days'), '-1');
|
||||||
|
await _tap(tester, 'Save policy');
|
||||||
|
expect(find.textContaining('Enter a whole number of days'), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
gateway.calls.where((call) => call.type == 'set_storage_policy'),
|
||||||
|
isEmpty,
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
testWidgets('unsupported server has an actionable error and no fake usage', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
final gateway = StorageProbeGateway()..unsupported = true;
|
||||||
|
await _mount(tester, gateway);
|
||||||
|
expect(find.text('Unknown command: get_storage'), findsOneWidget);
|
||||||
|
expect(find.text('Server storage'), findsNothing);
|
||||||
|
expect(find.text('Refresh storage'), findsOneWidget);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user