Files
asset_assistant/frontend/asset_assistant/lib/main.dart
2025-11-13 17:28:54 +08:00

102 lines
3.5 KiB
Dart

import 'package:asset_assistant/pages/login_page.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// 金融风格暗夜主题
final darkTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: const Color(0xFF0F3460), // 主色调:深蓝色
colorScheme: ColorScheme.dark(
primary: const Color(0xFF0F3460),
secondary: const Color(0xFFD4AF37),
surface: const Color(0xFF121212), // 页面主背景
surfaceContainerHighest: const Color(0xFF1E1E1E), // 卡片背景(分层色)
onPrimary: Colors.white,
onSecondary: Colors.black,
onSurface: Colors.white70, // 所有表面的默认文本色
),
// 文本样式(继承 onSurface 颜色,增强可读性)
textTheme: TextTheme(
bodyLarge: TextStyle(color: Colors.white70, fontSize: 16, height: 1.5),
bodyMedium: TextStyle(color: Colors.white60, fontSize: 14, height: 1.5),
headlineLarge: TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.w600,
),
headlineMedium: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
// 输入框样式
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderSide: const BorderSide(color: Color(0xFF333333)),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Color(0xFF333333)),
borderRadius: BorderRadius.circular(8),
),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Color(0xFFD4AF37), width: 2),
borderRadius: BorderRadius.circular(8),
),
labelStyle: const TextStyle(color: Colors.white60),
prefixIconColor: Colors.white60,
hintStyle: const TextStyle(color: Colors.white38),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
),
// 按钮样式
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF0F3460),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
elevation: 2,
shadowColor: Colors.black54,
),
),
// 文本按钮样式(忘记密码)
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: const Color(0xFFD4AF37), // 金色文本,符合辅助色
textStyle: const TextStyle(fontSize: 14),
),
),
// 卡片样式
cardTheme: CardThemeData(
color: const Color(0xFF1E1E1E),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: const BorderSide(color: Color(0xFF333333)),
),
),
// 去除页面默认边距
scaffoldBackgroundColor: const Color(0xFF121212),
);
return MaterialApp(
title: '资产助手',
theme: darkTheme,
home: const LoginPage(),
);
}
}