refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode
This commit is contained in:
@@ -99,6 +99,7 @@ class _FixedLengthCodeInputState extends State<FixedLengthCodeInput> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final chars = widget.controller.text.split('');
|
||||
final slotHeight = AppSpacing.xl * 2 + AppSpacing.sm;
|
||||
final slotSpacing = AppSpacing.sm;
|
||||
@@ -113,17 +114,17 @@ class _FixedLengthCodeInputState extends State<FixedLengthCodeInput> {
|
||||
duration: const Duration(milliseconds: 180),
|
||||
padding: const EdgeInsets.all(AppSpacing.sm),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.authSectionBackground,
|
||||
color: colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
border: Border.all(
|
||||
color: _isFocused
|
||||
? AppColors.authInputFocus
|
||||
: AppColors.authSectionBorder,
|
||||
? colorScheme.primary
|
||||
: colorScheme.outlineVariant,
|
||||
),
|
||||
boxShadow: _isFocused
|
||||
? [
|
||||
BoxShadow(
|
||||
color: AppColors.blue200.withValues(alpha: 0.28),
|
||||
color: colorScheme.secondary.withValues(alpha: 0.28),
|
||||
blurRadius: 18,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
@@ -164,6 +165,7 @@ class _FixedLengthCodeInputState extends State<FixedLengthCodeInput> {
|
||||
chars: chars,
|
||||
slotHeight: slotHeight,
|
||||
isComplete: isComplete,
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
),
|
||||
if (index != widget.length - 1)
|
||||
@@ -185,6 +187,7 @@ class _FixedLengthCodeInputState extends State<FixedLengthCodeInput> {
|
||||
required List<String> chars,
|
||||
required double slotHeight,
|
||||
required bool isComplete,
|
||||
required ColorScheme colorScheme,
|
||||
}) {
|
||||
final hasChar = index < chars.length;
|
||||
final isActive =
|
||||
@@ -195,19 +198,19 @@ class _FixedLengthCodeInputState extends State<FixedLengthCodeInput> {
|
||||
height: slotHeight,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: hasChar ? AppColors.white : AppColors.authInputBackground,
|
||||
color: hasChar ? colorScheme.surface : colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
border: Border.all(
|
||||
color: isActive
|
||||
? AppColors.authPrimaryButton
|
||||
? colorScheme.primary
|
||||
: isComplete
|
||||
? AppColors.authSecondaryButtonBorder
|
||||
: AppColors.authInputBorder,
|
||||
? colorScheme.outlineVariant
|
||||
: colorScheme.outline,
|
||||
),
|
||||
boxShadow: isActive
|
||||
? [
|
||||
BoxShadow(
|
||||
color: AppColors.blue200.withValues(alpha: 0.32),
|
||||
color: colorScheme.secondary.withValues(alpha: 0.32),
|
||||
blurRadius: 14,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
@@ -219,7 +222,7 @@ class _FixedLengthCodeInputState extends State<FixedLengthCodeInput> {
|
||||
style: TextStyle(
|
||||
fontSize: AppSpacing.xl,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: hasChar ? AppColors.slate900 : AppColors.authLinkMuted,
|
||||
color: hasChar ? colorScheme.onSurface : colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user