Format shared Material primitive integration

This commit is contained in:
2026-11-11 21:17:32 +00:00
parent 16dab6d74e
commit 16f4e43ddc
12 changed files with 35 additions and 38 deletions
@@ -108,7 +108,10 @@ class GraphStageNode extends StatelessWidget {
// coloured, smaller text in the status's own hue. // coloured, smaller text in the status's own hue.
final color = status == null final color = status == null
? null ? null
: runStatusColor(graphStatusState(status), Theme.of(context).colorScheme); : runStatusColor(
graphStatusState(status),
Theme.of(context).colorScheme,
);
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -238,7 +238,10 @@ class PipelineListPanel extends StatelessWidget {
? null ? null
: AppListStatusDot( : AppListStatusDot(
key: Key('pipeline-status-${pipeline.id}'), key: Key('pipeline-status-${pipeline.id}'),
color: runStatusColor(badge.state, Theme.of(context).colorScheme), color: runStatusColor(
badge.state,
Theme.of(context).colorScheme,
),
semanticLabel: runStateLabel(badge.state), semanticLabel: runStateLabel(badge.state),
), ),
subtitle: Text( subtitle: Text(
@@ -280,10 +283,7 @@ class PipelineListPanel extends StatelessWidget {
/// The pipeline's initial on a tint picked from its id, so neighbouring /// The pipeline's initial on a tint picked from its id, so neighbouring
/// pipelines are told apart at a glance. /// pipelines are told apart at a glance.
Widget _pipelineIdentityIcon( Widget _pipelineIdentityIcon(BuildContext context, PipelineSummary pipeline) {
BuildContext context,
PipelineSummary pipeline,
) {
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
final colors = [scheme.primary, scheme.secondary, scheme.tertiary]; final colors = [scheme.primary, scheme.secondary, scheme.tertiary];
return Semantics( return Semantics(
@@ -145,7 +145,7 @@ class RunTimelineRow extends StatelessWidget {
divider: divider, divider: divider,
onTap: onTap, onTap: onTap,
leading: AppListAvatar( leading: AppListAvatar(
foreground: runStatusColor(state, Theme.of(context).colorScheme), foreground: runStatusColor(state, Theme.of(context).colorScheme),
child: RunStatusIcon( child: RunStatusIcon(
state: state, state: state,
label: visit.status.isEmpty ? 'Status unavailable' : visit.status, label: visit.status.isEmpty ? 'Status unavailable' : visit.status,
+1 -1
View File
@@ -126,7 +126,7 @@ class RunListRow extends StatelessWidget {
onLongPress: selecting ? null : onLongPress, onLongPress: selecting ? null : onLongPress,
selectionControl: selecting ? _checkbox(context) : null, selectionControl: selecting ? _checkbox(context) : null,
leading: AppListAvatar( leading: AppListAvatar(
foreground: runStatusColor(state, Theme.of(context).colorScheme), foreground: runStatusColor(state, Theme.of(context).colorScheme),
child: RunStatusIcon(state: state, label: runStatusLabel(run)), child: RunStatusIcon(state: state, label: runStatusLabel(run)),
), ),
title: Text(title), title: Text(title),
+1 -1
View File
@@ -59,7 +59,7 @@ class RunPathMini extends StatelessWidget {
width: 14, width: 14,
height: 10, height: 10,
decoration: BoxDecoration( decoration: BoxDecoration(
color: runStatusColor(stage.state, Theme.of(context).colorScheme), color: runStatusColor(stage.state, Theme.of(context).colorScheme),
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
), ),
); );
@@ -14,9 +14,9 @@ import 'runs_controller.dart';
/// Opens the runs' usage and charts on their own page. /// Opens the runs' usage and charts on their own page.
Future<void> openRunsStats(BuildContext context, RunsController controller) { Future<void> openRunsStats(BuildContext context, RunsController controller) {
final page = RunsStatsPage(controller: controller); final page = RunsStatsPage(controller: controller);
return Navigator.of(context).push<void>( return Navigator.of(
MaterialPageRoute<void>(builder: (_) => page), context,
); ).push<void>(MaterialPageRoute<void>(builder: (_) => page));
} }
/// Usage totals, runs by status (a pie) and runs per day for the last week. /// Usage totals, runs by status (a pie) and runs per day for the last week.
@@ -92,7 +92,10 @@ class RunsStatsPage extends StatelessWidget {
painter: _PiePainter([ painter: _PiePainter([
for (final entry in byState.entries) for (final entry in byState.entries)
( (
runStatusColor(entry.key, Theme.of(context).colorScheme), runStatusColor(
entry.key,
Theme.of(context).colorScheme,
),
entry.value, entry.value,
), ),
]), ]),
+11 -11
View File
@@ -86,8 +86,8 @@ class FloatingTabButton extends StatelessWidget {
} }
String _tabLabel(BuildContext context) => MaterialLocalizations.of( String _tabLabel(BuildContext context) => MaterialLocalizations.of(
context, context,
).tabLabel(tabIndex: index + 1, tabCount: count); ).tabLabel(tabIndex: index + 1, tabCount: count);
({Color tint, Color selectedIcon, Color icon}) _colors(BuildContext context) { ({Color tint, Color selectedIcon, Color icon}) _colors(BuildContext context) {
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
@@ -109,15 +109,15 @@ class FloatingTabButton extends StatelessWidget {
shape: const CircleBorder(), shape: const CircleBorder(),
); );
final Widget fill = Ink( final Widget fill = Ink(
key: fillKey, key: fillKey,
decoration: decoration, decoration: decoration,
child: InkResponse( child: InkResponse(
onTap: onTap, onTap: onTap,
customBorder: const CircleBorder(), customBorder: const CircleBorder(),
containedInkWell: true, containedInkWell: true,
highlightShape: BoxShape.circle, highlightShape: BoxShape.circle,
), ),
); );
Widget glyph = IconTheme.merge( Widget glyph = IconTheme.merge(
data: IconThemeData( data: IconThemeData(
size: iconSize, size: iconSize,
+1 -3
View File
@@ -22,9 +22,7 @@ class AdaptiveResizeGrip extends StatelessWidget {
color: Theme.of(context).colorScheme.surfaceContainerHigh, color: Theme.of(context).colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: emphasized border: emphasized
? Border.all( ? Border.all(color: Theme.of(context).colorScheme.primary)
color: Theme.of(context).colorScheme.primary,
)
: null, : null,
), ),
child: Padding( child: Padding(
@@ -122,5 +122,4 @@ class SegmentedMoreButton extends StatelessWidget {
), ),
); );
} }
} }
@@ -5,8 +5,7 @@ import 'segmented_bar_motion.dart';
/// The smallest height of every piece of a [SegmentedBar]: the platform's /// The smallest height of every piece of a [SegmentedBar]: the platform's
/// minimum touch target, so a round Back is a circle. /// minimum touch target, so a round Back is a circle.
double segmentedPieceHeight(bool cupertino) => double segmentedPieceHeight(bool cupertino) => kMinInteractiveDimension;
kMinInteractiveDimension;
/// One rounded piece of a segmented bar: a [GlassPill] at least the /// One rounded piece of a segmented bar: a [GlassPill] at least the
/// platform's touch-target size. /// platform's touch-target size.
@@ -21,6 +21,7 @@ class BarIconButton extends StatelessWidget {
}); });
final IconData icon; final IconData icon;
/// Retained for source compatibility; Material rendering always uses [icon]. /// Retained for source compatibility; Material rendering always uses [icon].
final IconData? cupertinoIcon; final IconData? cupertinoIcon;
@@ -45,13 +45,7 @@ void main() {
final scheme = Theme.of( final scheme = Theme.of(
tester.element(find.byKey(const Key('run-path-mini'))), tester.element(find.byKey(const Key('run-path-mini'))),
).colorScheme; ).colorScheme;
expect( expect(colors, contains(runStatusColor('succeeded', scheme).toARGB32()));
colors, expect(colors, contains(runStatusColor('failed', scheme).toARGB32()));
contains(runStatusColor('succeeded', scheme).toARGB32()),
);
expect(
colors,
contains(runStatusColor('failed', scheme).toARGB32()),
);
}); });
} }