fix: 欢迎卡片UI优化 + 蓝牙录入按钮 + 多处修复

- 欢迎卡片:去掉白框圆角错位、图片满宽、按钮去箭头改圆角居中
- 渐变actionOutlineGradient改紫蓝双色循环
- 新增健康Agent"蓝牙录入"按钮→蓝牙设备页
- "查看健康情况"改名"健康概览"
- 饮食编辑框删除bug修复(控制器缓存)
- 启动脚本加adb reverse自动转发
- 登录闪屏修复
This commit is contained in:
MingNian
2026-06-17 10:58:59 +08:00
parent 9279b7e283
commit 4f1ad82345
28 changed files with 1641 additions and 1098 deletions

View File

@@ -3,7 +3,7 @@ import 'package:dio/dio.dart';
import 'local_database.dart';
/// API 基础地址
const String baseUrl = 'http://localhost:5000';
const String baseUrl = 'http://localhost:5000'; // adb reverse 或同WiFi直连时改为PC的IP
/// Dio HTTP 客户端封装——带 token 注入、401 自动刷新
class ApiClient {

View File

@@ -10,14 +10,23 @@ class AppColors {
static const Color primaryDark = Color(0xFF5B3FE8);
static const Color blueMeasure = Color(0xFF4F7CFF);
static const Color doctorBlue = Color(0xFF3B82F6);
static const Color auraLavender = Color(0xFFA78BFA);
static const Color auraIndigo = Color(0xFF818CF8);
static const Color auraOrchid = Color(0xFFC084FC);
static const Color auraDeepIndigo = Color(0xFF6366F1);
static const Color mintAccent = Color(0xFF2DD4BF);
static const Color peachAccent = Color(0xFFFFA6A6);
static const Color roseAccent = Color(0xFFF43F5E);
static const Color meadowAccent = Color(0xFF72F874);
static const Color sageAccent = Color(0xFF9CD9C9);
static const Color background = Color(0xFFF7F8FC);
static const Color backgroundSoft = Color(0xFFFBFCFF);
static const Color background = Color(0xFFFAF8FF);
static const Color backgroundSoft = Color(0xFFFFFCFF);
static const Color cardBackground = Color(0xFFFFFFFF);
static const Color cardInner = Color(0xFFF8FAFF);
static const Color cardInner = Color(0xFFF7F5FF);
static const Color pageGrey = background;
static const Color iconBg = Color(0xFFF0F4FF);
static const Color avatarBg = Color(0xFFF3F0FF);
static const Color iconBg = Color(0xFFF2EEFF);
static const Color avatarBg = Color(0xFFF4EFFF);
static const Color textPrimary = Color(0xFF1F2937);
static const Color textSecondary = Color(0xFF667085);
@@ -39,20 +48,76 @@ class AppColors {
static const LinearGradient primaryGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF7C5CFF), Color(0xFF4F7CFF)],
colors: [Color(0xFF8B5CF6), Color(0xFF7C5CFF), Color(0xFF6366F1)],
stops: [0.0, 0.5, 1.0],
);
static const LinearGradient bgGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFFFFFFFF), Color(0xFFF7F8FC), Color(0xFFF3F0FF)],
stops: [0.0, 0.68, 1.0],
colors: [
Color(0xFFFFFCFF),
Color(0xFFF9F5FF),
Color(0xFFF5F1FF),
Color(0xFFF2F6FF),
],
stops: [0.0, 0.42, 0.74, 1.0],
);
static const LinearGradient drawerGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFFFFFFFF), Color(0xFFF6F3FF)],
colors: [Color(0xFFFFFFFF), Color(0xFFFBF7FF), Color(0xFFF0F4FF)],
stops: [0.0, 0.52, 1.0],
);
static const LinearGradient surfaceGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFFFFFFFF), Color(0xFFFCFAFF)],
);
static const LinearGradient softGlassGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xF7FFFFFF), Color(0xECFFFFFF)],
);
static const LinearGradient roseVioletGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF8B5CF6), Color(0xFFF43F5E)],
);
static const LinearGradient sageVioletGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF9CD9C9), Color(0xFFAE2EF9)],
);
static const LinearGradient meadowVioletGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF72F874), Color(0xFF8C6BD9)],
);
static const LinearGradient calmHealthGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF9CD9C9), Color(0xFF818CF8)],
);
static const LinearGradient warmCareGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFFFFA6A6), Color(0xFFC084FC)],
);
static const LinearGradient actionOutlineGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFFC084FC), Color(0xFF818CF8), Color(0xFFC084FC), Color(0xFF818CF8)],
stops: [0.0, 0.3, 0.6, 1.0],
);
static const LinearGradient doctorGradient = LinearGradient(

View File

@@ -2,6 +2,23 @@ import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'app_colors.dart';
class AppBackground extends StatelessWidget {
final Widget child;
final bool safeArea;
const AppBackground({super.key, required this.child, this.safeArea = false});
@override
Widget build(BuildContext context) {
final content = safeArea ? SafeArea(child: child) : child;
return DecoratedBox(
decoration: const BoxDecoration(gradient: AppColors.bgGradient),
child: content,
);
}
}
class GradientScaffold extends StatelessWidget {
final PreferredSizeWidget? appBar;
final Widget? body;
@@ -21,8 +38,7 @@ class GradientScaffold extends StatelessWidget {
});
@override
Widget build(BuildContext context) => Container(
decoration: const BoxDecoration(gradient: AppColors.bgGradient),
Widget build(BuildContext context) => AppBackground(
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: appBar,
@@ -123,34 +139,34 @@ class AppTheme {
surface: surface,
brightness: Brightness.light,
),
scaffoldBackgroundColor: bg,
scaffoldBackgroundColor: Colors.transparent,
splashColor: primary.withValues(alpha: 0.06),
highlightColor: Colors.transparent,
hoverColor: primaryLight.withValues(alpha: 0.55),
fontFamily: null,
appBarTheme: const AppBarTheme(
backgroundColor: surface,
appBarTheme: AppBarTheme(
backgroundColor: Colors.white.withValues(alpha: 0.9),
foregroundColor: text,
elevation: 0,
centerTitle: true,
scrolledUnderElevation: 0,
surfaceTintColor: Colors.transparent,
titleTextStyle: TextStyle(
titleTextStyle: const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w700,
color: text,
),
toolbarHeight: 48,
toolbarHeight: 52,
),
cardTheme: CardThemeData(
color: surface,
color: Colors.white,
elevation: 0,
surfaceTintColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(rLg),
side: const BorderSide(color: border),
side: const BorderSide(color: AppColors.borderLight),
),
margin: EdgeInsets.zero,
),
@@ -161,15 +177,15 @@ class AppTheme {
contentPadding: const EdgeInsets.symmetric(horizontal: sLg, vertical: 13),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(rMd),
borderSide: const BorderSide(color: border),
borderSide: const BorderSide(color: AppColors.borderLight),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(rMd),
borderSide: const BorderSide(color: border),
borderSide: const BorderSide(color: AppColors.borderLight),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(rMd),
borderSide: const BorderSide(color: primary, width: 1.2),
borderSide: const BorderSide(color: AppColors.auraIndigo, width: 1.3),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(rMd),
@@ -183,7 +199,7 @@ class AppTheme {
backgroundColor: primary,
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 50),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(rMd)),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(rLg)),
textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700),
elevation: 0,
),