refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode

This commit is contained in:
qzl
2026-03-27 19:07:39 +08:00
parent ecc1ec6ce4
commit ae29a8209b
146 changed files with 4301 additions and 3200 deletions
@@ -21,24 +21,26 @@ class AuthPageScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
final keyboardInset = MediaQuery.viewInsetsOf(context).bottom;
final colorScheme = Theme.of(context).colorScheme;
return Scaffold(
backgroundColor: AppColors.authBackgroundBottom,
backgroundColor: colorScheme.surface,
resizeToAvoidBottomInset: resizeOnKeyboard,
body: DecoratedBox(
decoration: const BoxDecoration(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
AppColors.authBackgroundTop,
AppColors.authBackgroundBottom,
],
colors: [colorScheme.surfaceContainerLow, colorScheme.surface],
),
),
child: Stack(
children: [
const _AuthBackgroundOrbs(),
_AuthBackgroundOrbs(
topColor: colorScheme.primary.withValues(alpha: 0.2),
rightColor: colorScheme.primaryContainer.withValues(alpha: 0.25),
bottomColor: colorScheme.tertiaryContainer.withValues(alpha: 0.3),
),
SafeArea(
maintainBottomViewPadding: !resizeOnKeyboard,
child: LayoutBuilder(
@@ -122,6 +124,8 @@ class AuthHeroHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -130,12 +134,12 @@ class AuthHeroHeader extends StatelessWidget {
width: 88,
height: 88,
decoration: BoxDecoration(
color: AppColors.appIconRing,
color: colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all(color: AppColors.appIconBorder),
border: Border.all(color: colorScheme.outlineVariant),
boxShadow: [
BoxShadow(
color: AppColors.blue300.withValues(alpha: 0.28),
color: colorScheme.primary.withValues(alpha: 0.28),
blurRadius: 30,
offset: const Offset(0, 16),
),
@@ -154,14 +158,14 @@ class AuthHeroHeader extends StatelessWidget {
),
),
SizedBox(height: AppSpacing.lg),
const Text(
Text(
'linksy',
style: TextStyle(
fontFamily: 'Playfair Display',
fontSize: 34,
fontWeight: FontWeight.w700,
fontStyle: FontStyle.italic,
color: AppColors.appTitle,
color: colorScheme.onSurface,
letterSpacing: 0.4,
),
),
@@ -171,10 +175,10 @@ class AuthHeroHeader extends StatelessWidget {
Text(
title!,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.w700,
color: AppColors.slate900,
color: colorScheme.onSurface,
letterSpacing: -0.2,
),
),
@@ -184,10 +188,10 @@ class AuthHeroHeader extends StatelessWidget {
Text(
subtitle!,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
height: 1.45,
color: AppColors.authLinkMuted,
color: colorScheme.onSurfaceVariant,
),
),
],
@@ -203,21 +207,23 @@ class AuthSurfaceCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Container(
width: double.infinity,
padding: const EdgeInsets.all(AppSpacing.xl),
decoration: BoxDecoration(
color: AppColors.authCardBackground,
color: colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.xxl),
border: Border.all(color: AppColors.authCardBorder),
border: Border.all(color: colorScheme.outlineVariant),
boxShadow: [
BoxShadow(
color: AppColors.blue200.withValues(alpha: 0.18),
color: colorScheme.primary.withValues(alpha: 0.12),
blurRadius: 34,
offset: const Offset(0, 18),
),
BoxShadow(
color: AppColors.slate900.withValues(alpha: 0.06),
color: colorScheme.shadow.withValues(alpha: 0.06),
blurRadius: 20,
offset: const Offset(0, 10),
),
@@ -242,26 +248,28 @@ class AuthSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (title != null) ...[
Text(
title!,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
color: AppColors.slate800,
color: colorScheme.onSurface,
),
),
if (description != null) ...[
SizedBox(height: AppSpacing.xs),
Text(
description!,
style: const TextStyle(
style: TextStyle(
fontSize: 13,
height: 1.4,
color: AppColors.authLinkMuted,
color: colorScheme.onSurfaceVariant,
),
),
],
@@ -274,7 +282,15 @@ class AuthSection extends StatelessWidget {
}
class _AuthBackgroundOrbs extends StatelessWidget {
const _AuthBackgroundOrbs();
const _AuthBackgroundOrbs({
required this.topColor,
required this.rightColor,
required this.bottomColor,
});
final Color topColor;
final Color rightColor;
final Color bottomColor;
@override
Widget build(BuildContext context) {
@@ -284,26 +300,17 @@ class _AuthBackgroundOrbs extends StatelessWidget {
Positioned(
top: -72,
left: -38,
child: _Orb(
size: 168,
color: AppColors.authBackgroundOrb.withValues(alpha: 0.42),
),
child: _Orb(size: 168, color: topColor),
),
Positioned(
top: 108,
right: -32,
child: _Orb(
size: 120,
color: AppColors.blue100.withValues(alpha: 0.32),
),
child: _Orb(size: 120, color: rightColor),
),
Positioned(
bottom: 36,
left: 24,
child: _Orb(
size: 92,
color: AppColors.blue50.withValues(alpha: 0.7),
),
child: _Orb(size: 92, color: bottomColor),
),
],
),