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 '../adaptive/glass_bar.dart';
|
||||
import '../adaptive/host.dart';
|
||||
|
||||
/// Previous and next as chevrons in one row at the bottom right, with the
|
||||
@@ -49,13 +50,13 @@ class ChevronPager extends StatelessWidget {
|
||||
child: CupertinoButton(
|
||||
key: key,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size(44, 44),
|
||||
minimumSize: GlassBarMetrics.cupertinoMinimumSize(),
|
||||
onPressed: onPressed,
|
||||
child: Icon(
|
||||
previous
|
||||
? CupertinoIcons.chevron_left
|
||||
: CupertinoIcons.chevron_right,
|
||||
size: 30,
|
||||
size: GlassBarMetrics.iconSize(true),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -63,26 +64,27 @@ class ChevronPager extends StatelessWidget {
|
||||
return IconButton(
|
||||
key: key,
|
||||
tooltip: label,
|
||||
constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
|
||||
constraints: GlassBarMetrics.materialConstraints(),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(
|
||||
previous ? Icons.chevron_left : Icons.chevron_right,
|
||||
size: 28,
|
||||
size: GlassBarMetrics.iconSize(false),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
// The surrounding glass pill supplies the edge gap. Keeping this row's
|
||||
// horizontal padding at zero also leaves room for four 48px controls on
|
||||
// a narrow phone at large text sizes.
|
||||
padding: EdgeInsets.zero,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
// The surrounding glass bar supplies the edge gap ([GlassBarMetrics]).
|
||||
// The position keeps an icon's inset on each side, so it sits as far from
|
||||
// the bar's edge and from the chevrons as an icon would.
|
||||
final inset = GlassBarMetrics.iconInset(cupertino);
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: inset),
|
||||
child: Text(
|
||||
'${index + 1} of $count',
|
||||
key: positionKey,
|
||||
@@ -90,21 +92,20 @@ class ChevronPager extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 0),
|
||||
chevron(
|
||||
key: previousKey,
|
||||
previous: true,
|
||||
label: previousLabel,
|
||||
onPressed: onPrevious,
|
||||
),
|
||||
chevron(
|
||||
key: nextKey,
|
||||
previous: false,
|
||||
label: nextLabel,
|
||||
onPressed: onNext,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
chevron(
|
||||
key: previousKey,
|
||||
previous: true,
|
||||
label: previousLabel,
|
||||
onPressed: onPrevious,
|
||||
),
|
||||
chevron(
|
||||
key: nextKey,
|
||||
previous: false,
|
||||
label: nextLabel,
|
||||
onPressed: onNext,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user