Flutter底部溢出,

scyqe7ek  于 2023-11-21  发布在  Flutter
关注(0)|答案(2)|浏览(134)

我所有的bottomappbar代码和所有关于我代码外观的信息都在下面。无论我做了什么,我都无法修复它,我需要帮助:/我所有的bottomappbar代码和所有关于我代码外观的信息都在下面。无论我做了什么,我都无法修复它,我需要帮助:/我所有的bottomappbar代码和所有关于我代码外观的信息都在下面。无论我做了什么,我都无法修复它,我需要帮助:/
enter image description here

bottomNavigationBar: BottomAppBar(
      color: Colors.grey[900],
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
        child: Container(
          height: 90, // İstediğiniz yüksekliğe göre bu değeri ayarlayabilirsiniz.
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
            IconButton(
              icon: Column(
                children: [
                  Image.asset('assets/bomba.png', width: 50, height: 50), // Boyut ayarları
                  SizedBox(height: 1), // İkon ile metin arasındaki mesafe
                  Text(
                    '$_jokerCount',
                    style: TextStyle(fontSize: 10, color: Colors.white), // Metin stili
                  ),
                ],
              ),
              onPressed: () {
                _eliminateTwoWrongChoices();
              },
            ),
            IconButton(
              icon: Image.asset('assets/doktor.png'),
              onPressed: () {
                _selectCorrectAnswer();
              },
            ),
            IconButton(
              icon: Image.asset('assets/süre.png'),
              onPressed: () {
                setState(() {
                  _remainingTime += 15;
                });
              },
            ),

            IconButton(
              icon: Image.asset('assets/skip.png'),
              onPressed: () {
                Navigator.of(context).pop();
                Navigator.of(context).popUntil((route) => route.isFirst);
                Navigator.of(context).push(
                  MaterialPageRoute(builder: (context) => SpinningWheel(jetonSayisi: widget.jetonSayisi, jetonAzalt: widget.jetonAzalt,) //The getter 'jetonAzalt' isn't defined for the type 'QuestionPage'.
                  ),
                );
              },
            ),
          ],
        ),
      ),
    ),
  ),
  ),
);

字符串
} }个文件夹

qeeaahzv

qeeaahzv1#

考虑使用FittedBox

尝试使用FittedBox,它将适合您的可用空间,但如果需要,它将减少图像的大小,也可以考虑使用扩展的响应式布局,

BottomAppBar(
        color: Colors.grey[900],
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
          child: SizedBox(
            height: 90,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                FittedBox(
                  child: IconButton(
                    icon: const Column(
                      children: [
                        Icon(Icons.abc),
                        Text(
                          '2',
                          style: TextStyle(fontSize: 10, color: Colors.white),
                        ),
                      ],
                    ),
                    onPressed: () {},
                  ),
                ),
                IconButton(
                  icon: const Icon(Icons.abc),
                  onPressed: () {},
                ),
                IconButton(
                  icon: const Icon(Icons.abc),
                  onPressed: () {},
                ),
                IconButton(
                  icon: const Icon(Icons.abc),
                  onPressed: () {},
                ),
              ],
            ),
          ),
        ),
      ),

字符串

输出


的数据

pkmbmrz7

pkmbmrz72#

问题是容器中的高度设置为90。在这种情况下,您可以增加高度,另一种方法是更改图标大小或图标与列内文本之间的间距,或者减少BottomAppBar的垂直填充。

相关问题