fix(flutter): 统一详情页顶部圆形按钮
This commit is contained in:
1 parent
230f16a44a
commit
c1dd033581
4 files changed
+97
-62
No files matched your search
@@ -34,8 +34,10 @@ const String _menuDownload = 'download';
|
||||
const String _menuShare = 'share';
|
||||
const String _menuReport = 'report';
|
||||
const int _maxTags = 4;
|
||||
const double _moreSize = 36;
|
||||
const double _moreIconSize = 18;
|
||||
const double _stateHeaderHeight = 52;
|
||||
const double _stateHeaderHorizontal = 14;
|
||||
const double _stateTitleGap = 12;
|
||||
const double _stateTitleSize = 18;
|
||||
|
||||
final RegExp _tagSplitter = RegExp(r'[,/、·]');
|
||||
|
||||
@@ -189,7 +191,35 @@ class _DramaDetailPageState extends State<DramaDetailPage> {
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
AppSubpageHeader(title: title, backKey: const Key('detail-back')),
|
||||
SizedBox(
|
||||
height: _stateHeaderHeight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: _stateHeaderHorizontal,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const AppSubpageBackButton(
|
||||
backKey: Key('detail-back'),
|
||||
dark: true,
|
||||
),
|
||||
const SizedBox(width: _stateTitleGap),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.onSurface,
|
||||
fontSize: _stateTitleSize,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(child: child),
|
||||
],
|
||||
),
|
||||
@@ -285,17 +315,13 @@ class _DramaDetailPageState extends State<DramaDetailPage> {
|
||||
),
|
||||
),
|
||||
],
|
||||
child: Container(
|
||||
width: _moreSize,
|
||||
height: _moreSize,
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.card,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.more_horiz_rounded,
|
||||
size: _moreIconSize,
|
||||
color: AppColors.onSurface,
|
||||
child: IgnorePointer(
|
||||
child: AppSubpageCircleButton(
|
||||
buttonKey: const Key('detail-more-visual'),
|
||||
tooltip: l10n.more,
|
||||
icon: Icons.more_horiz_rounded,
|
||||
dark: true,
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -18,8 +18,6 @@ const double _infoGap = 14;
|
||||
const double _favoriteHeight = 34;
|
||||
const double _favoriteRadius = 17;
|
||||
const double _favoriteHorizontal = 12;
|
||||
const double _circleSize = 36;
|
||||
const double _iconSize = 18;
|
||||
|
||||
/// 详情页顶部操作与短剧主信息所需的交互回调。
|
||||
class DramaDetailHeaderActions {
|
||||
@@ -87,10 +85,11 @@ class DramaDetailHeader extends StatelessWidget {
|
||||
onBack: actions.onBack,
|
||||
),
|
||||
const Spacer(),
|
||||
_CircleAction(
|
||||
actionKey: const Key('detail-share'),
|
||||
AppSubpageCircleButton(
|
||||
buttonKey: const Key('detail-share'),
|
||||
tooltip: l10n.share,
|
||||
icon: Icons.share_outlined,
|
||||
dark: true,
|
||||
onPressed: actions.onShare,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -201,36 +200,3 @@ class DramaDetailHeader extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CircleAction extends StatelessWidget {
|
||||
const _CircleAction({
|
||||
required this.actionKey,
|
||||
required this.tooltip,
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
final Key actionKey;
|
||||
final String tooltip;
|
||||
final IconData icon;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
key: actionKey,
|
||||
width: _circleSize,
|
||||
height: _circleSize,
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.card,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: IconButton(
|
||||
tooltip: tooltip,
|
||||
onPressed: onPressed,
|
||||
padding: EdgeInsets.zero,
|
||||
icon: Icon(icon, size: _iconSize, color: AppColors.onSurface),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user