Files
SpotiFLAC-Mobile/lib/widgets/app_choice_chip.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

76 lines
2.2 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:spotiflac_android/theme/mornye_theme.dart';
/// A single tonal selection inside a sheet, without a second glass layer.
class AppChoiceChip extends StatelessWidget {
const AppChoiceChip({
super.key,
required this.label,
required this.selected,
required this.onSelected,
this.visualDensity,
this.singleChoice = false,
});
final Widget label;
final bool selected;
final ValueChanged<bool>? onSelected;
final VisualDensity? visualDensity;
final bool singleChoice;
@override
Widget build(BuildContext context) {
if (!context.isMornye) {
if (singleChoice) {
return ChoiceChip(
label: label,
selected: selected,
onSelected: onSelected,
visualDensity: visualDensity,
);
}
return FilterChip(
label: label,
selected: selected,
onSelected: onSelected,
visualDensity: visualDensity,
);
}
final scheme = Theme.of(context).colorScheme;
final foreground = onSelected == null
? scheme.onSurfaceVariant
: selected
? scheme.primary
: scheme.onSurface;
return Semantics(
selected: selected,
child: CupertinoButton(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
borderRadius: BorderRadius.circular(24),
color: selected
? scheme.primary.withValues(alpha: 0.12)
: MornyeTheme.controlFill(context),
disabledColor: MornyeTheme.controlFill(context, enabled: false),
onPressed: onSelected == null ? null : () => onSelected!(!selected),
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: foreground,
fontWeight: selected ? FontWeight.w600 : FontWeight.w500,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (selected) ...[
Icon(CupertinoIcons.check_mark, size: 18, color: foreground),
const SizedBox(width: 8),
],
Flexible(child: label),
],
),
),
),
);
}
}