Files
SpotiFLAC-Mobile/lib/widgets/app_action_button.dart
T
zarzet 63e1a9b9c8 feat(ui): add Mornye glass theme and adaptive music player
Add a selectable Mornye theme with shared glass controls, dialogs, sheets, notifications, and collection headers while retaining Material components.

Update player artwork, lyrics transitions and highlighting, synchronized rolling time labels, volume controls, and compact navigation. Unify metadata, Library, search, and extension surfaces; preserve restored artwork and report extension load failures.

Validation: full Flutter analyzer clean; 713 tests passed and 4 skipped; pinned Dart formatting and diff checks passed; signed ARM64 and ARM32 release APKs built and verified.
2026-09-19 12:10:10 +07:00

99 lines
3.0 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:spotiflac_android/theme/mornye_icons.dart';
import 'package:spotiflac_android/theme/mornye_theme.dart';
import 'package:spotiflac_android/widgets/mornye_chrome.dart';
/// Shared sheet actions follow the selected design on every platform.
class AppActionButton extends StatelessWidget {
const AppActionButton({
super.key,
required this.onPressed,
required this.icon,
required this.label,
this.style,
this.outlined = false,
this.glass = true,
this.tonal = false,
this.isDestructive = false,
this.fontSize = 17,
});
final VoidCallback? onPressed;
final Widget icon;
final Widget label;
final ButtonStyle? style;
final bool outlined;
final bool glass;
final bool tonal;
final bool isDestructive;
final double fontSize;
@override
Widget build(BuildContext context) {
if (!context.isMornye) {
return outlined
? OutlinedButton.icon(
onPressed: onPressed,
icon: icon,
label: label,
style: style,
)
: FilledButton.icon(
onPressed: onPressed,
icon: icon,
label: label,
style: style,
);
}
final scheme = Theme.of(context).colorScheme;
final prominent = isDestructive || !outlined;
final foreground = onPressed == null
? scheme.onSurfaceVariant.withValues(alpha: 0.5)
: prominent
? scheme.onPrimary
: scheme.primary;
final action = CupertinoButton(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
borderRadius: BorderRadius.circular(28),
color: prominent
? scheme.primary
: tonal
? MornyeTheme.controlFill(context)
: Colors.transparent,
disabledColor: !prominent && !tonal && !glass
? Colors.transparent
: tonal && !prominent
? MornyeTheme.controlFill(context, enabled: false)
: scheme.surfaceContainerHighest,
onPressed: onPressed,
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: foreground,
fontSize: fontSize,
fontWeight: FontWeight.w600,
),
child: IconTheme(
data: IconThemeData(color: foreground, size: 20),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (icon case Icon(:final icon?))
Icon(mornyeIconFor(icon), size: 20)
else
icon,
const SizedBox(width: 8),
Flexible(child: label),
],
),
),
),
);
// These buttons sit inside glass sheets/groups; avoid another blur pass.
return prominent || tonal || !glass
? action
: MornyeGlass.navigation(radius: 28, blurEnabled: false, child: action);
}
}