c94b9e5e58
Co-Authored-By: Claude Code <noreply@anthropic.com>
38 lines
1.0 KiB
Dart
38 lines
1.0 KiB
Dart
/// 分组标题(UI-01 §3.1:分组标题 17-18):标题 + 可选行尾动作。
|
|
///
|
|
/// 标题取主题 titleMedium(w600);行尾动作由调用方构建(如「查看全部」
|
|
/// TextButton)。不自带内外边距——由页面布局决定(避免为每个 SizedBox
|
|
/// 建一层封装)。
|
|
library;
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// 分组标题行。
|
|
class SectionHeader extends StatelessWidget {
|
|
const SectionHeader({required this.title, this.trailing, super.key});
|
|
|
|
/// 分组标题(本地化文案)。
|
|
final String title;
|
|
|
|
/// 行尾动作(可选)。
|
|
final Widget? trailing;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
title,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: theme.textTheme.titleMedium,
|
|
),
|
|
),
|
|
if (trailing != null) ...[const SizedBox(width: 8), trailing!],
|
|
],
|
|
);
|
|
}
|
|
}
|