테마 기능 분리

구글 가변 폰트 추가
업커밍 존 카드 추출
This commit is contained in:
girinb
2025-07-14 21:20:10 +09:00
parent 2e825bbae2
commit 2209ec64e3
7 changed files with 302 additions and 133 deletions

View File

@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class AppTheme {
static final ThemeData lightTheme = ThemeData(
useMaterial3: true,
// ColorScheme을 사용하여 전체적인 색상 톤을 설정합니다.
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue, // 버튼 등 강조 색상은 파란색 계열로 유지합니다.
brightness: Brightness.light, // 밝은 테마로 설정합니다.
background: Colors.white, // 앱의 전체 배경을 흰색으로 지정합니다.
surface: Colors.white, // 카드 등 UI 요소의 표면 색을 흰색으로 지정합니다.
),
// Scaffold의 기본 배경색을 흰색으로 명확하게 지정합니다.
scaffoldBackgroundColor: Colors.white,
// 폰트 테마를 설정하고, 기본 텍스트 색상을 검은색으로 지정합니다.
textTheme: GoogleFonts.hedvigLettersSansTextTheme(
ThemeData.light().textTheme,
).apply(
bodyColor: Colors.black, // 일반 텍스트 색상
displayColor: Colors.black, // 제목 등 큰 텍스트 색상
),
// 앱 바 테마를 흰색 배경, 검은색 아이콘/글씨로 설정합니다.
appBarTheme: const AppBarTheme(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
elevation: 0, // 그림자 제거
),
);
}

View File

@@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import '../../home_page.dart'; // CaseStudyPlan 모델을 import 합니다.
class UpcomingClassCard extends StatelessWidget {
final CaseStudyPlan plan;
final VoidCallback onTap;
const UpcomingClassCard({
super.key,
required this.plan,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width: 300, // 각 항목의 너비를 지정합니다.
child: InkWell(
onTap: onTap,
child: Card(
margin: const EdgeInsets.only(right: 12.0), // 항목 간의 간격 조정
elevation: 2.0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
plan.planTitle,
style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
),
const SizedBox(width: 8.0),
Text(
// plan.planTeacher,
"",
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Colors.grey[600]),
),
],
),
const SizedBox(height: 8.0),
if (plan.thumbnail.isNotEmpty)
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.network(
plan.thumbnail,
width: double.infinity,
fit: BoxFit.cover,
loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: CircularProgressIndicator(
value: loadingProgress.expectedTotalBytes != null
? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
: null,
),
);
},
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return const Center(child: Icon(Icons.broken_image, color: Colors.grey, size: 50));
},
),
),
)
else
Expanded(
child: Container(
color: Colors.grey[200],
child: const Center(child: Text('No Image', style: TextStyle(color: Colors.grey)))
),
),
],
),
),
),
),
);
}
}