Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
145 lines
4.9 KiB
Dart
145 lines
4.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../layout/composer_layout.dart';
|
|
|
|
import 'package:cutdex_ui/icons.dart';
|
|
import 'package:cutdex_ui/widgets.dart';
|
|
import 'package:cutdex_ui/theme.dart';
|
|
|
|
/// Shared presentation for the composer and its project menu.
|
|
abstract final class AppComposerStyle {
|
|
static ButtonStyle composerSendButtonStyle(BuildContext context) {
|
|
final colors = Theme.of(context).colorScheme;
|
|
return ButtonStyle(
|
|
minimumSize: const WidgetStatePropertyAll(
|
|
Size.square(ComposerLayout.controlSize),
|
|
),
|
|
fixedSize: const WidgetStatePropertyAll(
|
|
Size.square(ComposerLayout.controlSize),
|
|
),
|
|
shape: const WidgetStatePropertyAll(CircleBorder()),
|
|
backgroundColor: WidgetStateProperty.resolveWith(
|
|
(states) => states.contains(WidgetState.disabled)
|
|
? colors.onSurface.withValues(alpha: 0.12)
|
|
: Colors.white,
|
|
),
|
|
foregroundColor: WidgetStateProperty.resolveWith(
|
|
(states) => states.contains(WidgetState.disabled)
|
|
? colors.onSurface.withValues(alpha: 0.38)
|
|
: Colors.black,
|
|
),
|
|
);
|
|
}
|
|
|
|
static const inputPadding = EdgeInsets.fromLTRB(12, 14, 12, 4);
|
|
static const controlsPadding = EdgeInsets.fromLTRB(8, 0, 8, 8);
|
|
static const utilityPadding = EdgeInsets.fromLTRB(
|
|
4,
|
|
ComposerLayout.utilityVerticalPadding,
|
|
4,
|
|
ComposerLayout.utilityVerticalPadding + ComposerLayout.utilityOverlap,
|
|
);
|
|
static const menuSeparatorPadding = EdgeInsets.symmetric(
|
|
horizontal: 8,
|
|
vertical: 4,
|
|
);
|
|
static const menuEmptyPadding = EdgeInsets.all(12);
|
|
|
|
static InputDecoration inputDecoration(
|
|
BuildContext context, {
|
|
required String hintText,
|
|
}) => AppTheme.composerInputDecoration.copyWith(
|
|
isDense: true,
|
|
constraints: const BoxConstraints(minHeight: ComposerLayout.inputMinHeight),
|
|
contentPadding: inputPadding,
|
|
hintText: hintText,
|
|
hintStyle: AppTheme.composerHintStyle(context),
|
|
);
|
|
|
|
static ButtonStyle projectMenuItem(
|
|
BuildContext context, {
|
|
bool secondary = false,
|
|
}) {
|
|
final colors = Theme.of(context).colorScheme;
|
|
return AppMenuStyle.item(context).copyWith(
|
|
foregroundColor: WidgetStateProperty.resolveWith(
|
|
(states) => states.contains(WidgetState.disabled)
|
|
? Theme.of(context).disabledColor
|
|
: secondary
|
|
? colors.onSurfaceVariant
|
|
: colors.onSurface,
|
|
),
|
|
maximumSize: const WidgetStatePropertyAll(
|
|
Size(double.infinity, ComposerLayout.menuRowHeight),
|
|
),
|
|
);
|
|
}
|
|
|
|
static MenuStyle projectMenu(BuildContext context) {
|
|
return AppMenuStyle.panel(
|
|
context,
|
|
minWidth: ComposerLayout.menuWidth,
|
|
).copyWith(
|
|
maximumSize: const WidgetStatePropertyAll(
|
|
Size(ComposerLayout.menuWidth, double.infinity),
|
|
),
|
|
);
|
|
}
|
|
|
|
static InputDecoration projectSearchDecoration(
|
|
BuildContext context, {
|
|
required String hintText,
|
|
}) {
|
|
return InputDecoration(
|
|
hintText: hintText,
|
|
prefixIcon: const Icon(
|
|
AppIcons.search,
|
|
size: ComposerLayout.menuIconSize,
|
|
),
|
|
prefixIconConstraints: const BoxConstraints(
|
|
minWidth: ComposerLayout.controlSize,
|
|
minHeight: ComposerLayout.controlSize,
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
isDense: true,
|
|
filled: false,
|
|
border: InputBorder.none,
|
|
enabledBorder: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
disabledBorder: InputBorder.none,
|
|
hintStyle: AppTheme.composerTextStyle(context)
|
|
.copyWith(color: AppSidebarColors.of(context).tertiary),
|
|
);
|
|
}
|
|
|
|
static ButtonStyle projectTrigger(BuildContext context) {
|
|
final colors = Theme.of(context).colorScheme;
|
|
return TextButton.styleFrom(
|
|
foregroundColor: colors.onSurfaceVariant,
|
|
minimumSize: const Size(0, ComposerLayout.controlSize),
|
|
maximumSize: const Size(double.infinity, ComposerLayout.controlSize),
|
|
visualDensity: VisualDensity.standard,
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
textStyle: AppTheme.composerTextStyle(context),
|
|
);
|
|
}
|
|
|
|
static ButtonStyle controlButton(BuildContext context) =>
|
|
TextButton.styleFrom(
|
|
minimumSize: const Size(0, ComposerLayout.controlSize),
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
padding: const EdgeInsets.symmetric(horizontal: 6),
|
|
textStyle: AppTheme.composerTextStyle(context),
|
|
foregroundColor: AppSidebarColors.of(context).secondary,
|
|
);
|
|
static ButtonStyle controlIcon(BuildContext context) => IconButton.styleFrom(
|
|
minimumSize: const Size.square(ComposerLayout.controlSize),
|
|
maximumSize: const Size.square(ComposerLayout.controlSize),
|
|
padding: EdgeInsets.zero,
|
|
iconSize: ComposerLayout.iconSize,
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
);
|
|
}
|