Files
SpotiFLAC-Mobile/lib/widgets/app_checkbox.dart
T
zarzet 37e21b5712 feat(branding): rename app and native backend to Mornye
Rename the Dart package, Android and iOS identifiers, Rust crates, native libraries, and Discord plugin. Preserve legacy data readers and compatibility aliases.

Update localized branding, documentation, artwork, build tooling, and release artifacts. Route Telegram release notifications to @mornyeupdates and link @mornyecommunity.
2026-10-20 12:00:44 +07:00

60 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:material_3_expressive/material_3_expressive.dart';
import 'package:mornye/theme/material_expressive.dart';
/// Checkbox row for Material dialogs and sheets. Expressive builds use the
/// M3E checkbox; reduced motion falls back to the static Material tile.
/// Mornye call sites keep their own check-circle rows.
class AppCheckboxListTile extends StatelessWidget {
const AppCheckboxListTile({
super.key,
required this.value,
required this.onChanged,
required this.title,
this.subtitle,
this.secondary,
this.contentPadding,
this.controlAffinity = ListTileControlAffinity.platform,
});
final bool value;
final ValueChanged<bool?>? onChanged;
final Widget title;
final Widget? subtitle;
/// Icon on the side opposite the checkbox.
final Widget? secondary;
final EdgeInsetsGeometry? contentPadding;
final ListTileControlAffinity controlAffinity;
@override
Widget build(BuildContext context) {
if (!materialExpressiveEnabled(context)) {
return CheckboxListTile(
value: value,
onChanged: onChanged,
title: title,
subtitle: subtitle,
secondary: secondary,
contentPadding: contentPadding,
controlAffinity: controlAffinity,
);
}
final checkbox = MaterialExpressiveScope(
child: M3ECheckbox(value: value, onChanged: onChanged),
);
final checkboxLeads = controlAffinity == ListTileControlAffinity.leading;
return MergeSemantics(
child: ListTile(
title: title,
subtitle: subtitle,
contentPadding: contentPadding,
enabled: onChanged != null,
onTap: onChanged == null ? null : () => onChanged!(!value),
leading: checkboxLeads ? checkbox : secondary,
trailing: checkboxLeads ? secondary : checkbox,
),
);
}
}