Rohan Kalra
Rohan Kalra

Reputation: 13

Remove Overflow in flutter

I want to remove the overflow warning of the part that cuts the screen. I am creating a circle and want to cut a section of it. I want to do something like the image below.

   Container(
    margin: EdgeInsets.only(top: 50,left: 150),
       //width: MediaQuery.of(context).size.width,

child: Container(
    height:MediaQuery.of(context).size.width,
    width: MediaQuery.of(context).size.width,
child: ClipOval( 
child: SomeWidget
)
)
)

Image Link: https://i.sstatic.net/WAnTq.jpg

Upvotes: 1

Views: 1048

Answers (1)

Jigar Patel
Jigar Patel

Reputation: 5423

You can do this using Stack and Positioned widgets like this..

Widget build(BuildContext context) {
  return Container(
    child: Container(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      child: Stack(
        children: <Widget>[
          Positioned(
            top: 150,
            left: MediaQuery.of(context).size.width*0.3,
            child: ClipOval(
              child: Container(
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.width,
                color: Colors.red,
              ),
            ),
          ),
        ],
      ),
    ),
  );
}

Upvotes: 1

Related Questions