diet-guard/app/lib/ui/source_icon.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

34 lines
980 B
Dart

/// Glyph for where a log entry came from, replacing the stored source word
/// (`manual`, `food bank`, `catering`) that used to be printed on screen.
library;
import 'package:material_ui/material_ui.dart';
/// Icon for a stored entry `source` value; unknown values get a neutral dot.
IconData sourceIcon(String source) => switch (source) {
'manual' => Icons.edit,
'food bank' => Icons.restaurant_menu,
'catering' => Icons.local_shipping,
_ => Icons.circle_outlined,
};
/// A small painted [sourceIcon] that still speaks the stored source value.
class SourceMark extends StatelessWidget {
/// Creates a mark for [source].
const SourceMark(this.source, {this.size = 14, super.key});
/// Stored source value.
final String source;
/// Glyph size.
final double size;
@override
Widget build(BuildContext context) => Icon(
sourceIcon(source),
size: size,
color: Theme.of(context).colorScheme.onSurfaceVariant,
semanticLabel: source,
);
}