fix mobile sidebar semantics assertion

This commit is contained in:
ngfchl
2026-07-19 12:46:22 +08:00
parent 7ef1a186ac
commit 9e5adaea2f
+46 -51
View File
@@ -1531,62 +1531,57 @@ class _SidebarTile extends StatelessWidget {
final cs = ShadTheme.of(context).colorScheme; final cs = ShadTheme.of(context).colorScheme;
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 6), padding: const EdgeInsets.only(bottom: 6),
child: Semantics( child: ShadButton.ghost(
button: true, width: double.infinity,
selected: selected, height: 42,
label: label, padding: EdgeInsets.zero,
child: ShadButton.ghost( onPressed: onTap,
width: double.infinity, child: AnimatedContainer(
duration: const Duration(milliseconds: 140),
height: 42, height: 42,
padding: EdgeInsets.zero, padding: const EdgeInsets.symmetric(horizontal: 9),
onPressed: onTap, decoration: BoxDecoration(
child: AnimatedContainer( color: selected
duration: const Duration(milliseconds: 140), ? const Color(0xFFFFB18A).withValues(alpha: 0.72)
height: 42, : Colors.transparent,
padding: const EdgeInsets.symmetric(horizontal: 9), borderRadius: BorderRadius.circular(10),
decoration: BoxDecoration( ),
color: selected child: Row(
? const Color(0xFFFFB18A).withValues(alpha: 0.72) children: [
: Colors.transparent, Container(
borderRadius: BorderRadius.circular(10), width: 28,
), height: 28,
child: Row( decoration: BoxDecoration(
children: [ color: selected
Container( ? Colors.white.withValues(alpha: 0.36)
width: 28, : const Color(0xFFFFE4D2).withValues(alpha: 0.82),
height: 28, borderRadius: BorderRadius.circular(8),
decoration: BoxDecoration(
color: selected
? Colors.white.withValues(alpha: 0.36)
: const Color(0xFFFFE4D2).withValues(alpha: 0.82),
borderRadius: BorderRadius.circular(8),
),
child: Icon(icon, size: 17, color: cs.primary),
), ),
const SizedBox(width: 10), child: Icon(icon, size: 17, color: cs.primary),
Expanded( ),
child: Text( const SizedBox(width: 10),
label, Expanded(
maxLines: 1, child: Text(
overflow: TextOverflow.ellipsis, label,
style: TextStyle( maxLines: 1,
fontSize: 13, overflow: TextOverflow.ellipsis,
fontWeight: selected ? FontWeight.w800 : FontWeight.w600, style: TextStyle(
color: selected ? cs.foreground : cs.mutedForeground, fontSize: 13,
), fontWeight: selected ? FontWeight.w800 : FontWeight.w600,
color: selected ? cs.foreground : cs.mutedForeground,
), ),
), ),
if (count != null) ),
Text( if (count != null)
count.toString(), Text(
style: TextStyle( count.toString(),
fontSize: 11, style: TextStyle(
fontWeight: FontWeight.w700, fontSize: 11,
color: cs.mutedForeground, fontWeight: FontWeight.w700,
), color: cs.mutedForeground,
), ),
], ),
), ],
), ),
), ),
), ),