skip to Main Content

How to make a circle with radius bigger than screen width as set in picture?
design:

enter image description here

I tried to set width of container bigger than screen width, but nothing happened. Any idea how to implement this? I will be very grateful if you help me.

2

Answers


  1. You can create a circle that overflows out of the screen from the center by using the Stack

    Code:

          Widget build(BuildContext context) {
        double scrWidth = MediaQuery.sizeOf(context).width;
        double scrHeight = MediaQuery.sizeOf(context).height;
        return MaterialApp(
          home: Scaffold(
            body: Container(
              width: scrWidth,
              height: scrHeight,
              color: Colors.red.withOpacity(0.8),
              child: Stack(
                alignment: Alignment.center,
                children: [
                  Positioned(
                    width: scrWidth * 1.8,
                    height: scrHeight * 1.8,
                    child: Container(
                      width: scrWidth,
                      height: scrHeight,
                      decoration: BoxDecoration(
                        color: Colors.grey.withOpacity(0.6),
                        shape: BoxShape.circle,
                      ),
                    ),
                  ),
                  Positioned(
                    width: scrWidth * 1.5,
                    height: scrHeight * 1.5,
                    child: Container(
                      width: scrWidth,
                      height: scrHeight,
                      decoration: BoxDecoration(
                        color: Colors.yellow.withOpacity(0.2),
                        shape: BoxShape.circle,
                      ),
                    ),
                  ),
                  Positioned(
                    width: scrWidth * 0.8,
                    height: scrHeight * 0.8,
                    child: Container(
                      width: scrWidth,
                      height: scrHeight,
                      decoration: BoxDecoration(
                        color: Colors.green.withOpacity(0.2),
                        shape: BoxShape.circle,
                      ),
                    ),
                  )
                ],
              ),
            ),
          ),
        );
    }
    

    Result :

    enter image description here

    Login or Signup to reply.
  2. I think transform widget can help you out , just put your circles inside stack and wrap them with with this widget , it has many properties which you can use .

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search