Initial commit: SubManager Flutter App
주요 구현 완료 기능: - 구독 관리 (추가/편집/삭제/카테고리 분류) - 이벤트 할인 시스템 (기본값 자동 설정) - SMS 자동 스캔 및 구독 정보 추출 - 알림 시스템 (타임존 처리 안정화) - 환율 변환 지원 (KRW/USD) - 반응형 UI 및 애니메이션 - 다국어 지원 (한국어/영어) 버그 수정: - NotificationService tz.local 초기화 오류 해결 - MainScreenSummaryCard 레이아웃 오버플로우 수정 - 구독 추가 시 LateInitializationError 완전 해결 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
179
lib/screens/category_management_screen.dart
Normal file
179
lib/screens/category_management_screen.dart
Normal file
@@ -0,0 +1,179 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../providers/category_provider.dart';
|
||||
import '../models/category_model.dart';
|
||||
|
||||
class CategoryManagementScreen extends StatefulWidget {
|
||||
const CategoryManagementScreen({super.key});
|
||||
|
||||
@override
|
||||
State<CategoryManagementScreen> createState() =>
|
||||
_CategoryManagementScreenState();
|
||||
}
|
||||
|
||||
class _CategoryManagementScreenState extends State<CategoryManagementScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _nameController = TextEditingController();
|
||||
String _selectedColor = '#1976D2';
|
||||
String _selectedIcon = 'subscriptions';
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _addCategory() async {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
await Provider.of<CategoryProvider>(context, listen: false).addCategory(
|
||||
name: _nameController.text,
|
||||
color: _selectedColor,
|
||||
icon: _selectedIcon,
|
||||
);
|
||||
_nameController.clear();
|
||||
setState(() {
|
||||
_selectedColor = '#1976D2';
|
||||
_selectedIcon = 'subscriptions';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('카테고리 관리'),
|
||||
backgroundColor: const Color(0xFF1976D2),
|
||||
),
|
||||
body: Consumer<CategoryProvider>(
|
||||
builder: (context, provider, child) {
|
||||
return Column(
|
||||
children: [
|
||||
// 카테고리 추가 폼
|
||||
Card(
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '카테고리 이름',
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return '카테고리 이름을 입력하세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedColor,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '색상 선택',
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: '#1976D2', child: Text('파란색')),
|
||||
DropdownMenuItem(
|
||||
value: '#4CAF50', child: Text('초록색')),
|
||||
DropdownMenuItem(
|
||||
value: '#FF9800', child: Text('주황색')),
|
||||
DropdownMenuItem(
|
||||
value: '#F44336', child: Text('빨간색')),
|
||||
DropdownMenuItem(
|
||||
value: '#9C27B0', child: Text('보라색')),
|
||||
],
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedColor = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedIcon,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '아이콘 선택',
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'subscriptions', child: Text('구독')),
|
||||
DropdownMenuItem(value: 'movie', child: Text('영화')),
|
||||
DropdownMenuItem(
|
||||
value: 'music_note', child: Text('음악')),
|
||||
DropdownMenuItem(
|
||||
value: 'fitness_center', child: Text('운동')),
|
||||
DropdownMenuItem(
|
||||
value: 'shopping_cart', child: Text('쇼핑')),
|
||||
],
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedIcon = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _addCategory,
|
||||
child: const Text('카테고리 추가'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 카테고리 목록
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: provider.categories.length,
|
||||
itemBuilder: (context, index) {
|
||||
final category = provider.categories[index];
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
IconData(
|
||||
_getIconCode(category.icon),
|
||||
fontFamily: 'MaterialIcons',
|
||||
),
|
||||
color: Color(
|
||||
int.parse(category.color.replaceAll('#', '0xFF'))),
|
||||
),
|
||||
title: Text(category.name),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: () async {
|
||||
await provider.deleteCategory(category.id);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
int _getIconCode(String iconName) {
|
||||
switch (iconName) {
|
||||
case 'subscriptions':
|
||||
return 0xe8c1;
|
||||
case 'movie':
|
||||
return 0xe8c2;
|
||||
case 'music_note':
|
||||
return 0xe405;
|
||||
case 'fitness_center':
|
||||
return 0xeb43;
|
||||
case 'shopping_cart':
|
||||
return 0xe8cc;
|
||||
default:
|
||||
return 0xe8c1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user