0

How put orange container full width?

enter image description here

I'm try with double.infinity but get error BoxConstraints forces an infinite width.

    Container(
      padding: EdgeInsets.symmetric(horizontal: 20),
      height: 205,
      color: Colors.grey,
      //margin: EdgeInsets.symmetric(vertical: 20),
      child: Stack(
        children: [
          Positioned(
            left: 0,
            bottom: 0,
            child: Container(
              height: 185,
              width: 350,  //double.infinity --not working
              color: Colors.deepOrange,
            ),
          ),
          Positioned(
            right:0,
            top:0,
            child: Image.asset('assets/images/book-1.png',width: 150,),
          ),
        ],
      ),
    )
babayaro
  • 491
  • 3
  • 15

1 Answers1

-1

You can use MediaQuery.of(context).size.width for full screen width of Container widget.

Jignesh Patel
  • 223
  • 1
  • 4