72 lines
2.3 KiB
Dart
72 lines
2.3 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? schedulePipelineBodyStyle(BuildContext context) =>
|
|
usesCupertinoHost(context)
|
|
? CupertinoTheme.of(context).textTheme.textStyle
|
|
: Theme.of(context).textTheme.bodyLarge;
|
|
|
|
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));
|
|
}
|
|
|
|
Widget schedulePipelineSeparator(BuildContext context) {
|
|
if (usesCupertinoHost(context)) {
|
|
return Container(
|
|
height: 1 / MediaQuery.devicePixelRatioOf(context),
|
|
color: CupertinoColors.separator.resolveFrom(context),
|
|
);
|
|
}
|
|
return const Divider(height: 1);
|
|
}
|