fix(stickman): 使用顶部对齐实现昵称与数量标签的中心对齐
昵称标签和数量标签高度相同,顶部对齐即可实现水平中心对齐 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d4b802502e
commit
50bc5a5a20
|
|
@ -256,38 +256,35 @@ class _StickmanRaceWidgetState extends State<StickmanRaceWidget>
|
||||||
top: verticalPosition - bounce,
|
top: verticalPosition - bounce,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end, // 底部对齐
|
crossAxisAlignment: CrossAxisAlignment.start, // 顶部对齐,昵称和数量标签高度相同,自然中心对齐
|
||||||
children: [
|
children: [
|
||||||
// 昵称标签 - 固定在左边,与数量标签底部对齐
|
// 昵称标签 - 与数量标签顶部对齐(两者高度相近,实现中心对齐)
|
||||||
Padding(
|
SizedBox(
|
||||||
padding: const EdgeInsets.only(bottom: 38), // 火柴人高度36 + 间距2
|
width: nicknameAreaWidth,
|
||||||
child: SizedBox(
|
child: Container(
|
||||||
width: nicknameAreaWidth,
|
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||||
child: Container(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
color: data.isCurrentUser
|
||||||
decoration: BoxDecoration(
|
? const Color(0xFFD4AF37).withValues(alpha: 0.2)
|
||||||
|
: Colors.white.withValues(alpha: 0.8),
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
border: data.isCurrentUser
|
||||||
|
? Border.all(color: const Color(0xFFD4AF37), width: 1)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
data.nickname,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 9,
|
||||||
|
fontFamily: 'Inter',
|
||||||
|
fontWeight:
|
||||||
|
data.isCurrentUser ? FontWeight.w600 : FontWeight.w400,
|
||||||
color: data.isCurrentUser
|
color: data.isCurrentUser
|
||||||
? const Color(0xFFD4AF37).withValues(alpha: 0.2)
|
? const Color(0xFFD4AF37)
|
||||||
: Colors.white.withValues(alpha: 0.8),
|
: const Color(0xFF5D4037),
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
border: data.isCurrentUser
|
|
||||||
? Border.all(color: const Color(0xFFD4AF37), width: 1)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
data.nickname,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 9,
|
|
||||||
fontFamily: 'Inter',
|
|
||||||
fontWeight:
|
|
||||||
data.isCurrentUser ? FontWeight.w600 : FontWeight.w400,
|
|
||||||
color: data.isCurrentUser
|
|
||||||
? const Color(0xFFD4AF37)
|
|
||||||
: const Color(0xFF5D4037),
|
|
||||||
),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue