- VisionAsync 新增 Temperature=0.7, TopP=0.8 - system prompt 用专业营养识别指令 - userText 用简短"请看图识别食物"配合图片 - 修复重复 prompt 导致 VLM 误读文本的 bug
80 lines
4.4 KiB
Dart
80 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../../core/navigation_provider.dart';
|
|
import '../../providers/auth_provider.dart';
|
|
|
|
class SettingsPage extends ConsumerWidget {
|
|
const SettingsPage({super.key});
|
|
|
|
@override Widget build(BuildContext context, WidgetRef ref) {
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFFF8F7FF),
|
|
body: SafeArea(child: SingleChildScrollView(padding: const EdgeInsets.only(bottom: 30), child: Column(children: [
|
|
Container(width: double.infinity, padding: const EdgeInsets.all(24), decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24))), child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [Text('9:41', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.grey[800])), Row(children: [Icon(Icons.wifi, size: 18, color: Colors.grey[700]), const SizedBox(width: 4), Icon(Icons.battery_full, size: 18, color: Colors.grey[700])]),])),
|
|
const SizedBox(height: 12),
|
|
_SetItem(icon: Icons.notifications_outlined, title: '消息通知', onTap: () => pushRoute(ref, 'notificationPrefs')),
|
|
_SetItem(icon: Icons.medication_outlined, title: '用药提醒', subtitle: 'mmHg / mmol/L'),
|
|
_SetItem(icon: Icons.data_usage_outlined, title: '数据导出'),
|
|
_SetItem(icon: Icons.text_fields_outlined, title: '字体大小', trailingText: 'v1.0.0'),
|
|
_SetItem(icon: Icons.cleaning_services_outlined, title: '清除缓存', subtitle: '73.2 MB'),
|
|
_SetItem(icon: Icons.info_outline, title: '关于健康管家'),
|
|
_SetItem(icon: Icons.shield_outlined, title: '隐私协议'),
|
|
const SizedBox(height: 30),
|
|
GestureDetector(
|
|
onTap: () async {
|
|
final ok = await showDialog<bool>(
|
|
context: context,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('退出登录'),
|
|
content: const Text('确定退出?'),
|
|
actions: [
|
|
TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('取消')),
|
|
TextButton(onPressed: () => Navigator.pop(ctx, true), child: const Text('确定')),
|
|
],
|
|
),
|
|
);
|
|
if (ok == true) { await ref.read(authProvider.notifier).logout(); goRoute(ref, 'login'); }
|
|
},
|
|
child: Container(
|
|
margin: const EdgeInsets.symmetric(horizontal: 24),
|
|
height: 50,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(border: Border.all(color: const Color(0xFFE53935)), borderRadius: BorderRadius.circular(25)),
|
|
child: const Text('退出登录', style: TextStyle(fontSize: 16, color: Color(0xFFE53935), fontWeight: FontWeight.w500)),
|
|
),
|
|
),
|
|
]))),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _SetItem extends StatelessWidget {
|
|
final IconData icon;
|
|
final String title;
|
|
final String? subtitle;
|
|
final String? trailingText;
|
|
final VoidCallback? onTap;
|
|
|
|
const _SetItem({required this.icon, required this.title, this.subtitle, this.trailingText, this.onTap});
|
|
|
|
@override Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Container(
|
|
margin: const EdgeInsets.symmetric(horizontal: 24, vertical: 2),
|
|
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 14),
|
|
decoration: BoxDecoration(color: Colors.white),
|
|
child: Row(children: [
|
|
Container(width: 36, height: 36, decoration: BoxDecoration(color: const Color(0xFFF5F3FF), borderRadius: BorderRadius.circular(10)), child: Icon(icon, size: 18, color: const Color(0xFF635BFF))),
|
|
const SizedBox(width: 12),
|
|
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Text(title, style: const TextStyle(fontSize: 16, color: Color(0xFF1A1A1A))), if (subtitle != null && subtitle!.isNotEmpty) Text(subtitle!, style: TextStyle(fontSize: 13, color: Colors.grey[500]))])),
|
|
if (trailingText != null && trailingText!.isNotEmpty) Text(trailingText!, style: TextStyle(fontSize: 14, color: Colors.grey[400])),
|
|
if (trailingText == null || trailingText!.isEmpty) const SizedBox(),
|
|
Icon(Icons.chevron_right, size: 20, color: Colors.grey[300]),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
}
|