Artifact viewer: centre the Details (i) button in its bar pill
The viewer's top-bar Details action reused the compact bottom-bar button, so its icon sat off-centre in the bar's round pill on Material. Bar actions now use the standard bar button size.
This commit is contained in:
@@ -236,6 +236,7 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
required this.cupertinoIcon,
|
||||
required this.onPressed,
|
||||
this.busy = false,
|
||||
this.inBar = false,
|
||||
});
|
||||
|
||||
final String label;
|
||||
@@ -244,6 +245,10 @@ 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)) {
|
||||
@@ -251,7 +256,7 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
button: true,
|
||||
label: label,
|
||||
child: CupertinoButton(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: inBar ? EdgeInsets.zero : const EdgeInsets.all(8),
|
||||
onPressed: onPressed,
|
||||
child: busy
|
||||
? const CupertinoActivityIndicator(radius: 9)
|
||||
@@ -261,7 +266,7 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
}
|
||||
return IconButton(
|
||||
tooltip: label,
|
||||
visualDensity: VisualDensity.compact,
|
||||
visualDensity: inBar ? null : VisualDensity.compact,
|
||||
onPressed: onPressed,
|
||||
icon: busy
|
||||
? const SizedBox(
|
||||
|
||||
@@ -383,6 +383,7 @@ 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