53d8b911a6
When the open chat's account has an exhausted quota window, a banner above the composer reads "Usage limit reached · resets at HH:MM" and offers to send the last message (or the current draft) a minute after the reset, via chat_prompt send_at. Queued prompts with a future send_at read "Scheduled · sends at HH:MM" and keep Remove. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
715 B
Dart
24 lines
715 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// A scheduled time in the operator's local time, 24-hour as the chat's
|
|
/// message timestamps are: "15:01" today, "Fri 28 Nov 15:01" on another day.
|
|
String chatScheduleTime(
|
|
BuildContext context,
|
|
DateTime at, {
|
|
DateTime Function() now = DateTime.now,
|
|
}) {
|
|
final local = at.toLocal();
|
|
final material = MaterialLocalizations.of(context);
|
|
final time = material.formatTimeOfDay(
|
|
TimeOfDay.fromDateTime(local),
|
|
alwaysUse24HourFormat: true,
|
|
);
|
|
final today = now().toLocal();
|
|
if (local.year == today.year &&
|
|
local.month == today.month &&
|
|
local.day == today.day) {
|
|
return time;
|
|
}
|
|
return '${material.formatMediumDate(local)} $time';
|
|
}
|