Files
pipelines/app/lib/ui/adaptive/glass_bar.dart
T
alan 5c80f75211 Remove Cupertino UI branches from shared primitives
Keep the existing Material rendering, semantics, and interaction paths while removing obsolete Cupertino imports, alternate widgets, and dynamic-color dependencies. Record focused verification and remaining fixture limitations for final integration.
2026-11-11 20:05:58 +00:00

70 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'glass_pill.dart';
/// The shared geometry of a floating glass control bar: a [GlassPill] holding
/// a row of icon controls (a viewer's actions, a pager, a canvas's controls).
///
/// Like the floating tab bar, the first and last controls keep the same gap
/// from the pill's sides as every control keeps from its top and bottom, so
/// a control at either end sits concentric with the pill's round cap.
/// Neighbouring controls touch target to target: their icons are spaced by
/// the targets' own padding, the same everywhere along the bar.
abstract final class GlassBarMetrics {
/// The gap between the controls' targets and every edge of the pill.
static const double edgeGap = 8;
/// The tighter gap of a bar around a text field (the chat composer), so
/// the field keeps its width; its end controls keep it on every side too.
static const double fieldEdgeGap = 4;
/// The square target of one control: the platform's minimum touch target.
static double controlExtent(bool cupertino) => kMinInteractiveDimension;
/// The icon drawn inside a control's target.
static double iconSize(bool cupertino) => 28;
/// The space between a control's icon and the edge of its target.
static double iconInset(bool cupertino) =>
(controlExtent(cupertino) - iconSize(cupertino)) / 2;
/// The visible circle of a filled control (Send) inside its target: the
/// Material filled icon button's 40 in 48, and the same inset on Cupertino.
static double filledExtent(bool cupertino) => controlExtent(cupertino) - 8;
/// The pill's height around one row of controls.
static double height(bool cupertino) =>
controlExtent(cupertino) + 2 * edgeGap;
/// The Material target constraints of one control.
static BoxConstraints materialConstraints() => BoxConstraints(
minWidth: controlExtent(false),
minHeight: controlExtent(false),
);
/// Compatibility helper for callers still passing the old control family.
static Size cupertinoMinimumSize() => Size.square(controlExtent(false));
}
/// A [GlassPill] padded by [GlassBarMetrics.edgeGap] on every side around
/// [child], a row of controls each [GlassBarMetrics.controlExtent] tall.
class GlassControlBar extends StatelessWidget {
const GlassControlBar({
super.key,
required this.cupertino,
required this.child,
});
final bool cupertino;
final Widget child;
@override
Widget build(BuildContext context) => GlassPill(
cupertino: cupertino,
child: Padding(
padding: const EdgeInsets.all(GlassBarMetrics.edgeGap),
child: child,
),
);
}