앱 전체 알림을 알약형(AppNotice)으로 통일
나머지 화면들(교사 회원가입, 학생 계정 관리, 관리자 대시보드, 스마트기기 반출 신청/대장, NFC 태그 쓰기/체크인, 비밀번호 변경)에 남아있던 예전 ScaffoldMessenger.showSnackBar를 전부 AppNotice로 교체. - AppNotice.show에 선택적 color 파라미터 추가 - NFC 태그 쓰기/체크인 화면처럼 성공(초록)/실패(빨강) 등 색으로 구분하던 알림은 그 색을 그대로 유지하면서 모양/위치만 통일된 알약 스타일로 바뀜 - 알림 직후 화면을 전환(로그인 성공 후 대시보드 이동, 회원가입 성공 후 로그인 화면 복귀 등)하던 곳들도, AppNotice가 화면(Scaffold)이 아니라 전역 Overlay를 쓰기 때문에 전환 중에 알림이 잘리지 않고 새 화면 위에 계속 보임 (기존 스낵바 방식보다 개선됨) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+13
-4
@@ -9,8 +9,13 @@ 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));
|
||||
static void show(
|
||||
BuildContext context,
|
||||
String message, {
|
||||
IconData? icon,
|
||||
Color? color,
|
||||
}) {
|
||||
_queue.add(_QueuedNotice(context, message, icon, color));
|
||||
_tryShowNext();
|
||||
}
|
||||
|
||||
@@ -28,6 +33,7 @@ class AppNotice {
|
||||
builder: (context) => _NoticeBanner(
|
||||
message: next.message,
|
||||
icon: next.icon,
|
||||
color: next.color,
|
||||
onDone: () {
|
||||
entry.remove();
|
||||
_showing = false;
|
||||
@@ -43,17 +49,20 @@ class _QueuedNotice {
|
||||
final BuildContext context;
|
||||
final String message;
|
||||
final IconData? icon;
|
||||
_QueuedNotice(this.context, this.message, this.icon);
|
||||
final Color? color;
|
||||
_QueuedNotice(this.context, this.message, this.icon, this.color);
|
||||
}
|
||||
|
||||
class _NoticeBanner extends StatefulWidget {
|
||||
final String message;
|
||||
final IconData? icon;
|
||||
final Color? color;
|
||||
final VoidCallback onDone;
|
||||
|
||||
const _NoticeBanner({
|
||||
required this.message,
|
||||
required this.icon,
|
||||
required this.color,
|
||||
required this.onDone,
|
||||
});
|
||||
|
||||
@@ -102,7 +111,7 @@ class _NoticeBannerState extends State<_NoticeBanner>
|
||||
constraints: const BoxConstraints(maxWidth: 360),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: AppPalette.ink,
|
||||
color: widget.color ?? AppPalette.ink,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
|
||||
Reference in New Issue
Block a user