fix(client): 审计修复——device_limit 相对时间走 relativeTime 单源+裸 Icons 换 PangolinIcons+Payment onDone 三处接通+内联双语文案收进 AppText
This commit is contained in:
@@ -12,6 +12,7 @@ import '../services/auth_api.dart';
|
||||
import '../services/device_identity.dart';
|
||||
import '../state/account_providers.dart';
|
||||
import '../state/auth_provider.dart';
|
||||
import '../widgets/pangolin_icons.dart';
|
||||
|
||||
class DeviceLimitScreen extends ConsumerStatefulWidget {
|
||||
const DeviceLimitScreen({super.key, required this.t, required this.limit});
|
||||
@@ -84,7 +85,7 @@ class _DeviceLimitScreenState extends ConsumerState<DeviceLimitScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 32),
|
||||
Icon(Icons.devices_other_rounded, size: 40, color: c.accent),
|
||||
Icon(PangolinIcons.monitorSmartphone, size: 40, color: c.accent),
|
||||
const SizedBox(height: 14),
|
||||
Text(t.deviceLimitTitle,
|
||||
textAlign: TextAlign.center,
|
||||
@@ -97,7 +98,7 @@ class _DeviceLimitScreenState extends ConsumerState<DeviceLimitScreen> {
|
||||
if (removableCount > 0)
|
||||
OutlinedButton.icon(
|
||||
onPressed: _busyUuid != null ? null : () => _removeOldest(devices, currentId),
|
||||
icon: const Icon(Icons.history_rounded, size: 18),
|
||||
icon: const Icon(PangolinIcons.clock, size: 18),
|
||||
label: Text(t.deviceLimitRemoveOldest),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: c.accent,
|
||||
@@ -136,7 +137,9 @@ class _DeviceLimitScreenState extends ConsumerState<DeviceLimitScreen> {
|
||||
final busy = _busyUuid == d.uuid;
|
||||
final sub = d.online
|
||||
? t.devOnline
|
||||
: (d.lastSeen != null ? '${t.devLastOnline} ${_rel(d.lastSeen!)}' : t.devOffline);
|
||||
: (d.lastSeen != null
|
||||
? '${t.devLastOnline} ${t.lang.relativeTime(DateTime.now().difference(d.lastSeen!.toLocal()))}'
|
||||
: t.devOffline);
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
@@ -184,18 +187,9 @@ class _DeviceLimitScreenState extends ConsumerState<DeviceLimitScreen> {
|
||||
}
|
||||
|
||||
static IconData _platformIcon(DevicePlatform p) => switch (p) {
|
||||
DevicePlatform.ios || DevicePlatform.android => Icons.smartphone_rounded,
|
||||
DevicePlatform.windows || DevicePlatform.linux => Icons.computer_rounded,
|
||||
DevicePlatform.macos => Icons.laptop_mac_rounded,
|
||||
DevicePlatform.unknown => Icons.devices_other_rounded,
|
||||
DevicePlatform.ios || DevicePlatform.android => PangolinIcons.smartphone,
|
||||
DevicePlatform.windows || DevicePlatform.linux => PangolinIcons.monitor,
|
||||
DevicePlatform.macos => PangolinIcons.laptop,
|
||||
DevicePlatform.unknown => PangolinIcons.monitorSmartphone,
|
||||
};
|
||||
|
||||
// 相对时间(粗粒度):x 分钟/小时/天前。
|
||||
static String _rel(DateTime t) {
|
||||
final d = DateTime.now().toUtc().difference(t.toUtc());
|
||||
if (d.inMinutes < 1) return '刚刚';
|
||||
if (d.inMinutes < 60) return '${d.inMinutes} 分钟前';
|
||||
if (d.inHours < 24) return '${d.inHours} 小时前';
|
||||
return '${d.inDays} 天前';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user