fix(ui): skip size animation entirely under reduced motion
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user