feat: adopt material 3 theme and billing adjustments
This commit is contained in:
@@ -4,8 +4,9 @@ import 'package:provider/provider.dart';
|
||||
import '../../models/subscription_model.dart';
|
||||
import '../../services/currency_util.dart';
|
||||
import '../../services/exchange_rate_service.dart';
|
||||
import '../../theme/app_colors.dart';
|
||||
import '../glassmorphism_card.dart';
|
||||
// import '../../theme/app_colors.dart';
|
||||
import '../../theme/color_scheme_ext.dart';
|
||||
// Glass 제거: Material 3 Card 사용
|
||||
import '../themed_text.dart';
|
||||
import 'analysis_badge.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
@@ -30,18 +31,19 @@ class SubscriptionPieChartCard extends StatefulWidget {
|
||||
|
||||
class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
int _touchedIndex = -1;
|
||||
late Future<List<PieChartSectionData>> _pieSectionsFuture;
|
||||
// kept for compatibility previously; computation now happens per build
|
||||
String? _lastLocale;
|
||||
|
||||
static const _chartColors = [
|
||||
Color(0xFF3B82F6),
|
||||
Color(0xFF10B981),
|
||||
Color(0xFFF59E0B),
|
||||
Color(0xFFEF4444),
|
||||
Color(0xFF8B5CF6),
|
||||
Color(0xFF0EA5E9),
|
||||
Color(0xFFEC4899),
|
||||
];
|
||||
// 차트 팔레트: ColorScheme + 보조 상수(성공/경고/액센트)
|
||||
List<Color> _getChartColors(ColorScheme scheme) => [
|
||||
scheme.primary,
|
||||
scheme.success,
|
||||
scheme.warning,
|
||||
scheme.error,
|
||||
scheme.tertiary,
|
||||
scheme.secondary,
|
||||
const Color(0xFFEC4899), // accent
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -62,7 +64,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
|
||||
void _initializeFuture() {
|
||||
_lastLocale = context.read<LocaleProvider>().locale.languageCode;
|
||||
_pieSectionsFuture = _getPieSections();
|
||||
// no-op: Future computed on demand in build
|
||||
}
|
||||
|
||||
bool _listEquals(List<SubscriptionModel> a, List<SubscriptionModel> b) {
|
||||
@@ -85,6 +87,9 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
// 현재 locale 가져오기
|
||||
final locale = context.read<LocaleProvider>().locale.languageCode;
|
||||
final defaultCurrency = CurrencyUtil.getDefaultCurrency(locale);
|
||||
// Chart palette (capture scheme before any awaits)
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final chartColors = _getChartColors(scheme);
|
||||
|
||||
// 개별 구독의 비율 계산을 위한 값들 (기본 통화로 환산)
|
||||
List<double> sectionValues = [];
|
||||
@@ -121,7 +126,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
// 섹션 데이터 생성 (터치 상태 제외)
|
||||
final sections = List.generate(widget.subscriptions.length, (i) {
|
||||
final percentage = (sectionValues[i] / sectionsTotal) * 100;
|
||||
final index = i % _chartColors.length;
|
||||
final index = i % chartColors.length;
|
||||
|
||||
return PieChartSectionData(
|
||||
value: sectionValues[i],
|
||||
@@ -129,12 +134,12 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
titleStyle: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.pureWhite,
|
||||
color: Colors.white,
|
||||
shadows: [
|
||||
Shadow(color: Colors.black26, blurRadius: 2, offset: Offset(0, 1))
|
||||
],
|
||||
),
|
||||
color: _chartColors[index],
|
||||
color: chartColors[index],
|
||||
radius: 100.0,
|
||||
titlePositionPercentageOffset: 0.6,
|
||||
badgeWidget: null,
|
||||
@@ -150,12 +155,13 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
if (index >= widget.subscriptions.length) return const SizedBox.shrink();
|
||||
|
||||
final subscription = widget.subscriptions[index];
|
||||
final colorIndex = index % _chartColors.length;
|
||||
final chartColors = _getChartColors(Theme.of(context).colorScheme);
|
||||
final colorIndex = index % chartColors.length;
|
||||
|
||||
return IgnorePointer(
|
||||
child: AnalysisBadge(
|
||||
size: 40,
|
||||
borderColor: _chartColors[colorIndex],
|
||||
borderColor: chartColors[colorIndex],
|
||||
subscription: subscription,
|
||||
),
|
||||
);
|
||||
@@ -177,7 +183,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
TextStyle(
|
||||
fontSize: fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.pureWhite,
|
||||
color: Colors.white,
|
||||
shadows: const [
|
||||
Shadow(
|
||||
color: Colors.black26, blurRadius: 2, offset: Offset(0, 1))
|
||||
@@ -210,10 +216,17 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
parent: widget.animationController,
|
||||
curve: const Interval(0.0, 0.7, curve: Curves.easeOut),
|
||||
)),
|
||||
child: GlassmorphismCard(
|
||||
blur: 10,
|
||||
opacity: 0.1,
|
||||
borderRadius: 16,
|
||||
child: Card(
|
||||
elevation: 3,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline
|
||||
.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
@@ -243,20 +256,27 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFE5F2FF),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFBFDBFE),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withValues(alpha: 0.3),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)
|
||||
.exchangeRateFormat(snapshot.data!),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF3B82F6),
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -291,7 +311,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
: SizedBox(
|
||||
height: 250,
|
||||
child: FutureBuilder<List<PieChartSectionData>>(
|
||||
future: _pieSectionsFuture,
|
||||
future: _getPieSections(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
@@ -392,8 +412,10 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
(index) {
|
||||
final subscription =
|
||||
widget.subscriptions[index];
|
||||
final chartColors = _getChartColors(
|
||||
Theme.of(context).colorScheme);
|
||||
final color =
|
||||
_chartColors[index % _chartColors.length];
|
||||
chartColors[index % chartColors.length];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4.0),
|
||||
child: Row(
|
||||
|
||||
Reference in New Issue
Block a user