Give glass control bars equal end and edge gaps
Inside a glass bar the first and last controls now keep the same gap from the pill's sides as from its top and bottom, from shared GlassBarMetrics (48/44 targets, 8 edge gap). Applies to the artifact viewer bar (hugs its actions without a pager), the chevron pagers (position text inset like an icon), and the chat composer's Cupertino Send/Stop (centred circle). Run 7 in the full-app probe now records change captures for diff captures.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
import '../domain/artifact_url.dart';
|
||||
@@ -236,7 +237,6 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
required this.cupertinoIcon,
|
||||
required this.onPressed,
|
||||
this.busy = false,
|
||||
this.inBar = false,
|
||||
});
|
||||
|
||||
final String label;
|
||||
@@ -245,10 +245,6 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
final bool busy;
|
||||
|
||||
/// Sized like the top bar's other actions (a standard icon button), so the
|
||||
/// bar's round pill is centred on it; compact otherwise.
|
||||
final bool inBar;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
@@ -256,18 +252,20 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
button: true,
|
||||
label: label,
|
||||
child: CupertinoButton(
|
||||
padding: inBar ? EdgeInsets.zero : const EdgeInsets.all(8),
|
||||
minimumSize: const Size(44, 44),
|
||||
// One square touch target, like the top bar's other actions, so a
|
||||
// round pill is centred on it and a glass bar's edge gaps hold.
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: GlassBarMetrics.cupertinoMinimumSize(),
|
||||
onPressed: onPressed,
|
||||
child: busy
|
||||
? const CupertinoActivityIndicator(radius: 9)
|
||||
: Icon(cupertinoIcon, size: 30),
|
||||
: Icon(cupertinoIcon, size: GlassBarMetrics.iconSize(true)),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
tooltip: label,
|
||||
constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
|
||||
constraints: GlassBarMetrics.materialConstraints(),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
icon: busy
|
||||
@@ -276,7 +274,7 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: Icon(icon, size: 28),
|
||||
: Icon(icon, size: GlassBarMetrics.iconSize(false)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/glass_pill.dart';
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
import '../actions/artifact_file_bridge.dart';
|
||||
import '../domain/artifact_preview.dart';
|
||||
@@ -122,33 +122,32 @@ class ArtifactViewerBody extends StatelessWidget {
|
||||
bar: SafeArea(
|
||||
top: false,
|
||||
minimum: const EdgeInsets.all(8),
|
||||
child: SizedBox(
|
||||
height: 56,
|
||||
child: GlassPill(
|
||||
// Without a pager the bar is as wide as its actions, so its last
|
||||
// control keeps the same gap from the bar's end as the first.
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
heightFactor: 1,
|
||||
child: GlassControlBar(
|
||||
cupertino: usesCupertinoHost(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||
child: Row(
|
||||
key: const Key('artifact-viewer-actions'),
|
||||
children: [
|
||||
if (resolved != null && !resolved.external)
|
||||
ArtifactFileActions(
|
||||
key: ValueKey<String>(
|
||||
'viewer-files-${page.group.stageKey}\u0000'
|
||||
'${page.group.visit}\u0000${page.artifact.url}',
|
||||
),
|
||||
artifact: page.artifact,
|
||||
resolved: resolved,
|
||||
fetch: fetch,
|
||||
bridge: fileBridge,
|
||||
compact: true,
|
||||
),
|
||||
if (resolved != null)
|
||||
_Actions(
|
||||
resolved: resolved,
|
||||
onOpen: onOpen,
|
||||
onCopy: onCopy,
|
||||
child: Row(
|
||||
key: const Key('artifact-viewer-actions'),
|
||||
mainAxisSize: count > 1 ? MainAxisSize.max : MainAxisSize.min,
|
||||
children: [
|
||||
if (resolved != null && !resolved.external)
|
||||
ArtifactFileActions(
|
||||
key: ValueKey<String>(
|
||||
'viewer-files-${page.group.stageKey}\u0000'
|
||||
'${page.group.visit}\u0000${page.artifact.url}',
|
||||
),
|
||||
artifact: page.artifact,
|
||||
resolved: resolved,
|
||||
fetch: fetch,
|
||||
bridge: fileBridge,
|
||||
compact: true,
|
||||
),
|
||||
if (resolved != null)
|
||||
_Actions(resolved: resolved, onOpen: onOpen, onCopy: onCopy),
|
||||
if (count > 1)
|
||||
Expanded(
|
||||
child: _Pager(
|
||||
index: index,
|
||||
@@ -157,8 +156,7 @@ class ArtifactViewerBody extends StatelessWidget {
|
||||
onNext: onNext,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -383,7 +381,6 @@ class ArtifactViewerInfoAction extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ArtifactIconAction(
|
||||
key: const Key('artifact-info'),
|
||||
inBar: true,
|
||||
label: 'Details',
|
||||
icon: Icons.info_outline,
|
||||
cupertinoIcon: CupertinoIcons.info,
|
||||
|
||||
Reference in New Issue
Block a user