Flutter FractionallySizedBox provided rather than a fixed dimension ratio px

Sometimes the dimensions of your design needs relative. FractionallySizedBox item allows you to adjust the size of the child for a small fraction of the total available space.

    Scaffold(
      body: Center(
        child: FractionallySizedBox(
          widthFactor: 0.8,
          heightFactor: 0.8,
          child: Container(
            color: Colors.red,
          ),
        ),
      ),
    );

The above Containerwidth and height to the device 80%.

Guess you like

Origin www.cnblogs.com/ajanuw/p/11570021.html