- 좌우 슬라이드 대신 맥북 런치패드처럼 확대+페이드로 나타나고 전환 중 뒤 화면이 블러 처리되는 LaunchpadPageRoute 추가, 대시보드의 모든 기능 타일 이동에 적용 - 오른쪽 위 설정 아이콘 + 로그아웃 아이콘 2개를 ">" 버튼 1개로 통합하고, 누르면 로그아웃/설정 메뉴가 런치패드 스타일 오버레이(배경 블러 유지)로 뜨게 변경 - 기능 타일을 누를 때 뜨는 안내 메시지를 스낵바 대신 알약(pill) 모양 알림으로 교체 (AppNotice) - 웹에서는 왼쪽 위, 앱에서는 기존처럼 아래쪽에 표시. 푸시 알림과는 무관. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
163 lines
4.3 KiB
Dart
163 lines
4.3 KiB
Dart
// 🔔 스낵바 대신 쓰는 알약(pill) 모양 알림. 기능 타일을 누를 때 뜨는
|
|
// "OO로 이동합니다" 같은 짧은 안내용. 푸시 알림(FCM)과는 무관 — 그건 그대로 동작한다.
|
|
// 웹에서는 왼쪽 위(알림창 자리)에, 폰 앱에서는 기존 스낵바처럼 아래쪽에 뜬다.
|
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
|
import 'package:flutter/material.dart';
|
|
import '../theme/app_palette.dart';
|
|
|
|
class AppNotice {
|
|
static final List<_QueuedNotice> _queue = [];
|
|
static bool _showing = false;
|
|
|
|
static void show(BuildContext context, String message, {IconData? icon}) {
|
|
_queue.add(_QueuedNotice(context, message, icon));
|
|
_tryShowNext();
|
|
}
|
|
|
|
static void _tryShowNext() {
|
|
if (_showing || _queue.isEmpty) return;
|
|
final next = _queue.removeAt(0);
|
|
if (!next.context.mounted) {
|
|
_tryShowNext();
|
|
return;
|
|
}
|
|
_showing = true;
|
|
final overlay = Overlay.of(next.context);
|
|
late OverlayEntry entry;
|
|
entry = OverlayEntry(
|
|
builder: (context) => _NoticeBanner(
|
|
message: next.message,
|
|
icon: next.icon,
|
|
onDone: () {
|
|
entry.remove();
|
|
_showing = false;
|
|
_tryShowNext();
|
|
},
|
|
),
|
|
);
|
|
overlay.insert(entry);
|
|
}
|
|
}
|
|
|
|
class _QueuedNotice {
|
|
final BuildContext context;
|
|
final String message;
|
|
final IconData? icon;
|
|
_QueuedNotice(this.context, this.message, this.icon);
|
|
}
|
|
|
|
class _NoticeBanner extends StatefulWidget {
|
|
final String message;
|
|
final IconData? icon;
|
|
final VoidCallback onDone;
|
|
|
|
const _NoticeBanner({
|
|
required this.message,
|
|
required this.icon,
|
|
required this.onDone,
|
|
});
|
|
|
|
@override
|
|
State<_NoticeBanner> createState() => _NoticeBannerState();
|
|
}
|
|
|
|
class _NoticeBannerState extends State<_NoticeBanner>
|
|
with SingleTickerProviderStateMixin {
|
|
late final AnimationController _controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(milliseconds: 220),
|
|
reverseDuration: const Duration(milliseconds: 180),
|
|
);
|
|
_controller.forward();
|
|
Future.delayed(const Duration(milliseconds: 2600), () async {
|
|
if (!mounted) return;
|
|
await _controller.reverse();
|
|
widget.onDone();
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final curved = CurvedAnimation(
|
|
parent: _controller,
|
|
curve: Curves.easeOutCubic,
|
|
reverseCurve: Curves.easeInCubic,
|
|
);
|
|
final media = MediaQuery.of(context);
|
|
|
|
final pill = Material(
|
|
color: Colors.transparent,
|
|
child: Container(
|
|
constraints: const BoxConstraints(maxWidth: 360),
|
|
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
|
|
decoration: BoxDecoration(
|
|
color: AppPalette.ink,
|
|
borderRadius: BorderRadius.circular(999),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withValues(alpha: 0.25),
|
|
blurRadius: 16,
|
|
offset: const Offset(0, 6),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (widget.icon != null) ...[
|
|
Icon(widget.icon, color: AppPalette.paper, size: 18),
|
|
const SizedBox(width: 8),
|
|
],
|
|
Flexible(
|
|
child: Text(
|
|
widget.message,
|
|
style: const TextStyle(
|
|
color: AppPalette.paper,
|
|
fontSize: 13.5,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
|
|
final animatedPill = FadeTransition(
|
|
opacity: curved,
|
|
child: SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: kIsWeb ? const Offset(0, -0.3) : const Offset(0, 0.3),
|
|
end: Offset.zero,
|
|
).animate(curved),
|
|
child: pill,
|
|
),
|
|
);
|
|
|
|
if (kIsWeb) {
|
|
return Positioned(
|
|
top: media.padding.top + 16,
|
|
left: 16,
|
|
child: IgnorePointer(child: animatedPill),
|
|
);
|
|
}
|
|
return Positioned(
|
|
left: 16,
|
|
right: 16,
|
|
bottom: media.padding.bottom + 24,
|
|
child: IgnorePointer(child: Center(child: animatedPill)),
|
|
);
|
|
}
|
|
}
|