diet-guard/app/lib/widgets/log_sound_tile.dart
Krzysztof kuhy Rudnicki 97af520fdd
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Add log sound cue and progress card motion
- lightImpact + 160 ms confirm cue on a validated log (audioplayers,
  no audio focus); device-local opt-out switch in Settings, on by default
- post-log card: confirmation line (slot + the meal's kcal), entrance and
  kcal/streak count-up on motion tokens transcribed into ui/theme.dart;
  durations collapse to zero under disableAnimations
- test/flutter_test_config.dart mutes the cue suite-wide

Todo: 8e66c1b9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWVHMLzeojNP4AaPoEj
2026-11-02 21:12:46 +01:00

37 lines
937 B
Dart

import 'dart:async';
import 'package:diet_guard_app/services/app_settings_service.dart';
import 'package:flutter/material.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,
);
}