Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
142 lines
4.9 KiB
Dart
142 lines
4.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../layout/composer_layout.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 menuSeparatorThickness = 1.0;
|
|
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(Icons.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,
|
|
);
|
|
}
|