3c56db37fd
AppListRow (Material + Cupertino) with avatar, bold title and trailing time, one muted line, one overflow menu style, inset dividers, selected and emphasised states and a compact mode. Pipelines get a legible initial avatar, schedule rows shrink to two lines with Edit/Pause/Delete in an overflow menu, and the shell chat list scrolls behind the bar.
57 lines
1.9 KiB
Dart
57 lines
1.9 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../ui/adaptive/host.dart';
|
|
|
|
/// Host text roles and standard buttons for the pipeline schedule section.
|
|
/// No palette, font family or explicit point size is introduced.
|
|
TextStyle? schedulePipelineHeadingStyle(BuildContext context) =>
|
|
usesCupertinoHost(context)
|
|
? CupertinoTheme.of(context).textTheme.navTitleTextStyle
|
|
: Theme.of(context).textTheme.titleMedium;
|
|
|
|
TextStyle? schedulePipelineMutedStyle(BuildContext context) {
|
|
if (usesCupertinoHost(context)) {
|
|
return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
|
|
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
|
);
|
|
}
|
|
final theme = Theme.of(context);
|
|
return theme.textTheme.bodySmall?.copyWith(
|
|
color: theme.colorScheme.onSurfaceVariant,
|
|
);
|
|
}
|
|
|
|
TextStyle? schedulePipelineStatusStyle(BuildContext context, bool enabled) {
|
|
final base = schedulePipelineMutedStyle(context);
|
|
if (!enabled) return base;
|
|
return usesCupertinoHost(context)
|
|
? base?.copyWith(color: CupertinoTheme.of(context).primaryColor)
|
|
: base?.copyWith(color: Theme.of(context).colorScheme.primary);
|
|
}
|
|
|
|
TextStyle? schedulePipelineErrorStyle(BuildContext context) =>
|
|
usesCupertinoHost(context)
|
|
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
|
color: CupertinoColors.systemRed.resolveFrom(context),
|
|
)
|
|
: TextStyle(color: Theme.of(context).colorScheme.error);
|
|
|
|
/// A standard platform text action.
|
|
Widget schedulePipelineTextButton(
|
|
BuildContext context, {
|
|
required String label,
|
|
required VoidCallback? onPressed,
|
|
Key? key,
|
|
}) {
|
|
if (usesCupertinoHost(context)) {
|
|
return CupertinoButton(
|
|
key: key,
|
|
padding: EdgeInsets.zero,
|
|
onPressed: onPressed,
|
|
child: Text(label),
|
|
);
|
|
}
|
|
return TextButton(key: key, onPressed: onPressed, child: Text(label));
|
|
}
|