mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-19 08:54:32 +01:00
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
53 lines
1.4 KiB
Dart
53 lines
1.4 KiB
Dart
/// The time dialog: hour and minute wheels between check and close icons.
|
|
library;
|
|
|
|
import 'package:diet_guard_app/widgets/pickers/picker_frame.dart';
|
|
import 'package:diet_guard_app/widgets/pickers/time_wheels.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
/// Pops the chosen [TimeOfDay], always within [minMinute]..[maxMinute].
|
|
class TimeDialog extends StatefulWidget {
|
|
/// Creates a [TimeDialog]; [initialMinute] is clamped into range, since a
|
|
/// value written by another device may lie outside it.
|
|
const TimeDialog({
|
|
required this.initialMinute,
|
|
required this.minMinute,
|
|
required this.maxMinute,
|
|
super.key,
|
|
});
|
|
|
|
/// The starting minute of day.
|
|
final int initialMinute;
|
|
|
|
/// Earliest allowed minute of day.
|
|
final int minMinute;
|
|
|
|
/// Latest allowed minute of day.
|
|
final int maxMinute;
|
|
|
|
@override
|
|
State<TimeDialog> createState() => _TimeDialogState();
|
|
}
|
|
|
|
class _TimeDialogState extends State<TimeDialog> {
|
|
late int _minute = clampMinute(
|
|
widget.initialMinute,
|
|
widget.minMinute,
|
|
widget.maxMinute,
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) => PickerFrame(
|
|
canConfirm: true,
|
|
onConfirm: () => Navigator.of(
|
|
context,
|
|
).pop(TimeOfDay(hour: _minute ~/ 60, minute: _minute % 60)),
|
|
child: TimeWheels(
|
|
minute: _minute,
|
|
minMinute: widget.minMinute,
|
|
maxMinute: widget.maxMinute,
|
|
onChanged: (m) => setState(() => _minute = m),
|
|
),
|
|
);
|
|
}
|