Files
tongxunruanjian/mobile/lib/theme.dart
T
KIMI b95159f7eb 新增 mobile/:畅联手机端 Flutter 工程(B-58)
- 登录:工号+密码走 account-service /api/login,自动登录、被踢下线回登录页
- 消息:会话列表(未读角标/免打扰/时间)、单聊群聊、文字/语音/图片/文件消息、失败重发、历史分页
- 通讯录:新的同事/我的群聊入口、按部门分组(好友 ex 字段)、搜索
- 通话:一对一语音通话(信令走 OpenIM 自定义消息 + LiveKit,token 走 /api/rtc_token)
- 界面按确认效果图 m1/m2/m3 实现,主色 #3B87F5,四态视图齐全,无英文残留
2026-08-09 01:28:12 +08:00

115 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
/// 全 App 统一的视觉常量:颜色、字号阶梯、间距。
/// 字号只保留 4 级,间距全部取 4 的倍数,保证两端(手机/电脑)观感一致。
class AppColors {
AppColors._();
/// 主色蓝(按钮、选中态、头像蓝)
static const Color primary = Color(0xFF3B87F5);
/// 头像灰蓝
static const Color avatarGray = Color(0xFF8593A8);
/// 聊天页背景
static const Color chatBg = Color(0xFFF5F6F8);
/// 页面背景
static const Color pageBg = Color(0xFFFFFFFF);
/// 己方气泡浅蓝
static const Color bubbleMine = Color(0xFFD6E7FC);
/// 对方气泡白
static const Color bubbleOther = Color(0xFFFFFFFF);
/// 搜索框灰底
static const Color searchBg = Color(0xFFF2F3F5);
/// 置顶会话底色(略灰)
static const Color pinnedBg = Color(0xFFF7F8FA);
/// 主要文字
static const Color textPrimary = Color(0xFF1D2129);
/// 次要文字(预览、时间、提示)
static const Color textSecondary = Color(0xFF86909C);
/// 危险/未读红
static const Color danger = Color(0xFFF53F3F);
/// 分隔线
static const Color divider = Color(0xFFEEEEEE);
/// 断网横幅深色底
static const Color bannerBg = Color(0xFF3A3F47);
}
/// 字号阶梯(全 App 只用这 4 级)
class AppFont {
AppFont._();
/// 辅助文字:时间、角标、提示小字
static const double small = 12;
/// 次要文字:预览、职务、副标题
static const double sub = 14;
/// 正文:名字、消息内容、按钮
static const double body = 16;
/// 标题:导航栏、页面大标题
static const double title = 18;
}
/// 间距常量(4 的倍数)
class AppGap {
AppGap._();
static const double x1 = 4;
static const double x2 = 8;
static const double x3 = 12;
static const double x4 = 16;
static const double x6 = 24;
static const double x8 = 32;
static const double x12 = 48;
}
/// 统一的主题
ThemeData buildAppTheme() {
return ThemeData(
useMaterial3: true,
primaryColor: AppColors.primary,
scaffoldBackgroundColor: AppColors.pageBg,
colorScheme: ColorScheme.fromSeed(
seedColor: AppColors.primary,
primary: AppColors.primary,
error: AppColors.danger,
),
appBarTheme: const AppBarTheme(
backgroundColor: AppColors.pageBg,
foregroundColor: AppColors.textPrimary,
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: true,
titleTextStyle: TextStyle(
color: AppColors.textPrimary,
fontSize: AppFont.title,
fontWeight: FontWeight.w600,
),
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedItemColor: AppColors.primary,
unselectedItemColor: AppColors.textSecondary,
selectedLabelStyle: TextStyle(fontSize: AppFont.small),
unselectedLabelStyle: TextStyle(fontSize: AppFont.small),
type: BottomNavigationBarType.fixed,
),
dividerTheme: const DividerThemeData(
color: AppColors.divider,
thickness: 0.5,
space: 0,
),
);
}