Remove Cupertino graph branches
Keep the Material graph implementation while preserving public Cupertino parameters for callers. Remove unreachable Cupertino widgets, routes, theme branches, imports, and Cupertino-only tests because the app runs exclusively under MaterialApp.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../layout/layout_models.dart';
|
||||
import '../routing/route_models.dart';
|
||||
|
||||
@@ -32,9 +30,9 @@ RoutingConfig graphCanvasRoutingConfig() => RoutingConfig(
|
||||
/// The native theme roles one definition graph canvas needs.
|
||||
///
|
||||
/// No palette, font family or size is defined here: every value comes from the
|
||||
/// ambient Material or Cupertino theme, so light/dark and text scaling follow
|
||||
/// the host exactly. Edge labels and diagnostics are metadata, so they use the
|
||||
/// host's secondary-label role rather than the node's own label style.
|
||||
/// ambient Material theme, so light/dark and text scaling follow the host
|
||||
/// exactly. Edge labels and diagnostics are metadata, so they use the host's
|
||||
/// secondary-label role rather than the node's own label style.
|
||||
class GraphCanvasStyle {
|
||||
const GraphCanvasStyle({
|
||||
required this.labelStyle,
|
||||
@@ -44,20 +42,6 @@ class GraphCanvasStyle {
|
||||
});
|
||||
|
||||
factory GraphCanvasStyle.of(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
final theme = CupertinoTheme.of(context);
|
||||
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
|
||||
return GraphCanvasStyle(
|
||||
labelStyle: theme.textTheme.tabLabelTextStyle.copyWith(
|
||||
color: secondary,
|
||||
),
|
||||
messageStyle: theme.textTheme.textStyle.copyWith(color: secondary),
|
||||
edgeColor: CupertinoColors.separator.resolveFrom(context),
|
||||
// Cupertino has no divider-thickness token; its separators are one
|
||||
// logical pixel hairlines, so the stroke keeps that native default.
|
||||
edgeWidth: 1,
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
final secondary = theme.colorScheme.onSurfaceVariant;
|
||||
return GraphCanvasStyle(
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../domain/graph_definition.dart';
|
||||
|
||||
@@ -37,7 +35,7 @@ class GraphStageNode extends StatelessWidget {
|
||||
/// Reports [node.key] exactly as the definition recorded it.
|
||||
final ValueChanged<String> onSelected;
|
||||
|
||||
/// Content inset shared by both hosts. It is spacing, not a size: the control
|
||||
/// Content inset for a graph node. It is spacing, not a size: the control
|
||||
/// still takes its size from its label, and the inset keeps wrapped glyphs
|
||||
/// clear of a rounded surface's corners.
|
||||
static const EdgeInsets _contentPadding = EdgeInsets.all(16);
|
||||
@@ -61,9 +59,7 @@ class GraphStageNode extends StatelessWidget {
|
||||
button: true,
|
||||
selected: selected,
|
||||
label: _label,
|
||||
child: usesCupertinoHost(context)
|
||||
? _cupertinoButton(onPressed, content)
|
||||
: _materialCard(onPressed, content),
|
||||
child: _materialCard(onPressed, content),
|
||||
),
|
||||
);
|
||||
return active ? StageActivityHalo(child: control) : control;
|
||||
@@ -106,12 +102,6 @@ class GraphStageNode extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Tinted is Cupertino's stock low-emphasis surface, so an unselected node is
|
||||
/// still a visible node body; filled raises the selected one.
|
||||
Widget _cupertinoButton(VoidCallback onPressed, Widget content) => selected
|
||||
? CupertinoButton.filled(onPressed: onPressed, child: content)
|
||||
: CupertinoButton.tinted(onPressed: onPressed, child: content);
|
||||
|
||||
Widget _content(BuildContext context) {
|
||||
final status = _status;
|
||||
// The recorded status reads apart from the name: a coloured dot and
|
||||
@@ -215,10 +205,7 @@ class _StageActivityHaloState extends State<StageActivityHalo>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final color = cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary;
|
||||
final color = Theme.of(context).colorScheme.primary;
|
||||
return AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) => CustomPaint(
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart' show listEquals;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/graph_definition.dart';
|
||||
import '../domain/run_graph_state.dart';
|
||||
import '../layout/layout_models.dart';
|
||||
@@ -200,10 +198,7 @@ class RunGraphCanvas extends StatelessWidget {
|
||||
final executedIds = {for (final route in executed) route.id};
|
||||
final size = Size(routing.width, routing.height);
|
||||
final activeStage = state.activeStage;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final executedColor = cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary;
|
||||
final executedColor = Theme.of(context).colorScheme.primary;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/run_graph_state.dart';
|
||||
import 'graph_canvas_style.dart';
|
||||
|
||||
@@ -31,10 +29,7 @@ class RunGraphHeader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final executedColor = cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary;
|
||||
final executedColor = Theme.of(context).colorScheme.primary;
|
||||
final mutedColor = style.edgeColor;
|
||||
final active = state.activeStage;
|
||||
return Padding(
|
||||
@@ -53,14 +48,12 @@ class RunGraphHeader extends StatelessWidget {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
_LegendEntry(
|
||||
icon: cupertino
|
||||
? CupertinoIcons.arrow_right
|
||||
: Icons.arrow_forward,
|
||||
icon: Icons.arrow_forward,
|
||||
label: runGraphExecuted,
|
||||
color: executedColor,
|
||||
),
|
||||
_LegendEntry(
|
||||
icon: cupertino ? CupertinoIcons.minus : Icons.remove,
|
||||
icon: Icons.remove,
|
||||
label: runGraphNotExecuted,
|
||||
color: mutedColor,
|
||||
),
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/text/markdown_source_view.dart';
|
||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/graph_protocol.dart';
|
||||
import '../domain/stage_definition.dart';
|
||||
|
||||
@@ -159,30 +157,14 @@ Future<void> openStageDefinition(
|
||||
// A terminal is a definition target, not its protocol key: the web pane
|
||||
// titles it with `nodeDisplayLabel` (`Failure`/`Success`).
|
||||
final title = '${nodeDisplayLabel(stageKey)} definition';
|
||||
final route = usesCupertinoHost(context)
|
||||
? CupertinoPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (_) => CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
title: title,
|
||||
subtitle: identity,
|
||||
),
|
||||
child: SafeArea(top: false, bottom: false, child: view),
|
||||
),
|
||||
)
|
||||
: MaterialPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (_) => Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
title: title,
|
||||
subtitle: identity,
|
||||
),
|
||||
body: SafeArea(top: false, bottom: false, child: view),
|
||||
),
|
||||
);
|
||||
final route = MaterialPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (_) => Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(cupertino: false, title: title, subtitle: identity),
|
||||
body: SafeArea(top: false, bottom: false, child: view),
|
||||
),
|
||||
);
|
||||
return Navigator.of(context).push(route);
|
||||
}
|
||||
|
||||
@@ -263,22 +245,6 @@ class _StageDefinitionStyle {
|
||||
});
|
||||
|
||||
factory _StageDefinitionStyle.of(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
final theme = CupertinoTheme.of(context);
|
||||
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
|
||||
return _StageDefinitionStyle(
|
||||
label: theme.textTheme.tabLabelTextStyle.copyWith(color: secondary),
|
||||
// SelectableText needs a style it can merge into the default text
|
||||
// style; Cupertino's textStyle is a complete style with `inherit: false`
|
||||
// and no baseline.
|
||||
value: theme.textTheme.textStyle.copyWith(inherit: true),
|
||||
muted: theme.textTheme.textStyle.copyWith(
|
||||
inherit: true,
|
||||
color: secondary,
|
||||
),
|
||||
heading: theme.textTheme.navTitleTextStyle,
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
return _StageDefinitionStyle(
|
||||
label: (theme.textTheme.labelMedium ?? const TextStyle()).copyWith(
|
||||
|
||||
Reference in New Issue
Block a user