Search code examples
flutterheight

Is there a way to prevent a [Column] from rebuilding when the height of a child changes?


Is there a way to prevent a Column from rebuilding when the height of one of its children changes?

The column should not be rebuilt when SizeTransition's animation is played.

Column(
  children: [
    SizeTransition(
      // Multiple arguments.
      child: DynamicSizeWidget_A(),
    ),
    DynamicSizeWidget_B(),
  ]
)

Solution

  • if you use setState to change the height of a child then your entire build method will be rebuilt. but if you use state management package like provider or riverpod, then you can wrap your child with Consumer Widget, and only your child will be rebuilt.