diet-guard/app/lib/widgets/log_sound_tile.dart
Krzysztof kuhy Rudnicki 49144a2c49 Move the app to material_ui for Flutter 3.50
Flutter 3.50 deprecates package:flutter/material.dart; 73 deprecation
infos failed flutter analyze --fatal-infos, and four Dart pins were
behind (crdt_sync_flutter 0.8.2, flutter_local_notifications 23.0.2,
github_device_auth 0.5.0, sync_settings_ui 0.8.2). Those UI packages
now sit on material_ui, so the app has to as well or their widgets lose
MaterialLocalizations.

Imports swap one-for-one and dart fix re-sorted the directives; no
behaviour change. analyze is clean and all six test shards pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
2026-11-16 09:25:34 +01:00

37 lines
944 B
Dart

import 'dart:async';
import 'package:diet_guard_app/services/app_settings_service.dart';
import 'package:material_ui/material_ui.dart';
/// Opt-out switch for the log cue, which ships on.
class LogSoundTile extends StatefulWidget {
/// Creates a [LogSoundTile].
const LogSoundTile({super.key});
@override
State<LogSoundTile> createState() => _LogSoundTileState();
}
class _LogSoundTileState extends State<LogSoundTile> {
bool _on = AppSettingsService.soundOnLog;
void _onChanged(bool on) {
setState(() => _on = on);
unawaited(AppSettingsService.instance.setSoundOnLog(on: on));
}
@override
Widget build(BuildContext context) => SwitchListTile(
contentPadding: EdgeInsets.zero,
title: Align(
alignment: Alignment.centerLeft,
child: Icon(
_on ? Icons.volume_up : Icons.volume_off,
semanticLabel: 'Sound on log',
),
),
value: _on,
onChanged: _onChanged,
);
}