fix(ui): skip size animation entirely under reduced motion

This commit is contained in:
2026-10-24 13:07:20 +01:00
parent 4b9b93b443
commit 701449b416
2 changed files with 63 additions and 11 deletions
+17 -11
View File
@@ -73,22 +73,28 @@ class _CollapsibleListSectionState extends State<CollapsibleListSection> {
),
),
);
final rows = _open
? Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: widget.children,
)
: const SizedBox(width: double.infinity);
final duration = Motion.of(context, Motion.standard);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(padding: const EdgeInsets.only(top: 8), child: heading),
ClipRect(
child: AnimatedSize(
duration: Motion.of(context, Motion.standard),
curve: Motion.curve,
alignment: Alignment.topCenter,
child: _open
? Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: widget.children,
)
: const SizedBox(width: double.infinity),
),
// A zero-duration AnimatedSize can notify during its own layout when
// rows arrive asynchronously. Reduced motion should skip it entirely.
child: duration == Duration.zero
? rows
: AnimatedSize(
duration: duration,
curve: Motion.curve,
alignment: Alignment.topCenter,
child: rows,
),
),
],
);