| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- import 'package:flutter/material.dart';
- class AppTheme {
- AppTheme._(); // 私有构造,禁止实例化
- /// ======================
- /// 颜色体系(医疗风)
- /// ======================
- static const Color primaryColor = Color(0xFF00BFA5); // 绿为主
- static const Color secondaryColor = Color(0xFF2F7CF6); // 蓝为辅
- static const Color backgroundColor = Color(0xFFF6F8FA);
- static const Color surfaceColor = Colors.white;
- static const Color textPrimary = Color(0xFF1F2937);
- static const Color textSecondary = Color(0xFF6B7280);
- static const Color dividerColor = Color(0xFFE5E7EB);
- static const Color errorColor = Color(0xFFEF4444);
- /// ======================
- /// 亮色主题(默认)
- /// ======================
- static final ThemeData light = ThemeData(
- useMaterial3: true,
- /// 主色
- colorScheme: ColorScheme.light(
- primary: primaryColor,
- secondary: secondaryColor,
- background: backgroundColor,
- surface: surfaceColor,
- error: errorColor,
- onPrimary: Colors.white,
- onBackground: textPrimary,
- ),
- scaffoldBackgroundColor: backgroundColor,
- /// AppBar
- appBarTheme: const AppBarTheme(
- elevation: 0,
- backgroundColor: Colors.white,
- foregroundColor: textPrimary,
- centerTitle: false,
- titleTextStyle: TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.w600,
- color: textPrimary,
- ),
- ),
- /// 字体
- textTheme: const TextTheme(
- headlineLarge: TextStyle(
- fontSize: 22,
- fontWeight: FontWeight.w600,
- color: textPrimary,
- ),
- bodyLarge: TextStyle(
- fontSize: 16,
- color: textPrimary,
- ),
- bodyMedium: TextStyle(
- fontSize: 14,
- color: textSecondary,
- ),
- labelLarge: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
- ),
- /// Divider
- dividerTheme: const DividerThemeData(
- color: dividerColor,
- thickness: 1,
- space: 1,
- ),
- /// Card(Pad 页面大量使用)
- cardTheme: CardThemeData(
- color: surfaceColor,
- elevation: 0,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(12),
- ),
- ),
- /// 按钮
- elevatedButtonTheme: ElevatedButtonThemeData(
- style: ElevatedButton.styleFrom(
- minimumSize: const Size(88, 44),
- backgroundColor: primaryColor,
- foregroundColor: Colors.white,
- textStyle: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w500,
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(8),
- ),
- ),
- ),
- /// 输入框(病历 / 诊断高频)
- inputDecorationTheme: InputDecorationTheme(
- filled: true,
- fillColor: Colors.white,
- contentPadding:
- const EdgeInsets.fromLTRB(12, 18, 12, 10),
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: dividerColor),
- ),
- enabledBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: dividerColor),
- ),
- focusedBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: primaryColor, width: 1.5),
- ),
- errorBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: errorColor),
- ),
- ),
- );
- /// ======================
- /// 暗色主题(预留)
- /// ======================
- static final ThemeData dark = ThemeData.dark(useMaterial3: true);
- }
|