Files
zarzet 962e582acc chore(flutter): move to Flutter 3.50.0 and the material_ui packages
Flutter 3.50 deprecates its built-in Material and Cupertino libraries in
favour of the material_ui and cupertino_ui packages. The imports move
with the official fix (dart fix, migrate_design_widgets); the app's old
two-library theme bridge collapses into one Theme type.

- MaterialExpressiveScope keeps the complete host theme nearest its
  child. The reduced copy made for the expressive widgets now shares the
  app's Theme type and would hide component themes and extensions.
- LegacyThemeBrightness hands the brightness to the glass package, which
  still reads Flutter's built-in theme.
- appLocalizationsDelegates lists the material_ui localization delegates;
  the generated list still names the built-in ones.
- Tests: findByTooltip and pageBack replace the flutter_test helpers that
  only know the built-in widgets, and several tests that had gone stale
  against earlier app changes are repaired.
2026-11-15 23:33:29 +07:00

60 lines
1.8 KiB
Dart

import 'package:material_ui/material_ui.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,
),
);
}
}