mardi 11 mai 2021

How to set minWidth Container in Expand

I using flutter to build the Web Application, I have a response problem, I want my window to be as small as 600 dp, and when zoomed horizontally, the middle container will automatically scale, but the smallest is 200 dp. I tried to write the code as follows, but it doesn't work as I expected. When I shrink to width less than 600, main container keeps automatically shrink and shrink to less than 200 db.

 Row(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.max,
            children: [
              Container(
                width: 200,
                height: 600,
                margin: EdgeInsets.only(right: 20),
                decoration: BoxDecoration(
                  color: Colors.white,
                   borderRadius: BorderRadius.circular(20)),
              ),
             
              Expanded(
                child: Container(
                  margin: EdgeInsets.symmetric(horizontal: 20),
                  constraints: BoxConstraints(minWidth: 300),
                  decoration: BoxDecoration(
                      color: Colors.white.withOpacity(0.8),
                      borderRadius: BorderRadius.circular(20)),
                  child: BlocBuilder<HomeBloc, HomeState>(
                      builder: (context, state) {
                    return state.widget;
                  }),
                ),
              ),
              Container(
                width: 200,
                height: 600,
                margin: EdgeInsets.only(right: 20),
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(20)),
              ),
            ],
          ),

Aucun commentaire:

Enregistrer un commentaire