如何让容器占据所有屏幕宽度?

问题描述 投票:0回答:0

如何让这个容器(黑色)占据整个屏幕的宽度

这里是我的代码:

Container(
              height: 50,
              width: MediaQuery.of(context).size.width,
              color: const Color(0xFF262724),
              child: const Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  Icon(Icons.mic_none, color: Colors.white),
                  Icon(
                    Icons.check_box_outlined,
                    color: Colors.white,
                  ),
                ],
              ),
            ),

我试图将宽度设置为

MediaQuery.of(context).size.width
,这显然是屏幕的宽度,但它不起作用。

android flutter containers screen
© www.soinside.com 2019 - 2024. All rights reserved.