要在Flutter中的底部导航栏的每个项目上添加背景颜色。

huangapple go评论58阅读模式
英文:

Want to add background color to each item of Bottom Navigation Bar in Flutter

问题

我必须创建一个底部导航栏,每个项目都有像下面这样的背景。

英文:

I have to create a Bottom Navigation Bar with a background for each item like below.要在Flutter中的底部导航栏的每个项目上添加背景颜色。

答案1

得分: 1

以下是翻译好的内容:

尝试使用类似以下的代码:

Material(
  color: Colors.white,
  child: Ink(
    decoration: const ShapeDecoration(
      color: Colors.blue,
      shape: RoundedRectangleBorder(),
    ),
    child: IconButton(
      icon: const Icon(Icons.android),
      color: Colors.white,
      onPressed: () {},
    ),
  ),
);

这将产生如下按钮的输出:
按钮

这是有关此的文档链接:文档链接

希望这有所帮助 要在Flutter中的底部导航栏的每个项目上添加背景颜色。

英文:

Try using some code like this:

Material(
  color: Colors.white,
    child: Ink(
      decoration: const ShapeDecoration(
        color: Colors.blue,
        shape: RoundedRectangleBorder(),
      ),
      child: IconButton(
        icon: const Icon(Icons.android),
        color: Colors.white,
        onPressed: () {},
      ),
    ),
);

Which gives an output of this button:
Button

Here is the link to the documentation about this: Link to documentation

Hope this helps 要在Flutter中的底部导航栏的每个项目上添加背景颜色。

huangapple
  • 本文由 发表于 2023年2月18日 03:10:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/75488378.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定