小编Rom*_*ine的帖子

如何在 Flutter 中调整图标/图标按钮的大小?

我有2个问题。

  1. 如何缩放我们的图标?我的意思是不是 Flutter 的默认图标。但是当你变成一个图像时。我有一个带有如下图像的图标按钮:
Row(
                        mainAxisSize: MainAxisSize.max,
                        children: <Widget>[
                          IconButton(
                            icon: new Image.asset("images/IG.png"),
                          ),
                          IconButton(
                            icon: new Image.asset("images/Twitter.png"),
                          ),
                          IconButton(
                            icon: new Image.asset("images/Fb.png"),
                          ),
                        ],
                      )
Run Code Online (Sandbox Code Playgroud)

它只有 3 个图标。当我添加更多图标时,它会将布局分成黄黑色的砖块。如何让它们变小?

在此处输入图片说明

  1. 上面的问题是针对 IconButton 的。如何使用图像更改图标?这里是代码:

    Icon(Icons.star, color: Colors.red)

如何star使用 Image.asset更改“ ”?没有任何对其他链接的引用,只显示图标。

icons android flutter flutter-layout

18
推荐指数
1
解决办法
2万
查看次数

如何在 Appbar 上制作一些具有不同对齐方式的图标?

我遇到了一些问题。我想制作一个图像、一个文本和两个图标,AppBar但我不能让它按我想要的方式工作。

我试图在图像和文本之后连续制作一些字体。图像和文本成功显示在 my 中AppBar,但其余 2 种字体(手推车和通知)显示一些错误。

Widget build(BuildContext context) {
    return new Scaffold(
      backgroundColor: Colors.amber,  
      appBar: new AppBar
        (
        title: new Row
          (
          mainAxisAlignment: MainAxisAlignment.start,
            children:
            [
              Image.asset('images/logoapp.png',fit: BoxFit.contain,height: 32,), 
              Container(padding: const EdgeInsets.all(8.0), child: Text('Solid Shop'))
            ],
          )

        ),
Run Code Online (Sandbox Code Playgroud)

....

android-appbarlayout flutter flutter-appbar

17
推荐指数
2
解决办法
3万
查看次数

如何在Flutter中的列上的小部件之间添加垂直分隔线?

美好的一天。

我在这个网站上浏览有关如何在Flutter中的列上的小部件之间添加垂直分隔线的信息?但是我什么都没有。

我想要的 在此处输入图片说明

我已经做了水平分隔线。但是,当我尝试制作一个垂直分隔线来分隔两个对象(文本|图像)时,我什么也没得到。

这是代码:

Row(children: <Widget>[
                Expanded(
                  child: new Container(
                      margin: const EdgeInsets.only(left: 10.0, right: 20.0),
                      child: Divider(
                        color: Colors.black,
                        height: 36,
                      )),
                ),
                Text("OR"),
                Expanded(
                  child: new Container(
                      margin: const EdgeInsets.only(left: 20.0, right: 10.0),
                      child: Divider(
                        color: Colors.black,
                        height: 36,
                      )),
                ),
              ]),
Run Code Online (Sandbox Code Playgroud)

上面的代码是水平的

Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Row(
              children: <Widget>[
                Image.asset('images/makanan.png', width: 30,),
                Text('Diskon 20%', style: TextStyle(fontSize: 5, color: Colors.green),)
              ],
            ),
            VerticalDivider(
              color: Colors.red,
              width: 20,
            ),
            Row(
              children: <Widget>[
                Image.asset('images/makanan.png', width: 30,),
                Text('Diskon 20%', …
Run Code Online (Sandbox Code Playgroud)

android separator divider flutter

3
推荐指数
2
解决办法
1820
查看次数

颤振| 如何在flutter中制作BottomNavigationBar的自定义按钮?

我想制作一个带有文本和图标的按钮,带有自定义背景颜色和自定义宽度。固定位置(不可滚动)。你愿意帮我吗?

这里是代码:

 bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.shifting,
        currentIndex: 0, // this will be set when a new tab is tapped
        items: [
          BottomNavigationBarItem(icon: Icon(Icons.supervised_user_circle), title: Text('Players'),backgroundColor: Colors.red),
          BottomNavigationBarItem(icon: Icon(Icons.whatshot), title: Text('Trending'),backgroundColor: Colors.blueAccent),
          BottomNavigationBarItem(icon: Icon(Icons.access_time), title: Text('Highlights'),backgroundColor: Colors.yellow)
        ]
Run Code Online (Sandbox Code Playgroud)

它只为图标提供颜色。

这就是我要的:

在此处输入图片说明

android flutter bottombar

2
推荐指数
2
解决办法
8827
查看次数