feat: adopt material 3 theme and billing adjustments
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
// Color resolution now relies on Theme ColorScheme.
|
||||
|
||||
/// 배경에 따라 자동으로 색상 대비를 조정하는 텍스트 위젯
|
||||
class ThemedText extends StatelessWidget {
|
||||
@@ -40,28 +40,12 @@ class ThemedText extends StatelessWidget {
|
||||
bool forceLight = false,
|
||||
bool forceDark = false,
|
||||
}) {
|
||||
if (forceLight) return AppColors.pureWhite;
|
||||
if (forceDark) return AppColors.darkNavy;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
if (forceLight) return scheme.onPrimary; // typically white
|
||||
if (forceDark) return scheme.onSurface; // dark text in light theme
|
||||
|
||||
final brightness = Theme.of(context).brightness;
|
||||
|
||||
// 글래스모피즘 환경에서는 배경이 밝으므로 어두운 텍스트 사용
|
||||
if (_isGlassmorphicContext(context)) {
|
||||
return AppColors.darkNavy; // color.md 가이드: 밝은 배경 위 어두운 텍스트
|
||||
}
|
||||
|
||||
// 일반 환경
|
||||
return brightness == Brightness.dark
|
||||
? AppColors.pureWhite
|
||||
: AppColors.darkNavy;
|
||||
}
|
||||
|
||||
/// 글래스모피즘 컨텍스트인지 확인
|
||||
static bool _isGlassmorphicContext(BuildContext context) {
|
||||
// 부모 위젯 체인에서 글래스모피즘 카드가 있는지 확인
|
||||
final glassmorphic =
|
||||
context.findAncestorWidgetOfExactType<GlassmorphicIndicator>();
|
||||
return glassmorphic != null;
|
||||
// 기본: 스킴의 onSurface 사용(라이트/다크 자동 대비)
|
||||
return scheme.onSurface;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -176,40 +160,3 @@ class ThemedText extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 글래스모피즘 컨텍스트를 표시하는 마커 위젯
|
||||
class GlassmorphicIndicator extends InheritedWidget {
|
||||
const GlassmorphicIndicator({
|
||||
super.key,
|
||||
required super.child,
|
||||
});
|
||||
|
||||
static GlassmorphicIndicator? of(BuildContext context) {
|
||||
return context.dependOnInheritedWidgetOfExactType<GlassmorphicIndicator>();
|
||||
}
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(GlassmorphicIndicator oldWidget) => false;
|
||||
}
|
||||
|
||||
/// 글래스모피즘 환경에서 텍스트 색상을 자동 조정하는 래퍼
|
||||
class GlassmorphicTextWrapper extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const GlassmorphicTextWrapper({
|
||||
super.key,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GlassmorphicIndicator(
|
||||
child: DefaultTextStyle(
|
||||
style: DefaultTextStyle.of(context).style.copyWith(
|
||||
color: ThemedText.getContrastColor(context),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user