49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
|
|
|
/// 페이지 상단 타이틀/설명/액션을 일관되게 출력하는 헤더.
|
|
class PageHeader extends StatelessWidget {
|
|
const PageHeader({
|
|
super.key,
|
|
required this.title,
|
|
this.subtitle,
|
|
this.leading,
|
|
this.actions,
|
|
this.trailing,
|
|
});
|
|
|
|
final String title;
|
|
final String? subtitle;
|
|
final Widget? leading;
|
|
final List<Widget>? actions;
|
|
final Widget? trailing;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = ShadTheme.of(context);
|
|
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (leading != null) ...[leading!, const SizedBox(width: 16)],
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(title, style: theme.textTheme.h2),
|
|
if (subtitle != null) ...[
|
|
const SizedBox(height: 6),
|
|
Text(subtitle!, style: theme.textTheme.muted),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
if (actions != null && actions!.isNotEmpty) ...[
|
|
Wrap(spacing: 12, runSpacing: 12, children: actions!),
|
|
],
|
|
if (trailing != null) ...[const SizedBox(width: 16), trailing!],
|
|
],
|
|
);
|
|
}
|
|
}
|