JJ_MKVMaker/lib/ui/notice_band.dart

67 lines
2.7 KiB
Dart

/// 약속 (W 공용 위젯, 설계 7-2 NoticeBand): 목록 · 화면 위에 띄우는 안내 띠 하나.
/// 입력: 아이콘 · 제목 · 설명 (없어도 됨, [selectable] 이면 골라 복사) · 단추들 · 색 (처음 값 경고색) · 바깥 여백 ([margin]). 출력: 연한 바탕 · 테두리 · 둥근 띠 - 제목은 굵게, 설명은 작고 흐리게,
/// 단추는 넘치면 다음 줄로 (Wrap). 오류 없음. 폭 · 글자 배율 · 언어에 따라 제목 · 설명은 줄을 바꾼다 (넘치지 않음).
/// 쓰는 곳: 파일 탐색기 안내 (권한 · 읽지 못함 · 만들다 만 파일 · 시스템 폴더 · 루트 · 서버 열쇠) · 실시간 동기화 멈춤 · 마스터 기다림 ·
/// AI 그림 화면 · AI 서비스 · FTP 평문 경고 · 동영상 오류. 화면은 부르기만 한다
library;
import 'package:flutter/material.dart';
import 'theme.dart';
class NoticeBand extends StatelessWidget {
const NoticeBand(
{super.key,
required this.icon,
required this.title,
this.body,
this.actions = const [],
this.color,
this.selectable = false,
this.margin = const EdgeInsets.fromLTRB(6, 6, 6, 0)});
final IconData icon;
final String title;
final String? body;
/// 설명 (설명이 없으면 제목) 을 골라 복사할 수 있게 (오류 원문)
final bool selectable;
final EdgeInsetsGeometry margin;
final List<Widget> actions;
/// 띠 색 (처음 값 [JjColors.alert])
final Color? color;
@override
Widget build(BuildContext context) {
final c = color ?? JjColors.alert;
return Container(
width: double.infinity,
margin: margin,
padding: const EdgeInsets.fromLTRB(12, 10, 12, 6),
decoration: BoxDecoration(
color: c.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: c.withValues(alpha: 0.5)),
),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
Icon(icon, size: 18, color: c),
const SizedBox(width: 8),
Expanded(
child: selectable && body == null
? SelectableText(title, style: const TextStyle(fontWeight: FontWeight.w600))
: Text(title, style: const TextStyle(fontWeight: FontWeight.w600))),
]),
if (body case final b?) ...[
const SizedBox(height: 4),
selectable
? SelectableText(b, style: TextStyle(fontSize: 12, color: JjColors.textDim))
: Text(b, style: TextStyle(fontSize: 12, color: JjColors.textDim)),
],
Wrap(spacing: 8, children: actions),
]),
);
}
}