- @doc/color.md 가이드라인에 따른 색상 시스템 전면 개편 - 딥 블루(#2563EB), 스카이 블루(#60A5FA) 메인 컬러로 변경 - 모든 화면과 위젯에 글래스모피즘 효과 일관성 있게 적용 - darkNavy, navyGray 등 새로운 텍스트 색상 체계 도입 - 공통 스낵바 및 다이얼로그 컴포넌트 추가 - Claude AI 프로젝트 컨텍스트 파일(CLAUDE.md) 추가 영향받은 컴포넌트: - 10개 스크린 (main, settings, detail, splash 등) - 30개 이상 위젯 (buttons, cards, forms 등) - 테마 시스템 (AppColors, AppTheme) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
304 lines
9.5 KiB
Dart
304 lines
9.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'dart:ui';
|
|
import '../theme/app_colors.dart';
|
|
import 'themed_text.dart';
|
|
|
|
/// 글래스모피즘 효과가 적용된 통일된 앱바
|
|
class GlassmorphicAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
final String title;
|
|
final List<Widget>? actions;
|
|
final Widget? leading;
|
|
final bool automaticallyImplyLeading;
|
|
final double elevation;
|
|
final Color? backgroundColor;
|
|
final double blur;
|
|
final double opacity;
|
|
final PreferredSizeWidget? bottom;
|
|
final bool centerTitle;
|
|
final double? titleSpacing;
|
|
final VoidCallback? onBackPressed;
|
|
|
|
const GlassmorphicAppBar({
|
|
super.key,
|
|
required this.title,
|
|
this.actions,
|
|
this.leading,
|
|
this.automaticallyImplyLeading = true,
|
|
this.elevation = 0,
|
|
this.backgroundColor,
|
|
this.blur = 20,
|
|
this.opacity = 0.1,
|
|
this.bottom,
|
|
this.centerTitle = false,
|
|
this.titleSpacing,
|
|
this.onBackPressed,
|
|
});
|
|
|
|
@override
|
|
Size get preferredSize => Size.fromHeight(
|
|
kToolbarHeight + (bottom?.preferredSize.height ?? 0.0) + 0.5);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
final canPop = Navigator.of(context).canPop();
|
|
|
|
return ClipRRect(
|
|
child: BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
(backgroundColor ?? (isDarkMode
|
|
? AppColors.glassBackgroundDark
|
|
: AppColors.glassBackground)).withValues(alpha: opacity),
|
|
(backgroundColor ?? (isDarkMode
|
|
? AppColors.glassSurfaceDark
|
|
: AppColors.glassSurface)).withValues(alpha: opacity * 0.8),
|
|
],
|
|
),
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: isDarkMode
|
|
? AppColors.primaryColor.withValues(alpha: 0.3)
|
|
: AppColors.glassBorder.withValues(alpha: 0.5),
|
|
width: 0.5,
|
|
),
|
|
),
|
|
),
|
|
child: SafeArea(
|
|
bottom: false,
|
|
child: ClipRect(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Flexible(
|
|
child: SizedBox(
|
|
height: kToolbarHeight,
|
|
child: NavigationToolbar(
|
|
leading: leading ?? (automaticallyImplyLeading && (canPop || onBackPressed != null)
|
|
? _buildBackButton(context)
|
|
: null),
|
|
middle: _buildTitle(context),
|
|
trailing: actions != null
|
|
? Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: actions!,
|
|
)
|
|
: null,
|
|
centerMiddle: centerTitle,
|
|
middleSpacing: titleSpacing ?? NavigationToolbar.kMiddleSpacing,
|
|
),
|
|
),
|
|
),
|
|
if (bottom != null) bottom!,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildBackButton(BuildContext context) {
|
|
return IconButton(
|
|
icon: const Icon(Icons.arrow_back_ios_new_rounded),
|
|
onPressed: onBackPressed ?? () {
|
|
HapticFeedback.lightImpact();
|
|
Navigator.of(context).pop();
|
|
},
|
|
splashRadius: 24,
|
|
tooltip: '뒤로가기',
|
|
color: ThemedText.getContrastColor(context),
|
|
);
|
|
}
|
|
|
|
Widget _buildTitle(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: ThemedText.headline(
|
|
text: title,
|
|
style: const TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.2,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// 투명 스타일 팩토리
|
|
static GlassmorphicAppBar transparent({
|
|
required String title,
|
|
List<Widget>? actions,
|
|
Widget? leading,
|
|
VoidCallback? onBackPressed,
|
|
}) {
|
|
return GlassmorphicAppBar(
|
|
title: title,
|
|
actions: actions,
|
|
leading: leading,
|
|
blur: 30,
|
|
opacity: 0.05,
|
|
onBackPressed: onBackPressed,
|
|
);
|
|
}
|
|
|
|
/// 반투명 스타일 팩토리
|
|
static GlassmorphicAppBar translucent({
|
|
required String title,
|
|
List<Widget>? actions,
|
|
Widget? leading,
|
|
VoidCallback? onBackPressed,
|
|
}) {
|
|
return GlassmorphicAppBar(
|
|
title: title,
|
|
actions: actions,
|
|
leading: leading,
|
|
blur: 20,
|
|
opacity: 0.15,
|
|
onBackPressed: onBackPressed,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 확장된 글래스모피즘 앱바 (이미지나 추가 콘텐츠 포함)
|
|
class GlassmorphicSliverAppBar extends StatelessWidget {
|
|
final String title;
|
|
final List<Widget>? actions;
|
|
final Widget? leading;
|
|
final double expandedHeight;
|
|
final bool floating;
|
|
final bool pinned;
|
|
final bool snap;
|
|
final Widget? flexibleSpace;
|
|
final double blur;
|
|
final double opacity;
|
|
final bool automaticallyImplyLeading;
|
|
final VoidCallback? onBackPressed;
|
|
final bool centerTitle;
|
|
|
|
const GlassmorphicSliverAppBar({
|
|
super.key,
|
|
required this.title,
|
|
this.actions,
|
|
this.leading,
|
|
this.expandedHeight = kToolbarHeight,
|
|
this.floating = false,
|
|
this.pinned = true,
|
|
this.snap = false,
|
|
this.flexibleSpace,
|
|
this.blur = 20,
|
|
this.opacity = 0.1,
|
|
this.automaticallyImplyLeading = true,
|
|
this.onBackPressed,
|
|
this.centerTitle = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
final canPop = Navigator.of(context).canPop();
|
|
|
|
return SliverAppBar(
|
|
expandedHeight: expandedHeight,
|
|
floating: floating,
|
|
pinned: pinned,
|
|
snap: snap,
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0,
|
|
automaticallyImplyLeading: false,
|
|
leading: leading ?? (automaticallyImplyLeading && (canPop || onBackPressed != null)
|
|
? IconButton(
|
|
icon: const Icon(Icons.arrow_back_ios_new_rounded),
|
|
onPressed: onBackPressed ?? () {
|
|
HapticFeedback.lightImpact();
|
|
Navigator.of(context).pop();
|
|
},
|
|
splashRadius: 24,
|
|
tooltip: '뒤로가기',
|
|
)
|
|
: null),
|
|
actions: actions,
|
|
centerTitle: centerTitle,
|
|
flexibleSpace: LayoutBuilder(
|
|
builder: (BuildContext context, BoxConstraints constraints) {
|
|
final top = constraints.biggest.height;
|
|
final isCollapsed = top <= kToolbarHeight + MediaQuery.of(context).padding.top;
|
|
|
|
return FlexibleSpaceBar(
|
|
title: isCollapsed
|
|
? ThemedText.headline(
|
|
text: title,
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.2,
|
|
),
|
|
)
|
|
: null,
|
|
centerTitle: centerTitle,
|
|
titlePadding: const EdgeInsets.only(left: 16, bottom: 16, right: 16),
|
|
background: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
// 글래스모피즘 배경
|
|
ClipRRect(
|
|
child: BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
(isDarkMode
|
|
? AppColors.glassBackgroundDark
|
|
: AppColors.glassBackground).withValues(alpha: opacity),
|
|
(isDarkMode
|
|
? AppColors.glassSurfaceDark
|
|
: AppColors.glassSurface).withValues(alpha: opacity * 0.8),
|
|
],
|
|
),
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: isDarkMode
|
|
? AppColors.primaryColor.withValues(alpha: 0.3)
|
|
: AppColors.glassBorder.withValues(alpha: 0.5),
|
|
width: 0.5,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
// 확장 상태에서만 보이는 타이틀
|
|
if (!isCollapsed)
|
|
Positioned(
|
|
left: 16,
|
|
right: 16,
|
|
bottom: 16,
|
|
child: ThemedText.headline(
|
|
text: title,
|
|
style: const TextStyle(
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.w700,
|
|
letterSpacing: -0.5,
|
|
),
|
|
),
|
|
),
|
|
// 커스텀 flexibleSpace가 있으면 추가
|
|
if (flexibleSpace != null) flexibleSpace!,
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
} |